Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

.

. Subject 05: Triangulation

3D Clouds of Points

Captured in both cases by a laser range finder.

Page 1 August 2006


.
. Subject 05: Triangulation

(i) Triangulation

(ii) Simple surface rendering

Page 2 August 2006


.
. Subject 05: Triangulation

General Triangulation Approach

(i) segment given cloud of points into subsets S1 , S2 , . . . , Sm ,


where each subset “forms a cluster” which is “about coplanar”
with respect to a supporting plane Πk (linear regression, grow
segments by a breadth first strategy)
(ii) map such a subset Sk orthogonally into its supporting plane;
we map Pi ∈ Sk into pi ∈ Πk
(iii) triangulate set of points S = {p1 , p2 , . . . , pn } in this plane Πk
(iv) map triangulation in Πk back into 3D: if pi and pj are
connected by an edge, then connect Pi and Pj by an edge
(v) merge 3D triangulation of subset Sk with 3D triangulations
of “adjacent” subsets

The figure illustrates merging which combines calculations of


new vertices and elimination of crossing edges; we will not
discuss in this lecture neither the more heuristic steps of
clustering (i) or merging (v), but an algorithm for the
triangulation step (iii). Steps (ii) and (iv) are defined above.

Page 3 August 2006


.
. Subject 05: Triangulation

Voronoi Diagrams

A set A is convex if for all points p, q ∈ A, the straight segment


pq is also contained in A.
Given is a finite set S = {p1 , p2 , . . . , pn } of points in a plane. A
Voronoi diagram (or Dirichlet tessellation) is the partitioning of this
plane into convex polygons, called Voronoi cells, such that each
Voronoi cell V (pi ) contains exactly one generating point pi of set
S, and every point q in the interior of one of those Voronoi cells
is closer to the generating point pi of this cell than to any other
point pj (j 6= i) in S.

V (pi ) = {q : q ∈ R2 ∧ ∀j [1 ≤ j ≤ n → de (q, pi ) ≤ de (q, pj )]}

Points pi and pk are Voronoi-adjacent if V (pi ) and V (pk ) share


more than one point (i.e., a straight segment of non-zero length).

Page 4 August 2006


.
. Subject 05: Triangulation

A set S of points is circle-free if there are no four co-circular


points in the set such that there is no further point of S in the
defined circle (of finite radius).

Both sets in the figure above are not circle-free.


Voronoi-adjacency defines a triangulation (the Delaunay
triangulation) of the given set S, if S is circle-free.

Page 5 August 2006


.
. Subject 05: Triangulation

Examples of Voronoi Diagrams and DTs

“Uniformly distributed” set S in the real plane.

VD and DT for a set S of grid points.


Page 6 August 2006
.
. Subject 05: Triangulation

Delaunay triangulation for a set S with some type of “cluster”


on the left, a few colinear points on the right, and some “sparse”
points in-between.

DT of a set S which consists of two clusters.

DT of points on a convex hull.

Page 7 August 2006


.
. Subject 05: Triangulation

Any algorithm for calculating a Voronoi diagram allows to


derive a Delaunay triangulation, and vice-versa. We present in
this lecture a relatively easy to understand O(n2 ) algorithm for
calculating the Delaunay triangulation for a set of n points.
Assume that p and q are points in the given set S, and we
already know that there is a Delaunay edge pq. We are
searching a third point r such that pqr defines one triangle of
the Delaunay triangulation.
Theorem 1 We find a third point r (in one of the two halfplanes
defined by pq ) by minimizing R · cos γ .

For a third point r ∈ S, let A be the area of the triangle pqr.


