# Arc Length Calculation for 2-D and 3-D Tabular Functions

Arc Length Routines ARCLNG and ARCXYZ

My routines for estimating the arc length of a curve follow the concept of covering the curve with a collection of circular arcs. Examples of this concept can be found in Technical Drafting Text Books.

Following my focus of examining the local behavior of the curve by working with a sliding set of three points

Using a sliding set of three points to capture the local behavior of the curve presents then the image of a circumscribing circle for each set of three points.

Heron’s formula provides a direct way to compute the area a triangle with sides: a, b and c.

Letting s be the semi-perimeter of the triangle: s=(a+b+c)/2

Then the Area = SQRT(s(s-a)(s-b)(s-c))

This formula can be replaced with a simpler computation when the triangle is 2-D.

Area = 0.5 * ((xb – xa) * (yc – yb) + (xb – xc) * (yb – ya)) where the triangle vertices are:

(xa,ya) ,(xb,yb) and (xc,yc)

There are two important features to be noted about this process:

1. The three points determine a plane as well as a circle.  Applying Heron’s formula for the Area allows this process to approximate the arc length of three-dimensional tabular functions.
2. As the points slide along the curve, all interior intervals are covered by a left and right arc. My calculation averages the lengths of the two arcs.

ARCLNG – a subroutine to calculate the arc length of a two-dimensional curve.

The ARCLNG routine estimates the two-dimensional arc length distance starting from the first point to each point along the curve.

Usage:        CALL ARCLNG(X,Y,S)

Description of Parameters:

X          input vector of X-coordinate values (DIMENSION N)

Y          input vector of Y-coordinate values (DIMENSION N)

S          output vector of arc lengths (DIMENSION N)

ARCXYZ – a subroutine to calculate the arc length of a three-dimensional space curve.

The ARCXYZ routine estimates the three-dimensional arc length distance from the first point to each point along the curve.

Usage:        CALL ARCXYZ(X,Y,Z,S)

Description of Parameters:

X          input vector of X-coordinate values (DIMENSION N)

Y          input vector of Y-coordinate values (DIMENSION N)

Z          input vector of Z-coordinate values (DIMENSION N)

S          output vector of arc lengths (DIMENSION N)

Note:  The application of these routines is NOT limited to evenly spaced values of the argument.  However, abrupt changes in the spacing of the argument can have an adverse effect on the performance of this subroutine and should be avoided.   On the other hand, as with most numerical procedures, better results can be expected from uniformly spaced argument values.

It’s important to point out that these routines have incorporated two supporting routines that enable the efficient exchange of data between Excel worksheets and VBA arrays.

The way these are used:

Corrected Versions of the Workbooks for ARCLNG and ARCXYZ are available from DropBox

https://www.dropbox.com/l/scl/AABKirG-DWJMXDrLTOlbglZcD-ygq41TpBM

https://www.dropbox.com/l/scl/AACoSxLDbGgHtI1yIGVFD-q4sTl3aA0qin0 ## Author: excel1star

Senior Excel VBA Automation Developer. Ex Aerospace Engineer with Grumman Aerospace

## One thought on “Arc Length Calculation for 2-D and 3-D Tabular Functions”

This site uses Akismet to reduce spam. Learn how your comment data is processed.