|
NeHe's OpenGL TutorialsComplex equations of particle dynamics have to be solved and therefore I will just post the final solution without any proof. Just trust me on this one :) During the collision of 2 balls we have a situation as it is depicted in Figure 4. Figure 4 U1 and U2 are the velocity vectors of the two spheres at the time of impact. There is an axis (X_Axis) vector which joins the 2 centers of the spheres, and U1x, U2x are the projected vectors of the velocity vectors U1,U2 onto the axis (X_Axis) vector. U1y and U2y are the projected vectors of the velocity vectors U1,U2 onto the axis which is perpendicular to the X_Axis. To find these vectors a few simple dot products are needed. M1, M2 is the mass of the two spheres respectively. V1,V2 are the new velocities after the impact, and V1x, V1y, V2x, V2y are the projections of the velocity vectors onto the X_Axis. In More Detail: a) Find X_Axis X_Axis = (center2 – center1); Unify X_Axis, X_Axis.unit(); b) Find Projections U1x= X_Axis * (X_Axis dot U1) U1y= U1 – U1x U2x =-X_Axis * (-X_Axis dot U2) U2y =U2 – U2x c)Find New Velocities V1x = ((U1x * M1)+(U2x*M2)-(U1x-U2x)*M2) / (M1+M2) V2x= ((U1x * M1)+(U2x*M2)-(U2x-U1x)*M1) / (M1+M2) In our application we set the M1=M2=1, so the equations get even simpler. d)Find The Final Velocities V1y=U1y V2y=U2y V1=V1x+V1y V2=V2x+V2y The derivation of that equations has a lot of work, but once they are in a form like the above they can be used quite easily ...» |
Код для вставки книги в блог HTML
phpBB
текст
|
|