Reflections on a Curved Surface
Just move the mouse inside the box.
This is the core of the collision handler I wrote for my Gravitation and Collision demos. This calculates an intersection between X=B and R2=X2+Y2 at Y=sqrt(R2-B2), then uses the point (B,sqrt(R2-B2)) to create the angle 2*arctangent(Y/X)-90. The other scripts use the velocity direction instead of 90 degrees.
- Original: 28.06.09
Copyright © John Petersen 2019.