Graphics Reference
In-Depth Information
d
Ú
p
¢
.
(14.24)
c
Note that since Gaussian quadrature is defined for functions defined over [-1,1], in
order to use this method one must reparameterize the integral in (14.24) to
(
)
++
dc
p
-
dctdc
dt
-
Ê
Ë
ˆ
¯
Ê
Ë
ˆ
¯
1
Ú
¢
.
2
2
1
In [GueP90] one then builds a table (u
j
,s
j
), 0 £ j £ n, using Algorithm 14.8.2. The {u
j
}
form a partition of [a,b] and s
j
is a Gaussian quadrature approximation to
u
j
Ú
p
¢
.
c
Using this table, if one wants L(a,u) one first finds the j so that u
j
£ u < u
j+1
and returns
the value
e = some fixed error tolerance
(u
0
,s
0
) = (a,0)
n = 0;
(u
n
,s
n
) = (b,Subdivide (a,b,GQ(a,b),0,e)
real function
Subdivide (
real
c, d, fullInt, totLength, epsilon)
begin
real
m, lval, rval, lsub;
m := (c + d)/2 ;
lval := GQ (c,m);
rval := GQ (m,d);
if
(|fullInt- lval- rval| > epsilon)
then
begin
lsub := Subdivide (c,m,lval,totLength,epsilon/2);
totLength := totLength + lsub;
(u
n
,s
n
) := (m,totLength);
n := n + 1;
return
( lsub + Subdivide (m,d,rval,totLength,epsilon/2);
end
else return
(lval + rval);
end
;
Algorithm 14.8.2.
Building a table for arc length computation.