开发者

Collision response between two 2d circles

开发者 https://www.devze.com 2023-04-05 07:20 出处:网络
I am trying to write a sim in which two circles will collide and then bounce apart in an 开发者_Python百科elastic collision.Each circle has a position, velocity, mass, and radius.I already have the co

I am trying to write a sim in which two circles will collide and then bounce apart in an 开发者_Python百科elastic collision. Each circle has a position, velocity, mass, and radius. I already have the collision detection worked out, but I do not know how to ensure that the resulting velocities are realistic.

I know that the forces acting on each would be the same, and have already worked out the angle of the resulting forces, but I need to find the magnitude of the forces. Given the speed and velocity, how would one solve for the speed

I am using forces because it fits in well to the rest of the program, if there is an easier way please let me know.


First, figure out how a ball bounces off a wall that has an arbitrary angle. If v is the velocity vector and a is the normal (unit vector perpendicular to the wall and pointing out of it), then v' = v - 2 (v . a) a gives you the velocity after the bounce.

Second, consider the collision of two balls of equal but opposite momenta, like two identical balls with equal but opposite velocities, glancing off each other. Each ball will act as if it struck a wall, namely the line tangent to both balls.

Third, to deal with the general case, we use the Center of Mass Frame. The velocity of the center of mass is:

vCM = (mAvA + mBvB)/(mA+mB)

This is the velocity of an observer to whom the two balls seem to have equal and opposite momenta. The velocities in that observer's frame are:

vA' = vA - vCM
vB' = vB - vCM

Now we use the solution above ("second") to find the velocities after the collision, vA'' and vB'' (still in the CM frame). Finally we shift back into the original frame:

vA''' = vA'' + vCM
vB''' = vB'' + vCM


Use the laws of conservation of momentum and conservation of energy. You will have to assume some fictional masses for each circle as with that will allow you to solve for the resulting velocities after the collision.

Let m1 and m2 be the masses of circle c1 and c2 respectively, with velocities v1 and v2. then ,

m1.v1 + m2.v2 ( before collision ) = m1.v1 + m2.v2 ( after collision ) ( cons. of momentum ) Above eqn is a vector equation.

Apply Conservation of energy : Potential Ener + Kinetic Ener ( before col ) = Pot Ener + Kien Energy ( after collision)

0

精彩评论

暂无评论...
验证码 换一张
取 消