- Change directions and speeds of the elements using mechanics
Directions
The f angle we found in the last part will enable us to find the new directions :
Indeed, by rotating it for 90°, we find the tangent of the collision ( black line on the figure ).
Then, the reflection law on this tangent gives you the new direction angle of the source element, which formula is :
newAngle = 2 * ( f + Pi/2 ) - b
where f+Pi/2 is in radians the angle of tangent and b the initial direction angle of the source element.
If the target element can me moved, then its direction is simply the angle f.
Speed
The formulas used to calculate new speeds are again the ones founded on this website :
http://amrita.vlab.co.in/?sub=1&brch=68&sim=197&cnt=1
So, in order to be able to calculate the momentums, the elements have know a mass parameter.
The following is a direct application of these mechanic formulas, so I'm not going to explain it here.
Collisions with the board
Two things must be programmed here :
- Collision with sides
- Friction forces on the board
So, the fundamental princple of dynamics gives a constant acceleration of - g * f, where f is the friction coefficient, and g the constant of earth's gravity.
g has a value of 10, and I'll take 0.35 as friction value for ball/croquet ground, because this is within the range used for pool :
http://billiards.colostate.edu/threads/physics.html
Here ends the part about collision.
No comments:
Post a Comment