Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Other Programming Languages (http://www.programmingforums.org/forum38.html)
-   -   New programming challenge (http://www.programmingforums.org/showthread.php?t=10357)

DaWei Jun 14th, 2006 7:50 AM

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.

bivhitscar Jun 14th, 2006 7:54 AM

Interesting, though I have zero gui experience and I doubt this will work in a console window.

lectricpharaoh Jun 14th, 2006 8:06 AM

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.

bl00dninja Jun 14th, 2006 11:22 AM

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...

DaWei Jun 14th, 2006 11:49 AM

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.

Jimbo Jun 14th, 2006 12:32 PM

Quote:

Originally Posted by bivhitscar
Interesting, though I have zero gui experience and I doubt this will work in a console window.

you need practice with ASCII art, obviously...

looks like another interesting one DaWei... :D

lectricpharaoh Jun 14th, 2006 8:43 PM

Quote:

Originally Posted by DaWei
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).

Hehehe. This almost had me making a tongue-in-cheek want ad post in the job offers forum so I could watch splinter9x and hervens48 fight for 'alpha dog' position. :)

bivhitscar Jun 14th, 2006 9:03 PM

Quote:

Originally Posted by Jimbo
you need practice with ASCII art, obviously...

Indeed I do. Though, it would probably take me months to get the art down, while the algorithm sits unused. ;)

DaWei Jul 7th, 2006 2:44 PM

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.

Zap Jul 7th, 2006 3:01 PM

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