Math Quickie: Relationship between arc distance and linear distance.

The first concept is displacement. This is the change in location at two particular points in time. If something happens between the two times we choose, we don't consider that for the equations. That means you could drive your car to work and back home and as long as we only check the location of your car late at night, we might consider the displacement to be 0. The displacement of the arc considered at it's two extremes would come out to be:

startX = 0 + radius
endX = 0 - radius
startY = 0
endY = 0
displacement = sqrt((startX - endX)^2 + (startY - endY)^2)

This is a pretty lame look at the distance travelled along the arc. We know for instance that the arc also changes along the y distance, but because we only looked at the displacement at the extreme we lost all that. Let's go to the next extreme and look at the box distance. The box distance is the linear distance travelled along a single axis. You can get a good idea of the box distance through the diagram. I'll also talk about the difference between distance and displacement. Displacement takes into account the sign or direction of movement while distance removes the sign or direction to provide a different measurement. This shows that the movement along the y-axis will cancel out and result in 0 distance, and we are right back to the first equation.

firstY = Radius, secondY = -Radius, firstX = Radius * 2
displacement = firstY + secondY + firstX
distance = abs(firstY) + abs(secondY) + abs(firstX)

The box distance is another lame approximation of how far the arc has travelled. Why? Well because we look at the x and y values independently. Everyone knows that the shortest distance between two points is a straight line and by travelling first the x-axis and then the y-axis separately we are going to travel further than need be. We need to discover the actual distance to see just how bad the measure is. The actual arc distance can be achieved by looking at the circumference formula of radius (Cr) with relation to the mathematical constant pi. The arc distance for half the circle is now half the circumference.

Cr = 2
Cc = 2 * pi * Cr
arc distance = Cc/2
box distance = Cr * 4

arc distance = 6.28
box distance = 8

Why is there such an error metric between the box distance and the arc distance? Because rather than moving along each axis independently we often move along them simultaneously. While we may move fractions of some distance along both the x-axis and the y-axis taken independently the actual distance moved is much smaller than both of them taken together. If we complete the triangle using the pythagorean formula we can find the distance moved. We'll make use of this by splitting the arc into several separate and distinct points and then computing the distance between those points. This is called interpolation and will always return a final result that is smaller than the arc distance giving us a good bounding for the actual arc distance without actually computing the arc distance. In the figure we use 5 total points to compute 4 distances or chords around the circle.

d(L1) = sqrt((P2.X - P1.X)^2 + (P2.Y- P1.Y)^2)
d(L2) = sqrt((P3.X - P2.X)^2 + (P3.Y- P2.Y)^2)
d(L3) = sqrt((P4.X - P3.X)^2 + (P4.Y- P3.Y)^2)
d(L4) = sqrt((P5.X - P4.X)^2 + (P5.Y- P4.Y)^2)
distance = d(L1) + d(L2) + d(L3) + d(L4)

box distance > arc distance > distance

The more samples you take when interpolating the more accurate the measure will be. There is definite proof for this using some basic trigonometric rules, but I'll leave that up to the reader. Maybe I'll toss a comment with the solution. For now, we need to finish up the arc length solutions and prove that working from an axis causes problems. The interpolation of chords proves this for us by taking the distances at the extremes and at the center of the arc. At the extremes the distance travelled becomes larger because we are moving along the x-axis at a fixed rate and along the y-axis at a variable rate.

d(L1) > d(L2), d(L4) > d(L3)

Rather than base the computation on an axis of movement we need to instead base the computation on the distance travelled. The distance travelled is actually the arc distance. Some of my previous articles on wavy text make use of this measurement for laying out text in circles or along a wavy path. This identifies two coordinate spaces for us to work in. The first coordinate space is the circular space where the movement of the pendulum can be described using only a single coordinate or angle. We update the angle by understanding how the angle will affect the distance travelled this gives us a fixed distance movement routine. When displaying the results, we unfortunately need to convert this into a viewable space, the cartesian coordinate plane where the location will be identified by two coordinates in place of one.

angle = 0
distanceToMove = 1
angleToMove = Cc / 360 * distanceToMove
new angle = angle + angleToMove

x = cos(angle) * Cr
y = sin(angle) * Cr

A quick wrap-up brings the following.

  • Updating a single axis variable to retrieve the second axis variable is interpolation. The distance travelled will always be less than the arc distance but is a good approximation.
  • By not using arc distance in interpolation calculations the distance moved per step will vary with time producing a time dilation at the extremes
  • The best option is to convert the values using the following rules
    • Convert the distance to travel into a change in the angle using the relationship between arc distance and angle
    • Convert the anglular movement into (x, y) coordinates
Published Monday, August 23, 2004 2:22 AM by Justin Rogers
Filed under: ,


No Comments