Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Basic Compiler > Spirograph help...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 149 of 149
Post > Topic >>

Spirograph help please. (Code incl.)

by "Geeza" <a@[EMAIL PROTECTED] > Apr 4, 2008 at 12:17 PM

screen 20,8
Const PI = 3.14159265
dim a as string
dim x as integer
dim y as integer
dim t as integer
dim xx as integer
dim yy as integer
dim fixed as integer
dim moving as integer
dim offset as integer

start:
randomize timer
fixed=int(rnd*200)+1
moving=int(rnd*200)-200
offset=int(rnd*200)+1

for t=1 to 1800000
	
	x = (fixed+moving)*cos(t*(pi/180)) -
(moving+offset)*cos(((fixed+moving)/moving)*t*(pi/180))
	y = (fixed+moving)*sin(t*(pi/180)) -
(moving+offset)*sin(((fixed+moving)/moving)*t*(pi/180))

	if t=1 then
		line (x+500,y+400)-(x+500,y+400),6
	endif
	
	line -(x+500,y+400),6
	
	locate 1,1
	print t
	a = inkey
	if a = "q" then end 0
	
next t
sleep

Right, basically that just draws a single random generated Spirograph. 
You may have noticed i'm using a massive loop to make sure it completes
the cycle.  Thing is, I know the length to complete the cycle can be
calculated, but I just don't know where to start.

Any help would be appreciated, thanks. :)


--------------=  Posted using GrabIt  =----------------
------=  Binary Usenet downloading made easy =---------
-=  Get GrabIt for free from http://www.shemes.com/
 =-




 1 Posts in Topic:
Spirograph help please. (Code incl.)
"Geeza" <a@[  2008-04-04 12:17:44 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue May 13 20:28:56 CDT 2008.