Posted by: algorithmist | September 16, 2008

Spline Tangents Part II

I received a couple questions regarding this post relative to computing the angle of the tangent line relative to the horizontal. It’s a matter of a little trig once you recall the geometric interpretation of a curve’s derivative at a point.  Our old friend, Math.atan2() is just what the doctor ordered.  To illustrate, I modified the demo code to use the Singularity Wedge class to show the angle relative to the horizontal as shown below.

Angle tangent segment makes with the horizontal axis

Angle tangent segment makes with the horizontal axis

The wedge is redrawn dynamically as the slider moves.  Once you know the tangent orientation, you also know the normal orientation.  Along with arc-length parameterization, this means that sprites can be precisely distributed along and aligned to the spline.  Stay tuned for more …


Responses

  1. I wish I had a demo like this when I was taking calculus :)

  2. [...] AS3, Geometry, normal, spline, tangent trackback Once again, there were a few questions regarding this post; namely, how to draw the normal vector to the spline.  One person suggested using the fact that [...]


Categories