From elementary geometry we have that
a2 + b2 − c2 abc
cos γ = and R =
2ab 4·A
2 2 2
−c )
Thus we have to minimize R · cos γ = c(a +b
8·A , or,
2 2 2
equivalently, a +bA −c (because c remains constant).

Page 8 August 2006


.
. Subject 05: Triangulation

The area A of a triangle abc can be conveniently expressed by


the three-point determinant D(a, b, c), see below:

D(a, b, c) is the area of the oriented trapezoid defined by points


a, b, and c; it follows that A = 12 |D(a, b, c)|.
The value of D(a, b, c) is either positive (left turn in right-hand
coordinate system), negative (right turn), or equal to zero (three
colinear points).
Back to our optimization problem:
2 2 2
+b −c
if D(p, q, r) > 0, then we minimize aD(p,q,r) (i.e., r is in the
half-plane left of the vector from p to q);
a2 +b2 −c2
otherwise, if D(p, q, r) < 0, then we maximize D(p,q,r) .

Page 9 August 2006


.
. Subject 05: Triangulation

This gives us the following test for identifying a third point of a


Delaunay triangle:

Let r ∈ S \ {p, q} be the first point for which


D(p, q, r) 6= 0. If D(p, q, r) > 0, we identify third points
(throughout the procedure) by minimizing

a2 + b2 − c2
K(p, q, r) :=
D(p, q, r)
If D(p, q, r) < 0, we identify third points by maximizing
K(p, q, r).

A Delaunay diagram is a subdiagram of a nearest neighbor


diagram. Given a finite set S of points, we pick a point p in S
and search in S for one of the nearest neighbors q of p. We start
the construction with pq, which is an edge of one of the
Delaunay triangles.
In the first test for a third point we search for a point r such that
D(p, q, r) is not zero. The result (positive or negative) for the
first point t ∈ S \ {p, q} already (!) decides whether the
algorithm proceeds from here on (always) either by
maximization or by minimization strategy.
If the given set S of points is not circle-free, the following
algorithm chooses one of the possible triangulations.

Page 10 August 2006


.
. Subject 05: Triangulation

Delaunay Algorithm

1. Choose p ∈ S, and find a q ∈ S that is a nearest neighbor of


p. Choose a point t ∈ S \ {p, q}; depending on the sign of
D(p, q, t), we use maximization (Kin := −∞) or
minimization (Kin := ∞) in this run of the algorithm.
2. Find a third point r ∈ S \ {p, q} that maximizes (minimizes)
K(p, q, r). – Put the vectors qp, ~ and rq
~ pr, ~ on a list.
// This is one run around the triangle.//
3. As long as the list is not empty, go to Step 4; otherwise, stop.

~ off from the list. Set flag := 0, set pointer ThirdPoint


4. Take pq
:= VOID, and set K := Kin .
5. For all r ∈ S \ {p, q} (go to Step 6 when finished):
(a) If K ≥ K(p, q, r) for maximization or K ≤ K(p, q, r) for
minimization, go to Step 5 (c).
(b) Set flag := 1, K := K(p, q, r), and ThirdPoint := r.
(c) Go back to Step 5 for the next point r ∈ S \ {p, q}.
6. If flag = 0, go to Step 3. Otherwise, let r := ThirdPoint.
//A new Delaunay triangle (p, q, r) has been detected; take
appropriate action.//
(a) If pr
~ is on the list, delete it; otherwise, put pr
~ on the list.
(b) If rq
~ is on the list, delete it; otherwise, put rq
~ on the list.
7. Go to Step 3.

Page 11 August 2006


.
. Subject 05: Triangulation

The points of S are all colinear, for example, on line l, if and


only if A = D(p, q, r) = 0 for all r ∈ S \ {p, q}; in this case, the
Delaunay diagram connects the points along l in sorted order.
For the algorithm on the previous page, we assume that the
points of S are not all colinear.
The sign of D(p, q, r) also tells us whether the ordered triple
(p, q, r) describes a left turn or a right turn. The oriented straight
line segment (i.e., the vector) from p to q defines two halfplanes;
r is in the left (right) halfplane iff (p, q, r) is a left turn (right
turn). pq can also be incident with a second Delaunay triangle
that has a third point r0 that is in the right (left) halfplane. This
is why we put oriented line segments (vectors) rather than line
segments on the list in the algorithm; if we arrive at the same
vector a second time, we delete it from the list.
The given algorithm has time complexity O(n2 ). For larger sets
of points it is preferable to use optimized algorithms that run in
O(n log n) time (you may check the internet for free
downloads). Also, points r in Step 5 of the given algorithm may
be preselected. The worst-case time complexity of Delaunay
diagram construction has the lower bound of Ω(n log n).
There are several interesting properties of Delaunay or Voronoi
diagrams, such as:
(i) The union of the Delaunay triangles is the convex hull of the
set of points.
(ii) Vertices of the convex hull define unbounded Voronoi cells;
otherwise Voronoi cells are bounded convex polygons.

Page 12 August 2006


.
. Subject 05: Triangulation

Input Example

Consider the set S as given above as an input example. Note


that it is not circle-free: points 6, 8, 10, and 7 are cocircular, and
this circle does not contain any other point of the given set.
However, the algorithm will calculate a triangulation and this
depends on the order how points 6, 7, 8, 10 are read when
processing this set.
The algorithm could start with taking one random pick in the
set, say point 1. Then we calculate a nearest neighbor of point 1.
In this case we have three, and we decide for point 4. These two
points define our initial pair p = p1 and q = p4 of points. Now
we check for a third point. D(p1 , p4 , p2 ) is negative (a right
turn), thus the algorithm will proceed using the maximization
strategy.
Page 13 August 2006
.
. Subject 05: Triangulation

Coursework

05.1. [possible lab project] Implement the given algorithm for


Delaunay triangulation of finite sets of points, where the input
set is a set of black pixel in an otherwise white 512 × 512 binary
picture (as in the example on Page 11). Draw the resulting lines
of the Delaunay triangulation in the order as calculated by the
program. Slow the procedure down such that the order can be
traced visually.
05.2. Discuss examples of finite 2D sets of points which are
either circle-free, or not circle-free.
05.3. Draw about 10 points “randomly” on a sheet of paper.
Draw a graphical sketch of the resulting Voronoi diagram.
05.4. What are the Voronoi diagrams for n points which are all
colinear? What is the Voronoi diagram for all M × N pixel of a
picture?
05.5. Find out about the mathematicians Voronoi and Delaunay:
when did they live, and what was their motivation for
proposing the diagrams discussed in this lecture?
05.6. Assume that in the 3D subset (to be triangulated by
running the 2D Delaunay triangulation), two 3D points Pi and
Pj map onto the same 2D point pi = pj in the chosen supporting
plane. How would you proceed in cases like that?

Page 14 August 2006


.
. Subject 05: Triangulation

Appendix: Tessellated Image

Randomly (e.g., using a uniform distribution, or some


variations from grid point positions) generated points create a
Voronoi diagram, which is used as an overlay for a given
picture. A sampled picture value in a cell is then used for filling
the whole cell. The final tessellation (bottom, right) uses a fine
pattern of Voronoi cells (store in Trier, March 2004).

Page 15 August 2006

You might also like