Triangulations and Applications Øyvind Hjelle and Morten Dæhlen aid to oral exam.

advertisement
Øyvind Hjelle and Morten Dæhlen
Triangulations and Applications
Figures algorithms and some equations as an
aid to oral exam.
November 27, 2007
Springer
Berlin Heidelberg NewYork
Hong Kong London
Milan Paris Tokyo
Contents
1
Delaunay Triangulations and Voronoi Diagrams . . . . . . . . . . .
1
2
Algorithms for Delaunay Triangulation . . . . . . . . . . . . . . . . . . . .
9
3
Data Dependent Triangulations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4
Constrained Delaunay Triangulation . . . . . . . . . . . . . . . . . . . . . . . 29
5
Delaunay Refinement Mesh Generation . . . . . . . . . . . . . . . . . . . . 35
6
Least Squares Approximation of Scattered Data . . . . . . . . . . .
6.1 Approximation over Triangulations of Subsets of Data . . . . . . .
6.2 Existence and Uniqueness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.3 Sparsity and Symmetry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.4 Penalized Least Squares . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5 Smoothing Terms for Penalized Least Squares . . . . . . . . . . . . . .
6.6 Approximation over General Triangulations . . . . . . . . . . . . . . . . .
6.7 Weighted Least Squares . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.8 Constrained Least Squares . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.9 Approximation over Binary Triangulations . . . . . . . . . . . . . . . . . .
6.10 Numerical Examples for Binary Triangulations . . . . . . . . . . . . . .
47
49
51
52
53
54
58
60
61
62
63
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
List of Algorithms
1.1
1.2
2.1
2.2
2.3
3.1
3.2
4.1
4.2
4.3
5.1
6.1
Circumcircle test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
LOP, Local Optimization Procedure . . . . . . . . . . . . . . . . . . . . . . . .
Simple Delaunay triangulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Radial Sweep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
recSwapDelaunay(Edge ei ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
LOP for data dependent triangulations . . . . . . . . . . . . . . . . . . . . . .
Simulated annealing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Eliminate um ,with αm < π, from Qec ,L . . . . . . . . . . . . . . . . . . . . . .
Include ec as an edge in a triangulation . . . . . . . . . . . . . . . . . . . . .
recSwapDelaunayConstr(Edge ei ) . . . . . . . . . . . . . . . . . . . . . . . . .
Delaunay refinement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
General multilevel scheme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1
1
9
9
10
19
20
29
29
29
35
62
1
Delaunay Triangulations and Voronoi Diagrams
Algorithm 1.1 Circumcircle test
1.
2.
3.
4.
5.
6.
7.
8.
if (cos α < 0 and cos β < 0)
return FALSE // swap the edge
if (cos α > 0 and cos β > 0)
return TRUE
if (cos α sin β + sin α cos β < 0)
return FALSE
// swap the edge
else
return TRUE
Algorithm 1.2 LOP, Local Optimization Procedure
1. Make an arbitrary legal triangulation ∆ of a point set P .
2. if ∆ is locally optimal,
stop.
3. Let ei be an interior edge of ∆ which is not locally optimal.
4. Swap ei to e0i , thus transforming ∆ to ∆0 .
5. Let ∆ := ∆0 .
6. goto 2.
(a)
(b)
α
α
Fig. 1.1. Two triangulations of the same point set that satisfy the MaxMin angle
criterion. The triangulation in (a) is a Delaunay triangulation.
∆a
α1a
α 2a
∆b
α 2b
α1b
Fig. 1.2. A neutral case for the MaxMin angle criterion. Only ∆a satisfy the MinMax criterion. The triangulation ∆b is optimal with respect to the MaxMin angle
criterion.
pi
Fig. 1.3. The Voronoi region of a point pi in the plane.
Fig. 1.4. The Voronoi diagram of a set of points in the plane.
Fig. 1.5. The straight line dual of the Voronoi diagram which yields a Delaunay
triangulation.
p4
(a)
p4
(b)
p3
p1
p3
p1
p2
p2
Fig. 1.6. Almost cocircular points p1 , p2 , p3 and p4 left, and cocircular points
right. In the cocircular case there are two possible solutions when constructing the
Delaunay triangulation.
Fig. 1.7. A Voronoi diagram and its straight-line dual, the Delaunay triangulation,
with some of the circumcircles.
p2
p1
V ( p1 )
V ( p2 )
v
V ( p3 )
p4
C (t1, 2 , 3 )
p3
Fig. 1.8. The circimcircle C(t1,2,3 ) of a triangle in a Delaunay triangulation and
the Voronoi regions of p1 , p2 and p3 . A point p4 inside C(t1,2,3 ) is not in agreement
with the definition of a Voronoi diagram.
(a)
b p
p1
p4
(b)
p4
b+p
b’+ c’
p3
p’+q’
c
p1
q
c’ p
b’ 3
q’
p’
c+q
p2
p2
Fig. 1.9. Illustration for the proof of Lemma ??.
α
α
β
γ
2α
Fig. 1.10. Inscribed angles α on the same arc are equal, and γ < α < β.
(a)
(b)
p4
V ( p4 )
ev ,∞
v
p1
v
V ( p2 )
p2
C (t1, 2 , 4 )
p3
Fig. 1.11. Illustration for the proof of Lemma ??.
V ( p3 )
p3
Fig. 1.12. Example showing that choosing the diagonal with the minimum length
violates the circle criterion.
p4
v3 β
v4
p3
p1
v2 α v1
p2
Fig. 1.13. Illustration for circumcircle test based on interior angles.
(a)
q
(b)
a
a
C
C
δ
p
p
b
b
c
c
Fig. 1.14. Illustration for the proof of Theorem ??.
Fig. 1.15. Voronoi diagram of a point set P on the left, and Voronoi diagram of a
subset Pe ⊂ P on the right.
r
p
q
s
Fig. 1.16. Illustration for the proof of Theorem ??.
2
Algorithms for Delaunay Triangulation
Algorithm 2.1 Simple Delaunay triangulation
1. Compute conv(P ).
2. Apply Algorithm ?? to the vertices of conv(P ) to find an initial triangulation ∆0 .
3. Apply Algorithm ?? to insert points of P , that are interior to conv(P ), into ∆0 .
This gives a new triangulation ∆00 after all points have been inserted.
4. Apply the LOP repeatedly on the edges of ∆00 until no edge-swap occurs, and
thus obtain a triangulation ∆∗ which has all of its edges locally optimal.
Algorithm 2.2 Radial Sweep
1. Choose a point p near the centroid of P and connect p by radiating edges to all
other points of P , Figure 2.1(a).
2. Sort and order the points {P \p} by orientation and distance from p and connect
the ordered sequence by edges as in Figure 2.1(b). The result from this step is
a triangulation with a star-shaped domain as seen from p. Triangles may be
degenerate since points may have identical orientation relative to p.
3. Form a triangle for each triple of points (pi−1 , pi , pi+1 ) on the boundary of the
triangulation. If the edge between pi−1 and pi+1 is outside the existing boundary,
include the triangle in the triangulation and update the boundary. Repeat this
step until no more triangles can be added. The resulting triangulation has a
convex boundary and all points are included in the triangulation, Figure 2.1(c).
4. Apply the LOP repeatedly to the edges until no edge-swap occurs, to obtain a
Delaunay triangulation, Figure 2.1(d).
10
2 Algorithms for Delaunay Triangulation
Algorithm 2.3 recSwapDelaunay(Edge ei )
1.
2.
3.
4.
5.
if (circumcircleTest(ei ) == OK)
// Algorithm 1.1 in Section ??
return
swapEdge(ei )
// the swapped edge e0i is incident with p
recSwapDelaunay(ei,1 )
// call this procedure recursively
recSwapDelaunay(ei,2 )
// call this procedure recursively
P00 = P
.
&
P01
P11
.
&
. &
P23
∆20
|
{z
∆10
|
P32
. &
. &
P43
P33
∆3
∆3
| 2 {z 3}
∆30
∆3
| {z 1}
&
P22
. &
P13
P03
.
P12
P02
P53
P63
∆34
∆3
| {z 5}
∆2
|2
∆21
}
{z
∆00 = ∆(P )
P73
∆36
∆3
| {z }7
{z
∆11
}
∆23
}
(a)
(b)
p
(c)
(d)
Fig. 2.1. The Radial Sweep algorithm.
b
α
p
tb,a,p
c
ta,b,c
eb
β
β<α
C(ta,b,c)
a
Fig. 2.2. Circle growing from the base line eb to find a point p to form a new
triangle with eb .
(a)
(b)
p
(c)
(d)
p
Fig. 2.3. Influence polygons Qp in (a) and (c) when p is inserted interior and exterior
to an existing triangulation. Delaunay triangulations after p has been inserted are
shown in (b) and (d).
(a)
(b)
p
p
(c)
(d)
p
p
(e)
p
Fig. 2.4. Swapping procedure when inserting a point p into a Delaunay triangulation. From (b) to the final triangulation in (e), each picture shows the triangulation
after one new edge has been swapped.
(a)
(b)
e1,1
e1,3
p
e1'
p
e1
e1,2
e3
e3
e1,4
e2
e2
Fig. 2.5. Starting the recursive swapping procedure.
c
ei,1
x
b
ei,3
p
ei'
ei,2
C'
ei,4
C
a
Fig. 2.6. Illustration for Lemma ??.
(a)
(b)
ti
C´
C
C
C´
ei'
p
ei
p
ti
Fig. 2.7. (a): The initial edges are Delaunay. (b): Edges that are swapped to p are
Delaunay.
O( N 2 )
25
20
15
10
O ( N log N )
O (N )
5
0
1
2
3
4
5
-5
Fig. 2.8. The curves y = x, y = x log x and y = x2 from bottom to top for
illustrating the difference between run-time order of O(N ), O(N log N ) and O(N 2 ).
1
(a)
(b)
(c)
2
3
4
5
6
7
8
10 9
Fig. 2.9. Illustration of a worst case example for incremental Delaunay triangulation
algoritms.
eu
(a)
(b)
p
pR
pL
eb
Fig. 2.10. Merging two Delaunay triangulations in the divide-and-conquer algorithm.
3
Data Dependent Triangulations
Algorithm 3.1 LOP for data dependent triangulations
1. Make an arbitrary legal triangulation ∆ of a point set P .
2. if ∆ is locally optimal, that is, if (??) holds for all interior edges in ∆,
stop.
3. Let ei be an interior edge of ∆ which is not locally optimal.
4. Swap ei to e0i , transforming ∆ to ∆0 .
5. Let ∆ := ∆0 .
6. goto 2.
0.2
0.1
0
0.6
y
0.8
0.2
00
0.2
0.4
x
Fig. 3.1. Test function F1 (x, y) = (tanh (9y − 9x) + 1) /9.
1
Algorithm 3.2 Simulated annealing
1. do k = 1, . . . , ntemps
2.
tk = r k t0 , 0 < r < 1, e.g., r = 0.95
3.
do l = 1, . . . , nlimit
4.
while the number of “good swaps” ≤ glimit
5.
let ∆ be the current triangulation; choose a random edge ei in ∆
6.
if ei is swappable
7.
let ∆0 be the result of swapping ei and let d = Cp (∆0 ) − Cp (∆)
be the corresponding change of the global cost function (??).
8.
if d < 0, i.e., if the global cost decreases
9.
swap ei (“good swap”)
10.
else
11.
choose a random number θ, 0 ≤ θ ≤ 1
12.
if θ ≤ e−d/tk
13.
swap ei (“bad swap”)
14.
endif
15.
endif
(a)
(b)
Fig. 3.2. Delaunay triangulation of grid data and level curves.
Fig. 3.3. Triangulation optimized with the LOP algorithm using ABN criterion and
l1 norm.
ei1
ei2
tk
ei4
ei
tl
ei3
Fig. 3.4. Edges that must be checked when considering swapping the edge ei .
n(1)
n(2)
θ
p1 = ( x1 , y1 , z1 )
Q1(x,y)
t2
t1
Q2(x,y)
p2 = ( x2 , y2 , z2 )
ei
( x2 , y2 )
n = (nx , n y )
( x1 , y1 )
Fig. 3.5. Geometric embedding information used when considering edge-swap of
an edge ei in a convex quadrilateral defined by two triangles t1 and t2 . Q1 (x, y)
and Q2 (x, y) are the equations of the planes defined by t1 and t2 . The dashed lines
display the projection of the quadrilateral in the (x, y) -plane. n = (nx , ny ) is a unit
vector orthogonal to the projection of ei in the (x, y)-plane.
Q1(x,y) ei Q2(x,y)
L1
L2
y
x
v(1)
γ
v(2)
Qh
Fig. 3.6. The SCO data dependent swapping criterion.
(b)
(a)
e1
e1
e2
e2'
(c)
e2'
e1'
Fig. 3.7. A “bad swap” of e2 followed by a swap of e1 which reduces the clobal
cost.
1
0.8
0.6
0.4
0.2
0
200
400
k
600
800
1000
Fig. 3.8. Probability of making bad swaps in Step 12 of Algorithm 3.2.
(a)
(b)
Fig. 3.9. Triangulation optimized with the simulated annealing algorithm using
ABN criterion and l1 norm.
Fig. 3.10. 1108 points measured from an interior detail of a car.
Fig. 3.11. Delaunay triangulation of the points in Figure 3.10, and level curves.
Fig. 3.12. Data dependent triangulation from LOP algorithm, SCO criterion and
l1 norm.
Fig. 3.13. Data dependent triangulation from the simulated annealing algorithm,
SCO criterion and l1 norm.
4
Constrained Delaunay Triangulation
Algorithm 4.1 Eliminate um ,with αm < π, from Qec ,L
1. while (r ≥ 1)
2.
Let (um , ws ) be a diagonal in a convex quadrilateral (um , ws−1 , ws , ws+1 ).
3.
Swap (um , ws ) to (ws−1 , ws+1 )
4.
r ←r−1
Algorithm 4.2 Include ec as an edge in a triangulation
1. while (n >= 1)
2.
Find a point um , 1 ≤ m ≤ n where αm < π
3.
Apply Algorithm 4.1 to um
4.
n←n−1
5.
Qec ,L ← (pa , u1 , . . . , um−1 , um+1 , . . . , un , pb )
Algorithm 4.3 recSwapDelaunayConstr(Edge ei )
1.
2.
3.
4.
5.
6.
7.
if (ei ∈ Ec )
return
if (circumcircleTest(ei ) == true)
// Algorithm 1.1 in Section ??
return
swapEdge(ei )
// the swapped edge e0i is incident with p
recSwapDelaunay(ei,1 )
// call this procedure recursively
recSwapDelaunay(ei,2 )
// call this procedure recursively
(a)
(b)
(c)
(d)
Fig. 4.1. (a): A planar straight-line graph G(P, Ec ). (b): Conventional Delaunay triangulation of the point set P . (c): Constrained Delaunay triangulation of G(P, Ec ).
(d): Illustration of the modified circle criterion for constrained Delaunay triangulation.
(a)
p2
(b)
e
θ2
e'
θ1
e'
p1
p3
θ2
p4
Fig. 4.2. The triangulation in (a) with e as an edge is a conventional Delaunay
triangulation. The triangulation in (b) is a constrained Delaunay triangulation due
to the constrained edge e0 .
(a)
ec
pa
pb
Q e ,L
c
(b)
ec
pa
pb
Q e ,R
c
Fig. 4.3. (a) The influence region of a constrained edge ec that is inserted into an
existing triangulation. (b) the influence polygons Qec ,L and Qec ,R of ec .
p'
p
eb
t
Y
Fig. 4.4. The growing circle reaches a point p0 first, but p0 is separated from eb by
a constrained edge and cannot form a triangle with eb .
Q e ,L
c
(a)
ec
Q e ,R
c
(b)
(c)
(d)
Fig. 4.5. Retriangulation of the influence region of a constrained edge ec . (a) to
(c) show how new triangles are constructed when retriangulating the left influence
polygon Qec ,L . The growing circles (dotted) are shown when they have reached a
point where a new triangle can be formed with the base line. In (d) the constrained
Delaunay triangulation of the whole influence region is shown.
(a)
u1
u5
α4
α2
α3
u3
α6
α5
α1
pa
u6
Q ec , L
u2 u4
ec
pb
Q ec , R
u5
u1 u3
(b)
pa
u4
α3
α1
α2
u2
α5
α4
ec
pb
(c)
pa
u1
α1
ec
pb
Fig. 4.6. Illustration for edge insertion and swapping. (b) shows the situation when
the point u1 has been isolated from the influence polygon Qec ,L , and (c) shows the
situation when the last edge is swapped and takes on the role as the constrained
edge ec .
um
αm
w0 = um−1
wr +1 = um +1
ec
w1
w2
...
wr
Fig. 4.7. Illustration for Lemma ??.
(a)
(b)
p
ec
ec
Fig. 4.8. (a): The influence polygon Qp of a point p in a CDT ∆(P, ec ) is shown
with bold edges. (b): The updated CDT ∆(P ∪ p, ec ).
5
Delaunay Refinement Mesh Generation
Algorithm 5.1 Delaunay refinement
1. Make the initial CDT of the PSLG.
Remove triangles outside the triangulation domain.
2. while skinny triangles remain
// (controls termination)
3.
while any segment s is encroached upon
4.
SplitSegment(s)
5.
Let t be a skinny triangle and v the circumcenter of t.
6.
if v encroaches upon any segments s1 , s2 , . . . , sk
// “look-ahead”
7.
for i = 1, . . . , k
8.
SplitSegment(si )
9.
goto 3
10.
else
11.
KillTriangle(t)
12.
goto 5
36
5 Delaunay Refinement Mesh Generation
Case 1. (KillTriangle) v is inserted at the circumcenter of a skinny triangle t.
The parent node p is chosen to be one of the two endpoints of the shortest
edge of t. (Figure 5.9).
Case 2. (SplitSegment) v is a node inserted at the midpoint of a segment s
that is encroached upon by a node p.
Thus p lies inside the diametral circle of s. If more than one node encroaches
upon s, assume without loss of generality that p is the closest node to v
that encroaches upon s. The shortest edge connected to v, which defines the
insertion radius rv , has p as the other endpoint unless p is not yet inserted and
thus rejected. This follows from the Delaunay property. Four possible roles of
p must be considered under SplitSegment.
Case 2a. p is an input node, or p is a node inserted in a segment not
incident to s. (Figure 5.10(a))
Case 2b. p is at the circumcenter of a skinny triangle and thus rejected since it encroaches upon s. (Figure 5.10(b), and Step 6–8 of Algorithm 5.1.)
Case 2c. p is a node on a segment s0 incident to s that makes an angle
45◦ ≤ α < 90◦ with s. (Figure 5.10(c))
Case 2d. As Case 2c with α ≤ 45◦ . (Figure 5.10(d))
5 Delaunay Refinement Mesh Generation
37
A sample input
planar straight line
graph (PSLG).
Constrained
Delaunay
triangulation of the
PSLG. Encroached
segments are bold.
One
encroached
segment has been
bisected.
A
second
encroached segment
has been bisected.
A third encroached
subsegment
has
been bisected.
The
last
encroached subsegment has been
bisected and a
skinny triangle is
found.
The skinny triangle’s cirumcenter is
inserted. Find another skinny triangle.
This cirumcenter
encroaches
upon
a segment, and is
therefore rejected.
Although the vertex was rejected,
the segment it encroached upon is
still marked for bisection.
The
encroached
segment is split,
and the skinny
triangle that led
to its bisection is
eliminated.
A
circumcenter
is
successfully
inserted, creating
another
skinny
triangle.
The triangle’s circumcenter is rejected since it encroaches upon a
segment.
The
encroached
segment will be
bisected.
The skinny triangle
was not eliminated.
Try to insert its circumcenter again.
This time, its circumcenter is inserted successfully.
Only one skinny
triangle is left.
The final mesh
with no interior
angle smaller than
1
arcsin 2B
≈ 20.7◦ .
Fig. 5.1. The Delaunay refinement algorithm step-by-step with upper bound B =
√
2 on the circumradius-to-shortest-edge ratio. Illustration and most figure texts
from Shewchuk [1].
10
9
8
αmin
αmin
r
7
6
5
r/l
4
3
2
1
0
l
5
10
15
20
25
30
αmin
35
40
45
50
55
60
Fig. 5.2. Relationship between circumradius-to-shortest-edge ratio r/l and the minimum angle αmin of a triangle: r/l = 1/(2 sin αmin ).
(b)
(a)
v
t
t
(d)
(c)
v
t
v
Fig. 5.3. (a): A skinny triangle t in a Delaunay triangulation. (b): t’s circumcircle.
(c): The Voronoi diagram and the circumcenter of t positioned at a Voronoi point.
(d): Updated Delaunay triangulation after insertion of a node at t’s circumcenter.
Fig. 5.4. Spatial graded mesh uppermost, and a uniform mesh below. Illustration
from Shewchuk [1].
(a)
(b)
(c)
Fig. 5.5. Recursive bisection of a segment that is encroached upon. (a): Two nodes
encroach upon the segment initially. (b): After splitting the segment at its midpoint,
it is still encroached upon by a node. (c): After the second bisection there is no
encroachment.
p
s2'
'
1
s
×
α
s1
×
q
s2
Fig. 5.6. Recursive bisection of incident segments that never terminates when α ≤
45◦ .
C (t )
t
C (s' )
p
v
s'
s
Fig. 5.7. Illustration for Lemma ??.
Fig. 5.8. Illustration of local feature size lf s() at some points relative to a planar
straight line graph. An arbitrary point in the plane marked with × has local feature
size equal to the radius of the circle drawn with center at ×.
rv
v
t
l
p
Fig. 5.9. Case 1 where v is inserted at the center of a skinny triangle t. The parent
node p is chosen as one of the endpoints of the shortest edge of t.
(a)
(b)
Input PSLG
t
p
p
rv
l ≥ rg
g
rp
v
rv
v
s
s
(c)
(d)
s’
s’
p
p
l
a α
rv
l
β
a
v
rv
β
α
v
s
s
(e)
l ≥ rg
t
g
p
rp
rv
v
s
Fig. 5.10. Different roles of a parent node p which encroaches upon a segment s.
(a): p is on the input PSLG.
(b): p is at the circumcenter of a skinny triangle (and rejected).
(c) and (d): p is on a segment s0 incident with s with α ≥ 45◦ and α < 45◦
respectively. The filled bullet • at p indicates the position of p which defines the
lower bounds on the insertion radius rv in each case of Lemma ??.
(e): illustrates the same case as (b), but with p in a position which defines the lower
bound on rv .
Fig. 5.11. Corner-lopping when angles of the input PSLG are less than 60◦ . Illustration from Shewchuk [2].
6
Least Squares Approximation of Scattered
Data
S10 (∆) = f ∈ C 0 (Ω) : f |ti ∈ Π1 , i = 1, . . . , |T | ,
(6.1)
(N1 (x, y), N2 (x, y), . . . , Nn (x, y)) ,
Ni (vj ) = δij ,
j = 1, . . . , n,
(6.2)
N i ( x, y )
Ωi
vi
Fig. 6.1. A basis function Ni (x, y) for the function space S10 (∆) and its (compact)
support Ωi .
f (x, y) =
n
X
ci Ni (x, y),
i=1
∇g =
∂g ∂g
,
∂x ∂y
(6.3)
.
∂g
∂g
n = − ,− ,1 .
∂x ∂y
(6.4)
48
6 Least Squares Approximation of Scattered Data
b
n'
g
c
v1
v2
a
Fig. 6.2. Triangle patch and normal vector.
n0 = v1 × v2 = (−ηa ca − ηb cb − ηc cc , −µa ca − µb cb − µc cc , 2A)
ηa = (yb − yc ) ,
ηb = (yc − ya ) ,
µa = (xc − xb ) ,
µb = (xa − xc ) ,
A=
ηc = (ya − yb ) ,
µc = (xb − xa ) ,
1
((xb − xa ) (yc − ya ) − (yb − ya ) (xc − xa )) .
2
∇g = (ηa ca + ηb cb + ηc cc , µa ca + µb cb + µc cc )/2A.
1
∇g =
2A
n
X
i=1
ηi ci ,
n
X
i=1
(6.5)
µi ci
!
.
(6.6)
(6.7)
(6.8)
6.1 Approximation over Triangulations of Subsets of Data
49
6.1 Approximation over Triangulations of Subsets of
Data
Fig. 6.3. Triangulation generated from a subset of a given data set.
n
V = {vk = (xk , yk )}k=1 .
f (xk , yk ) ≈ zk ,
I(c) =
m
X
(6.9)
k = 1, . . . , m.
2
(f (xk , yk ) − zk ) .
(6.10)
2

n
X

cj Nj (xk , yk ) − zk  = kBc − zk22 .
(6.11)
k=1
I(c) =
m
X
k=1

j=1

· · · Nn (x1 , y1 )
· · · Nn (x2 , y2 ) 

,
..
..

.
.
· · · Nn (xm , ym )
1/2
||u||2 = u21 + · · · + u2m
.
N1 (x1 , y1 ) N2 (x1 , y1 )
 N1 (x2 , y2 ) N2 (x2 , y2 )

B=
..
..

.
.
N1 (xm , ym ) N2 (xm , ym )
(6.12)
50
6 Least Squares Approximation of Scattered Data
∂I
=2
∂ci
n X
m
X
m
X
k=1


n
X
j=1

cj Nj (xk , yk ) − zk  Ni (xk , yk ) = 0,
Ni (xk , yk )Nj (xk , yk )cj =
j=1 k=1
m
X
Ni (xk , yk )zk ,
i = 1, . . . , n
i = 1, . . . , n.
k=1
BT B
ij
BT B c = BT z,
=
m
X
(6.13)
Ni (xk , yk )Nj (xk , yk )
k=1
m
X
BT z i =
Ni (xk , yk )zk .
k=1
Fig. 6.4. Least squares approximation to 4500 scattered data points sampled from
Franke’s test function. The triangulation has approximately 500 nodes. Triangles
are Gouraud-shaded.
f (x, y) =
3 (9x+1)2 9y+1
3 − (9x−2)2 +(9y−2)2
4
+ e− 49 − 10 +
e
4
4
2
2
1
1 − (9x−7)2 +(9y−3)2
4
− e−(9x−4) −(9y−7) .
e
2
5
(6.14)
6.2 Existence and Uniqueness
51
6.2 Existence and Uniqueness

1
0
..
.
0
1
..
.
···
···
..
.
0
0
..
.













B1
0
0
·
·
·
1

.
=
B=

N
(x
y
)
N
(x
y
)
·
·
·
N
(x
y
)
B2
2 n+1, n+1
n n+1, n+1 
 1 n+1, n+1
 N1 (xn+2, yn+2 ) N2 (xn+2, yn+2 ) · · · Nn (xn+2, yn+2 ) 




..
..
..
..


.
.
.
.
N1 (xm, ym )
N2 (xm, ym ) · · · Nn (xm, ym )
(6.15)
52
6 Least Squares Approximation of Scattered Data
6.3 Sparsity and Symmetry
BT B
ij
=
m
X
Ni (xk , yk )Nj (xk , yk ),
(6.16)
k=1
vj
vi
Ωi
Ωi I Ω j
Ωj
Fig. 6.5. A possible non-zero off-diagonal element in the system matrix (B T B)ij
corresponds to an edge between the vertices vi and vj in the triangulation. It is
non-zero if one or more data points fall strictly inside Ωi ∩ Ωj .
Fig. 6.6. Sparsity pattern of a 500 × 500 system matrix B T B for the least squares
problem.
6.4 Penalized Least Squares
53
6.4 Penalized Least Squares
Fig. 6.7. Least squares approximation to 4500 scattered data points sampled from
Franke’s test function. Random noise was added to the z-values of the data points
when generating the surface on the right.
J (c) = cT Ec,
I(c) =
m
X
2
(f (xk , yk ) − zk ) + λJ (c) =
k=1
m
X
(6.17)
(f (xk , yk ) − zk )2 + λcT Ec
k=1
2
= kBc − zk2 + λcT Ec
BT B + λE c = BT z,
λd = BT BF / kEkF .
(6.18)
(6.19)
54
6 Least Squares Approximation of Scattered Data
6.5 Smoothing Terms for Penalized Least Squares
Z
2
|∇g| =
Z "
∂g
∂x
2
+
∂g
∂y
2 #
(6.20)
and the thin-plate energy
2 2 2 2 #
Z " 2 2
∂ g
∂ g
∂ g
+2
+
2
∂x
∂x∂y
∂y 2
(6.21)
Membrane energy functional.
∇gk =
J1 (c) =
|T |
X
2
Ak |∇gk | =
1
=
2Ak
|T |
X
Ak
"
k=1
k=1
∂gk
∂x
n
X
ηik ci ,
µki ci
i=1
i=1
2
n
X
∂gk
+
∂y
!2 
!
.
2 #

!2
|T |
n
n
X
X
1  X k
ηi ci
=
+
µki ci 
4Ak
i=1
i=1
k=1



! n
! n
|T |
n
n
X
X
X
X 1
X

µkj cj 
µki ci 
ηjk cj  +
=
ηik ci 
4Ak
j=1
i=1
j=1
i=1
k=1


|T |
n X
n
X
X
k
k
k
k

ηi ηj + µi µj /4Ak  ci cj = cT Ec,
=
i=1 i=j
where
∂gk ∂gk
,
∂x ∂y
k=1
Eij =
|T |
X
(ηik ηjk + µki µkj )/4Ak .
k=1
The Umbrella-operator.
Mk f =
1 X
cl − ck .
nk
l∈∂Ωk
Mk f =
n
X
l=1
ρkl cl ,

 −1, l = k
ρkl = n1k , if (vk , vl ) is an edge in ∆

0 otherwise.
(6.22)
6.5 Smoothing Terms for Penalized Least Squares
55
L
L
L
ck
L
L
cl
Fig. 6.8. The umbrella-operator.
3
3
2
1
1
2
2
vi
3
1
3
3
1
2
3
Fig. 6.9. Illustration of which triangle vertices that generate non-zero off-diagonal
elements in the system matrix together with the vertex vi . The ’1’-vertices generate
non-zeros with vi by the membrane energy and in the basic least squares problem
(matrix BT B); the ’1’ and ’2’-vertices generate non-zeros by the thin-plate energy
term; and ’1’, ’2’ and ’3’-vertices generate non-zeros by the umbrella-operator.
J2 (c) =
n
X
k=1
=
n
X
k=1
=
2
(Mk f ) =
"
" n
n
X
X
k=1
n
X
i=1
"
#
ρki ci 
n
n X
n
X
X
i=1 j=1
k=1
n
X
j=1
#
i=1
ρki ci

#2
ρkj cj 
ρki ρkj ci cj =
where
Eij =
n X
n
X
i=1 j=1
n
X
k=1
ρki ρkj .
Eij ci cj = cT Ec,
(6.23)
56
6 Least Squares Approximation of Scattered Data
X
fk = 1
ωkl cl − ck ,
M
Wk
l∈∂Ωk

 −1, l = k
ωkl
, if (vk , vl ) is an edge in ∆
ρekl = W
 k
0 otherwise.
r
t
t2
ne
k
g2
t1
l
g1
ek
s
Fig. 6.10. Stencil for the second order divided difference Dk2 f used to make the
discrete thin-plate energy measure.
Discrete thin-plate energy functional.
∂gi
∂gi ∂gi
=(
,
) · nek = ∇gi · nek ,
∂nek
∂x ∂y
i = 1, 2.
∂g1
∂g2
−
∂nek
∂nek
∂g2
∂g1 ∂g2
∂g1
=
· nek
−
,
−
∂x
∂x ∂y
∂y
= (∇g2 − ∇g1 ) · nek
Tk f =
∇g1 = ηl cl + ηs1 cs + ηt1 ct , µl cl + µ1s cs + µ1t ct /2Alst ,
∇g2 = ηr cr + ηt2 ct + ηs2 cs , µr cr + µ2t ct + µ2s cs /2Arts .
nek = (yt − ys , xs − xt )/Lek ,
(6.24)
(6.25)
(6.26)
6.5 Smoothing Terms for Penalized Least Squares
X
Tk f =
βik ci ,
57
(6.27)
i∈ω(ek )
where
βlk = −
βsk =
Lek
2Alst
Lek Atlr
2Alst Arts
|EI |
J3 (c) =
X
Lek (Tk f ) =
X
Lek
2
k=1
|EI |
=
k=1
i=1
|EI |
X
Lek
k=1
Lek
2Arts
βtk =
Lek Asrl
.
2Alst Arts
"
βik ci
n
X
i=1

# n
X
βjk cj 
βik ci 
#2
j=1

|EI |
n X
n
n X
n
X
X
X

Eij ci cj = cT Ec,
Lek βik βjk  ci cj =
=
i=1 j=1
where
" n
X

βrk = −
i=1 j=1
k=1
|EI |
Eij =
X
Lek βik βjk .
k=1
Tz (λ) =
1
m
m
X
k=1
2
(fλ (xk , yk ) − zk )
(6.28)
58
6 Least Squares Approximation of Scattered Data
Fig. 6.11. Penalized least squares aproximation of a noisy point set.
6.6 Approximation over General Triangulations
Ωl
Fig. 6.12. Point set for penalized least squares. The shaded region is a domain of
a basis function Ωj that do not cover any data points.
T
2
xT BT B x = (Bx) (Bx) = kBxk2 ≥ 0.
6.6 Approximation over General Triangulations
cT BT B + λE c = cT BT B c + λcT Ec = 0,
59
(6.29)
Uniqueness with the membrane energy functional.
J1 (c) =
|T |
X
Ak
k=1
"
∂gk
∂x
2
+
∂gk
∂y
2 #
= cT Ec.
2
cT (BT B)c = (Bc)T (Bc) = kBck2 = 0,
(6.30)
Uniqueness with the umbrella-operator.
J2 (c) =
n
X
2
(Mk f ) =
k=1
n
X
k=1
ck =
1 X
cl ,
nk
"
1 X
cl − ck
nk
l∈∂Ωk
#2
.
k = 1, . . . n.
(6.31)
l∈∂Ωk
ck =
1 X
ωkl cl ,
Wk
k = 1, . . . n
l∈∂Ωk
Uniqueness with the thin-plate energy functional.
|EI |
J3 (c) =
X
k=1
|EI |
2
(Tk f ) =
X
k=1
2
[(∇g2 − ∇g1 ) · nek ] = cT Ec.
60
6 Least Squares Approximation of Scattered Data
6.7 Weighted Least Squares
I(c) =
m
X
2
wk [f (xk , yk ) − zk ] =
k=1
m
X
k=1
2

n
X
cj Nj (xk , yk ) − zk  .
wk 
j=1


n
m
X
X
∂I
cj Nj (xk , yk ) − zk  Ni (xk , yk ) = 0,
=2
wk 
∂ci
j=1
i = 1, . . . , n,
k=1
n X
m
X
wk Ni (xk , yk )Nj (xk , yk )cj =
j=1 k=1
m
X
wk Ni (xk , yk )zk ,
i = 1, . . . , n.
k=1
BT B c = BT z,
BT B
ij
=
BT z i =
m
X
k=1
m
X
k=1
wk Ni (xk , yk )Nj (xk , yk ),
wk Ni (xk , yk )zk ,
i, j = 1, . . . , n,
i = 1, . . . , n.
(6.32a)
(6.32b)
6.8 Constrained Least Squares
61
6.8 Constrained Least Squares
Γ = {(xr , yr , zr )}n+γ
r=n+1 .
f (x, y) =
n+γ
X
cj Nj (x, y).
j=1
f (x, y) =
n
X
cj Nj (x, y) +
n+γ
X
zr Nr (x, y).
r=n+1
j=1
2

n+γ
m
n
X
X
X

I(c) =
cj Nj (xk , yk ) +
zr Nr (xk , yk ) − zk  .
k=1
r=n+1
j=1


n+γ
m
n
X
X
X
∂I

cj Nj (xk , yk ) +
zr Nr (xk , yk ) − zk  Ni (xk , yk ) = 0,
=2
∂ci
r=n+1
j=1
k=1
n X
m
X
Ni (xk , yk )Nj (xk , yk )cj =
j=1 k=1
m
X
k=1

Ni (xk , yk ) zk −
n+γ
X
r=n+1
BT B c = BT z,
where
BT B
ij
=
m
X
Ni (xk , yk )Nj (xk , yk ),
i, j = 1, . . . , n,

zr Nr (xk , yk ) ,
and
k=1


n+γ
m
X
X
BT z i =
Ni (xk , yk ) zk −
zr Nr (xk , yk ) ,
k=1
r=n+1
i = 1, . . . , n.
62
6 Least Squares Approximation of Scattered Data
6.9 Approximation over Binary Triangulations
The general multilevel scheme.
Algorithm 6.1 General multilevel scheme
1. for k = 1, 2, 3, . . .
2.
Find a surface approximation f∆k .
3.
if |f∆k (xi , yi ) − zi | < , i = 1, . . . , m,
stop.
4.
else
5.
Refine ∆k locally where is exceeded to produce ∆k+1 ,
and use f∆k to make an initial guess for f∆k+1 .
Approximation Scheme for Binary Triangulations.
v21,1
v32,1
v53,3
v11, 0
Fig. 6.13. Starting with the triangulation ∆1 and the regular grid Ψ1 on the left,
2
1
1
vertex v3,1
in Ψ2 is first activated together with its two parents v1,0
and v2,1
in Ψ1 .
3
The resulting triangulation is ∆2 in the middle. Next, v5,3 in Ψ3 is activated together
with ancestors belonging to both Ψ1 and Ψ2 to obtain ∆3 on the right.
k 2k ,2k
.
Ψk = vi,j
i,j=0,0
ck+1
= fk (xi , yj ).
ij
S10 (∆1 ) ⊂ S10 (∆2 ) ⊂ · · · ⊂ S10 (∆h ),
6.10 Numerical Examples for Binary Triangulations
6.10 Numerical Examples for Binary Triangulations
Approximation of data sampled from Franke’s function
Approximation of noisy data from Franke’s function
Approximation of parametrized 3D scattered data.
Terrain modeling of mountain area.
63
Fig. 6.14. Approximation to Franke’s test function; the resulting binary triangulation imposed on the surface.
Fig. 6.15. The same binary triangulation as in Figure 6.14, and input data for
numerical examples. The lower left corner corresponds to the nearest corner in Figure 6.14.
Fig. 6.16. Approximation with huge smoothing parameter.
Fig. 6.17. Approximation to Franke’s function from a data set with noise.
Fig. 6.18. Approximation of terrain data and the given hypsographic data.
Fig. 6.19. Approximation of terrain data, and triangulation imposed on the surface.
Fig. 6.20. Terrain modeling of an area in Jotunheimen, Norway.
Fig. 6.21. Approximation of parametrized 3D scattered data.
References
1. J. R. Shewchuk. Delaunay Refinement Mesh Generation. PhD thesis, School of
Computer Science, Carnegie Mellon University, Pittsburgh, Pennsylvania, 1997.
Available as Technical Report CMU-CS-97-137.
2. J. R. Shewchuk. Delaunay refinement algorithms for triangular mesh generation.
Computational Geometry, 22:21–74, 2002.
Download