Today's demo is again about curvature
. This time I've added normal vector
(in blue) next to the tangent line
(in green), and the circle (in purple) representing curvature at the tangent location. The curvature on any circle is the same at every point. What this circle then shows is an equivalent circle with the same curvature as the point on the function. With the driving example, the side-to-side G-force experience driving at that point on the curve would be the same as if you were on a circle pictured.
Part of this calculation involved making a line segment for the tangent and normal lines. I wanted the segment for these lines to be a constant length. When I looked at the problem, I saw a use for polar coordinates
. This is because I had a center point, and I wanted to draw a line out some constant distance outward from that point. In polar coordinates a vector is expressed as a radius from the origin, and an angle. I had the radius, I just needed direction.
The direction of this line has to come from my line equation
. That equation is m x
, where m
is the slope and b
is the y-intercept. The slope is expressed as rise over run, or y
. When looking at the triangle formed from this, it was clear the angle formed were the sides opposite (rise) and adjacent (run). Opposite over adjacent is the tangent of the angle. Thus tan( θ
) = m
. which means θ
( m ).
To convert back from polar coordinates we use the point ( r
) ) where r
is the radius. Plugging in the calculation for the angle θ
results in ( r
( m )
( m )
) ). With some trigonometric identities
, this becomes ( r
, m r
). I could likely have figured this out using Pythagorean theorem
but my method still worked.
To get the normal vector, one just has to rotates the tangent line 90 degrees. For this, some matrix math can be used, but I cheated and looked it up. Turns out to rotate a line function in the form m x
, you just modify m
such that m
= -1 / m
. So enjoy the demo!