Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
Formula for checking points in a cirumference?
Author Message
Paul

Posted: Sat Apr 03, 2004 6:47 pm   Post subject: Formula for checking points in a cirumference?

Im looking for the formula that can check the coordinates on any/all points on the circumference on a circle, it was vaguely mentioned in the tutorials section (?) I dunno, I need it so that the ball when it hits the corner of the paddle, it bounces, checking only vertical and horizontal axis won't work, so far Im using this and it works:

is there a formula for this?
and while Im on the subject, 2 questions,
why does the ball flash and the paddle doesn't, and why when you loose a life, when I use getch, it doesn't run the cls, eventhough the getch is after the cls? I thought getch pauses the program.
heres my program

Description:

Filesize:  2.26 KB

zylum

Posted: Sat Apr 03, 2004 7:01 pm   Post subject: (No subject)

to solve you blinking problem, have the View.Update at the end of the main loop and remove the other ones... also remove the code which draws white over the last positions of the ball and paddle and instead add a cls after the View.update...

and as for the collision detection, if you want really accurate collision detection the i suggest you use the quadratic formula... if you need help with it i'll try to explain, but it's sort of hard to use with collision detection

-zylum
Paul

Posted: Sat Apr 03, 2004 7:06 pm   Post subject: (No subject)

would you explain the formula please?
recneps

Posted: Sat Apr 03, 2004 8:00 pm   Post subject: (No subject)

well if you mean all the points on a circle, then isnt that technically my "circlify"? just change the drawdot to whatever command needed, it goes through the whole screen checking if the dot fits the circle's equation (x,y,and radius)
If not then i misunderstood
Paul

Posted: Fri Apr 09, 2004 4:10 pm   Post subject: (No subject)

waa? I completely missed what your saying, how does it apply to my paddleball (in which I called the inperfect collision detection a cheat "feature")
recneps

Posted: Fri Apr 09, 2004 7:06 pm   Post subject: (No subject)

well you could use what i was saying on the ball, then, if:
dot>one corner of paddle and < other corner of paddle then collision happened, and reverse direction.
The other one workds just as fine, but thats what im interpreting that you needed
Paul

Posted: Fri Apr 09, 2004 7:23 pm   Post subject: (No subject)

thats what I used, but there are still minor glitches happening. the ball still slips thru some times.
gamer

Posted: Fri Apr 09, 2004 7:29 pm   Post subject: (No subject)

i hav a similar problem too......how should we fix this?

gamer

Posted: Sat Apr 10, 2004 6:18 pm   Post subject: (No subject)

anyone??
equs

Posted: Sat Apr 17, 2004 1:39 pm   Post subject: (No subject)

-b +/- sqrt b squared - 4ac / 2a
sqrt everything after the -b and you have to do both equations for 2 points. The plus and - answer.
zylum

Posted: Sat Apr 17, 2004 9:43 pm   Post subject: (No subject)

the formula is the easy part... making an equation that uses the velocity of the ball, the velocity of the paddle and the positions of the ball and paddle to find the time of the collision.... if the time is less than 1 then the collision took place.... otherwise the collision didnt take place... if a collision does take place you multiply the velocty by the time ( < 1 ) and add it to the position and something like that and update the position of the ball and paddle... meh it's something pretty complex but its THE most accurate collision detection... i rember reading it somewhere and trying to implelemt it in one of my flash projects but it was pretty difficult..

-zylum
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 11 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: