Collisions

Jim Hurley jhurley0305 at sbcglobal.net
Sun Mar 25 12:53:13 EDT 2012

Geoff,

What happens when two ball of equal mass collide ellastically is an exchange in velocities.

The velocity is a VECTOR. I think that is the source of misunderstanding.

Your right there is  trig involved. For example from "Nine ball..."

function resetVel  xx,yy,xx',yy',vxx,vyy,vxx',vyy'
put xx,yy into pme
put xx',yy' into pOther
put theLineAngle(pme,pOther) into tCentersAngle
put tCentersAngle into tCa
put xx,yy,xx+vxx,yy+vyy into tVelVector
put theLineAngle(tVelVector) into tVa
put sqrt(vxx'*vxx'+vyy'*vyy') into v'
put sqrt(vxx*vxx+vyy*vyy) into v

put xx',yy',xx'+vxx',yy'+vyy' into tVelVector'
put theLineAngle(tVelVector') into tVa'
--Angle of the vVector relative to the line joining centers
put tVa - tCa into tVrA
put tVa'- tCa into tVrA'

put v*cos(tVrA) into vR'
put v*sin(tVrA) into vT
put v'*cos(tVrA') into vR
put  v'*sin(tVrA') into vT'

put vR*cos(tCa) - vT*sin(tCa) into vxx
put vR*sin(tCa) + vT*cos(tCa) into vyy

put vR'*cos(tCa) - vT'*sin(tCa) into vxx'
put vR'*sin(tCa) + vT'*cos(tCa) into vyy'
return vxx,vyy,vxx',vyy'
end resetVel

Jim Hurley

>> Geoff Canyon wrote:
> This works only if the balls hit head-on. Otherwise you need to do the
> trig. As a simple example, say there are two balls headed toward each
> other. Each has a radius of 2^.5. Ball A is moving at -2 units per second
> on the x axis, i.e. to the left, and its center has a Y coordinate of 2.
> Ball B is moving at 2 units per second on the x axis, i.e. to the right,
> and its center has a Y coordinate of 0. When the balls collide, they will
> be 2 units apart both horizontally and vertically, hence they collide at a
> 45 degree angle. Let's say that they're at 0,0 and 2,2 at the time of the
> collision. They won't simply exchange velocities. Their original motion on
> the x axis is translated entirely into motion along the y axis. After the
> collision, ball A will have an X coordinate of 2, and be moving at 2 units
> per second on the Y axis, i.e. up. ball B will have an X coordinate of 0,
> and be moving at -2 units per second on the Y axis, i.e. down. You need to
> calculate the angle between the balls at the moment of collision, and use
> the sine and cosine to figure out what happens from there.
>
> All of the above is from my head so feel free to check me.
>
> On Sun, Mar 25, 2012 at 8:56 AM, Jim Hurley <
> jhurley0305 at sbcglobal.net
> >wrote:
>
> >