October 8

Here are some example programs that illustrate how to:

  • Calculate the distance between two points (such as the cursor and the center of the screen)
  • Calculate the orientation of a line between two points
  • Constrain a particle to be limited to a circular region

(This is essentially a review of the Pythagorean theorem and some basic trigonometry.)


Orientation of a Line

sketch


Constrain a Particle to a Circle

sketch