![]() |
New programming challenge
Write a program to emulate a Spirograph. A Spirograph consists of two circles (gears, if you will), one inside the other. The inner circle rolls around the circumferance of the outer circle. A pen is attached at any point on the inner circle and traces a path as the circle rolls. The pattern will vary according to the diameter of the circles and the placement of the pen. You will need a couple of formulae for this one, but they're not tough.
|
Interesting, though I have zero gui experience and I doubt this will work in a console window.
|
Spirograph, yeah, I had one of those as a kid. I only have one idea for emulating it, but it probably won't go anywhere, but we'll see if I can cobble something together.
|
there's a function for this, usually defined parametrically...trying to remember the name...CYCLOID!!! that's it!
x = a(t-sin(t)) y = a(1-cos(t)) this is an equation for the inner wheel travelling along a straight path, it just needs to be put inside of a circle... |
Actually, the principal can be applied with the rolling gear either inside or outside the other gear. One would either add or subtract the radii, depending, before applying the transformation. All the ones I ever owned, however, had the rolling gear inside. Transformation from the straight-line case to the circular case merely means including the radius of the outer gear in the calculations involving the angle. While this requires some thought before hitting the keyboard, I'm sure it's far simpler than producing a 3-D killer game app in three weeks, with so little effort involved that one can release it at no charge (or with such a high chance of success that one can get others to do it on spec). Just a thought, of course; absorption of craft might work by osmosis if one sacrifices enough chickens.
|
Quote:
looks like another interesting one DaWei... :D |
Quote:
|
Quote:
|
1 Attachment(s)
No takers. Well, here's one written in Python, using Boa Constructor and wxWidgets.
http://www.daweidesigns.com/images/adjust.jpg http://www.daweidesigns.com/images/outside.jpg http://www.daweidesigns.com/images/sample1.jpg http://www.daweidesigns.com/images/sample2.jpg Code attached. |
I don't know enough about spirographs to do this... Besides, I really don't know much about windows graphics, yet. I wanted to master controls first. I'll learn, though...
|
| All times are GMT -5. The time now is 8:07 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC