# 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 R

^{2}=X

^{2}+Y

^{2}at Y=sqrt(R

^{2}-B

^{2}), then uses the point (B,sqrt(R

^{2}-B

^{2})) to create the angle 2*arctangent(Y/X)-90. The other scripts use the velocity direction instead of 90 degrees.

Modified:

- Original: 28.06.09

**Copyright © John Petersen 2022.**