Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
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]

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
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 4 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: