Help with Equation of a Circle y=sqrt(r**2 + x**2)
Author 
Message 
Kuntzy

Posted: Tue Nov 11, 2003 9:41 pm Post subject: Help with Equation of a Circle y=sqrt(r**2 + x**2) 


I was wondering if anyone knew how to get a line to move around the screen like clock.
All have thus far is:
var r: real:= 200
var mx:int:=1
var my:int:=1
loop
mx+=1
my+=1
var y:real:= sqrt(r**2 + mx**2)
var x:real:= sqrt(r**2 + my**2)
drawline(320, 150, round(x), round(y),black)
delay(30)
cls
end loop
Once I get this i working i want to make a gambling game and would use this to make the ballspin around the table. [/b] 





Sponsor Sponsor



Mazer

Posted: Tue Nov 11, 2003 10:03 pm Post subject: (No subject) 


use trig.
code: 
for i : 0 .. 360 by 2
drawline (maxx div 2, maxy div 2, maxx div 2 + round (80 * cosd (i)), maxy div 2 + round (80 * sind (i)), 7)
drawoval (maxx div 2, maxy div 2, 83, 83, 7)
delay (40)
cls
end for







Tony

Posted: Tue Nov 11, 2003 11:15 pm Post subject: (No subject) 


oh yeah, trig pwnz 8) Calculus too, although I haven't used it in programming just yet... 
Tony's programming blog. DWITE  a programming contest. 




Kuntzy

Posted: Wed Nov 12, 2003 11:07 pm Post subject: Thankz A lot 


Thanks for your help, the code worked great :D 






