Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Help with Equation of a Circle y=sqrt(r**2 + x**2)
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Kuntzy




PostPosted: 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
Sponsor
sponsor
Mazer




PostPosted: 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




PostPosted: 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...
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Kuntzy




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

Thanks for your help, the code worked great :D
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: