slides

Transcription

slides
Constructing V-diagrams
CS 101
Many algorithms
Meshing
„
Introduction to
Delaunay Triangulations
and Voronoi Diagrams
Part II
„
old ones (hard to implement, slow)
„
simple ones
„
„
divide&conquer, inters. of halfplanes
incremental, n2, but can be made fast
fast ones
„
„
plane sweep by Fortune (’85) nlogn
randomized CH
CS101 - Meshing
2
Fortune’s Algo I
Fortune’s Algo II
Sweep-line algorithm
„
Circle Events
edge events
„
„
planned by 3 consecutive arcs
„
trig. when sweepline reaches bottom
„
each time when line encounters a point
start a parabola (line = directrix)
„
„
„
locus of points equidistant from site and line
if corresp. sites have circle intersect. line
happens at Voronoi vertex – kill arc
“Beachline”
„ breaks in beachline?
„
„
on Voronoi edge!
CS101 - Meshing
CS101 - Meshing
3
Fortune’s Algo III
4
Fortune In Action
Maintaining the beach line
tree updated as events occur
„ events stored in a priority queue
„ circle events not known apriori…
„
„
„
they must be added/discarded as
the sweep moves downward.
requires data structures in sync
„
bookkeeping
CS101 - Meshing
CS101 - Meshing
5
6
Fortune’s Algo IV
Other Approaches
Also a sweep-plane in higher dim!
Definition:
Edge (pipj) locally Delaunay iff
circumcircle of (pipjpk) does not
contain vertex pl
at 45°, intersecting cones (sites)
„
DT: all edges local Del.
CS101 - Meshing
CS101 - Meshing
7
Idea: Edge Flipping
Maximum Minimum Angle
Check all edges, and fix them!
„
„
„
if ok, validate
if not
„
„
„
Remember DT property!
check an edge
„
8
Once can check
„
edge flip
invalidate adjacent edges
„
does the algorithm terminate?
finite number of triangulations
„
CS101 - Meshing
flip needed iff:
so it WILL terminate
CS101 - Meshing
9
Vertex Insertion I
Vertex Insertion II
Edge flipping can be quite slow
„
„
Add p in (abc):
n2 worst case
But can derive an incremental algo
„
„
„
Add points one at a time
„
10
„
typical process
easy to implement
still the fastest around
numerical robustness?
„
and fix bad edges on the fly
„
an issue
but very well studied
Pre-order vertices along one direction
„
helps coherency, fast “search”
Or use randomization…
CS101 - Meshing
CS101 - Meshing
11
12
The Shortest Code?
Exotic Delaunay
/* Input points and compute z = x^2 + y^2. */
scanf("%d", &n);
for ( i = 0; i < n; i++ ) { scanf("%d %d", &x[i], &y[i]); z[i] = x[i] * x[i] + y[i] * y[i];}
/* For each triple (i,j,k) */
for ( i = 0; i < n - 2; i++ )
for ( j = i + 1; j < n; j++ )
for ( k = i + 1; k < n; k++ )
if ( j != k ) {
/* Compute normal to triangle (i,j,k). */
xn = (y[j]-y[i])*(z[k]-z[i]) - (y[k]-y[i])*(z[j]-z[i]);
yn = (x[k]-x[i])*(z[j]-z[i]) - (x[j]-x[i])*(z[k]-z[i]);
zn = (x[j]-x[i])*(y[k]-y[i]) - (x[k]-x[i])*(y[j]-y[i]);
Variations of standard VD/DT
„ Non-Euclidean distance metrics
„ Power diagrams
Uses Lifting Map!
„
„
/* Only examine faces on bottom of paraboloid: zn < 0. */
if ( flag = (zn < 0) )
/* For each other point m */
for (m = 0; m < n; m++)
/* Check if m above (i,j,k). */
flag = flag && ((x[m]-x[i])*xn + (y[m]-y[i])*yn + (z[m]-z[i])*zn <= 0);
if (flag) printf("z=%10d; lower face indices: %d, %d, %d\n", zn, i, j, k);
„
„
„
CS101 - Meshing
instead of same closest site…
same set of k closest sites
or same furthest point
CS101 - Meshing
13
Constrained Delaunay
What if there are walls
„
not all sites treated equally
kth-order & furthest-site diagrams
obstructing the view, thus the
notion of proximity
Constrained Delaunay!
ok in 2D, still hard in 3D…
„ Recommended reading: Shewchuk
„
CS101 - Meshing
15
14