
Bouncing a ball bounded by a circle
http://www.flickr.com/photos/60395315@N00/3621325296/
I am working on figuring the math for this, wondering if I am on the right path
Lets say the ball is starting from (a,b) inside the circle (see figure) hitting any point (c,d) on the circle. The next point the program calculates based on the acceleration /velocity is outside the circle (m,n).
Now when we check the bounds, the ball should have bounced from the point (c,d).
The line (a,b) & (m,n) intersects the circle at (c,d)
The tangent of the line is x.c + y.d = r*r (x,y are points on the line)
The distance of m,n from the tangent is equal to the point p1, p2 where the bounces to at this point I reverse the velocity & reduce it to .75 percent of its original(approximation).
Am I on the right path here. How do I find point (p1,p2), where I am going to draw the ball?

well, you can solve for the length l1 of the line segment (a,b)(m,n) which should be the magnitude of your velocity * delta time and you can solve for the length l2 of (a,b)(c,d). intuitively, t = (l2 / l1) is in the range 0 < t <= 1 if there is an intersection with the bounding circle this time step. so (1  t) would be the remainder over which to step to find (p1,p2). so it would go something like move circle from (a,b) to (c,d), solve for your new velocity, and scale it by 1  ( l2 / l1 ). add this vector to (c,d) to find (p1,p2).
usually this type of accuracy isn't necessary as you can just move to the point of collision, apply an elastic impulse and integrate the response in the next time step.
Last edited by newblack; 06212009 at 11:33 AM.

Senior Member
I could swear this was asked before here... or somewhere.
edit: oh look not what I had in mind though.
Last edited by realMakc; 06222009 at 06:32 AM.

Hey strikerjax. Looks like we're both looking for the same answer.
How to find the point at which an object traveling in a straight line passes through a circle. I posted the same question a couple of days ago.
http://board.flashkit.com/board/showthread.php?t=802149
There are a couple of ideas in there using either quadratics or a law of sines approach.
Good luck.
1
532100
000000
0
32002
33

Senior Member
Posting Permissions
 You may not post new threads
 You may not post replies
 You may not post attachments
 You may not edit your posts

Forum Rules

Click Here to Expand Forum to Full Width
