4 ms·
Drawing Spirograph curves in Python
- moolcool 8y agoDid you know there's a direct correlation between the decline of Spirograph and the rise in gang activity? Think about it!
- hour_glass 8y agoI'm going to mail one to the oval office. I think spirographs could save us from nuclear war.
- deleted 8y ago[deleted]
- netcraft 8y agoIts mentioned at the bottom of the article, but thought its worth calling out here too: https://nathanfriend.io/inspirograph/ https://nathanfriend.io/inspirograph/
- sytelus 8y agoWhen moving circle is inside, its called Hypotrochoid https://en.wikipedia.org/wiki/Hypotrochoid https://en.wikipedia.org/wiki/Hypotrochoid When moving circle is outside, its called Epitrochoid https://en.wikipedia.org/wiki/Epitrochoid https://en.wikipedia.org/wiki/Epitrochoid The difference between two is sign for radius for moving circle. Overall this is just ploting parametric equations in 2D in Python using complex number trick.
- ValleyOfTheMtns 8y agoStill seems like a kind of magic to non-magic folk like me i.e. a muggle.
- vram22 8y ago>When moving circle is outside, its called Epitrochoid >https://en.wikipedia.org/wiki/Epitrochoid https://en.wikipedia.org/wiki/Epitrochoid The combustion chamber of the Wankel engine is an epitrochoid. (From the above Wikipedia link.) I had read up about Wankel (and also the more conventional internal combustion) engines as a kid. Thought the Wankel engine idea was cool. It has both pros and cons. https://en.wikipedia.org/wiki/Wankel_engine https://en.wikipedia.org/wiki/Wankel_engine
- cheesysam 8y agoIt's not a spirograph curve unless the cog teeth have slipped and your pen has scrawled across the page taking up a bit of paper with it and you have to start again.
- eggy 8y agoAgreed. As much as I like coding and generative art too, there's nothing like the effort of keeping the smaller gear inside the larger one and going fast. Much harder on the outside! I just picked up a $8 Spirograph in tin case for my three year old.
- erikschoster 8y agoThese are really fun shapes to play with -- here's another little python script to draw animated hypotrochoid frames that can be stitched together with ffmpeg: https://github.com/hecanjog/hypotrochoid.py/blob/master/hypo.py#L47 https://github.com/hecanjog/hypotrochoid.py/blob/master/hypo... I stole the relevant bit from here: https://stackoverflow.com/questions/22894942/plotting-hypotrochoids-using-python/22895353#22895353 https://stackoverflow.com/questions/22894942/plotting-hypotr... Here's one video example: https://vimeo.com/99493389 https://vimeo.com/99493389
- abecedarius 8y agoThere's been progress since the 80s when I typed in Basic code for this from a magazine -- it was quite a bit harder to follow.