890 Appendix A Numerical Methods
Input: Curve X(t) with t in [tmin, tmax]
n, the number of subdivision points isn+1
Output: subdivision {P[0],...,P[n]}
void Subdivide(int n, Point P[n + 1])
{
for(inti=0;i<=n;i++) {
float t = tmin + (tmax - tmin)*i/n;
P[i] = X(t);
}
}
A.8.2 Subdivision by Arc Length
This method selects a set of points on the curve that are uniformly spaced along the
curve. The spacing between a pair of points is a distance measurement made along
the curve itself. The distance in this case is called arc length. For example, if the curve
is the semicircle x
2
+ y
2
= 1 for y ≥ 0, the distance between the end points (1, 0)
and (−1, 0) is 2 units when measured in the plane. As points on the semicircle, the
distance between the end points is π units, the arc length of the semicircle. The points
X
i
= (cos(π i/n), sin(π i/n)) for 0 ≤ i ≤ n are a subdivision of the semicircle. The
distance X
i+1
− X
i
measured in the plane varies with i. However, the arc length
between the consecutive pairs of points is π/n, a constant. The points are uniformly
spaced with respect to arc length.
Let L be the total length of the curve. Let t ∈ [t
min
, t
max
] be the curve parameter,
and let s ∈ [0, L] be the arc length parameter. The subdivision is constructed by
finding those points located at s
i
= Li/n for 0 ≤ i ≤ n. The technical problem is
to determine t
i
that corresponds to s
i
. The process of computing t from a specified
s is called reparameterization by arc length. This is accomplished by a numerical
inversion of the integral equation relating s to t . Define Speed(t) =
X
(t) and
Length(t) =
#
t
t
min
X
(τ ) dτ. The problem is now to solve Length(t) −s =0 for the
specifed s, a root-finding task. From the definition of arc length, the root must be
unique. An application of Newton’s method will suffice (see Section A.5). Evaluation
of Length(t) does require a numerical integration. Various algorithms for numerical
integration are provided in Press et al. (1988). The pseudocode for computing t from
s is
Input: The curve X(t), domain [tmin, tmax], and total length L are available
globally. The Length and Speed calls implicitly use these values. The
value of s must be in [0, L].
Output: The value of t corresponding to s.
float GetParameterFromArcLength(float s)