
6.2. Animating rigid motion 197
Function B i s ect ( d) {
B i s ect ( d ) returns a τ in the interval [0, 1] which wh en substituted in
P(τ) will return a p o int at a distance d from P
0
. Start by settings
upper and lower bounds for the interval in which τ
d
lies: τ
1
= 0 and τ
2
= 1.0
LOOP:
Test whether the interval in which τ
d
lies is small enough so that
the iteration ca n be terminated: ǫ < 10
−3
i f ( τ
2
− τ
1
< ǫ) jump on to DONE:
Call the function given in listing 6.4 to calculate the dist a n c e along
the spline up to the point determined by τ
d
=
1
2
(τ
1
+ τ
2
)
d
m
= SegLength(τ
d
)
i f (d
m
< d) {
Reduce the interval size by lowering th e upper bound: Set τ
2
= τ
d
}
e