Home > Flex, Math > Spline Tangents Part II

Spline Tangents Part II

September 16, 2008

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 …

  1. JT
    September 16, 2008 at 11:32 am

    I wish I had a demo like this when I was taking calculus🙂

  1. September 17, 2008 at 6:32 am
Comments are closed.
%d bloggers like this: