Zul Hilme
Zul Hilme

Reputation: 31

Ball bouncing off a curved surface

I am doing a 2D ball to wall collision/bouncing animation program. I manage to do ball to ball collision, and ball to straight line wall collision (where both are elastyic collsion).

My question is, how can i work the collision for a ball bouncing off a curve surface? For example a ball bouncing around while being trapped in a circle (the circle is the wall).

Cheers

p.s. i am using c programming language

Upvotes: 1

Views: 2949

Answers (2)

John Dvorak
John Dvorak

Reputation: 27277

The basic principle is always:

  • Find out if collision happened
  • Find out the tangent line of the collision
  • Treat the collision as a collision with a line

In case of circle-circle collisions:

  • Let r1 be the radius of one circle (in 3d, ball)
  • Let r2 be the radius of the other circle
  • Let d be the distance of their centers
  • If d>r1+r2, the circles are completely outside each other
  • If r1>r2+d, the second circle is completely within the first one
  • If r2>r1+d, the first circle is completely within the last one
  • Otherise, the circles overlap:
    • The tangent line (in 3d, the tangent plane) is perpendicular to the line connecting both centers
    • If the first circle is unmovable, let the tangent plane be tangent to the first circle (for the best results)
    • Otherwise, the best choice for the position of the tangent plane will depend on the mass of both circles (choose the position to conserve the center of mass)
    • A circle in 2d never gains angular momentum from a collision except by friction

Upvotes: 2

Kumar Vikramjeet
Kumar Vikramjeet

Reputation: 263

IMHO, when a ball is trapped inside a circular wall, the reflection of the ball will be governed just as in case of normal wall, given the point of contact between wall and ball is negligible. The only change is the plane of the reflection which will be tangent at the point of the contact between the ball and the wall. So, the angle of the tangent will be different at different points of collision which will decide the angle of velocity of the ball.

We can deal with Convex surface by considering the surface as a huge ball with the radius equal to the curvature of the surface. So, we are just calculating collision between 2 balls. Of course, in this case we have to consider that the mass of the surface is infinite and derive the equation from elastic collision equation.

Upvotes: 1

Related Questions