lecture 5

advertisement
Computational Geometry
- Methods, applications and problems of shape
modeling
- Computational geometry

Finding Dealunay Triangulations

Finding Convex Hulls: Insertion Hull
 A connection between Delaunay triangulation
and convex hulls

Point Enclosure: The Ray-Shooting Method
Introduction
 According
to Longman Dictionary of Contemporary
English the word shape means the outer form of something,
that you see or feel.
There is no a method or a system that is ideally suited to
all tasks and researchers are still focusing on the
development of sophisticated algorithms to discover the
essential rules of representing and generating shapes.

Introduction
Computer-aided geometric design (CAGD) mainly based
on parametric representation now pervades many areas. In
spite of elaborate user interfaces this is very routine work
that leads to long training.

Constructive solid geometry (CSG) deals with a collection
of simple primitives and now is looking the most promising
direction in the geometric modeling. However, it suffers from
the difficulties connected with free form modeling..

Introduction
Polygonal representation is rather popular in animation field. However,
we have to notice that polygonal patches, in fact in many cases, are the
result of another representations or processing data.

Geometric objects defined by real functions of several variables (socalled implicit models), with the help of procedural techniques (physically
based modeling, L-systems, particle systems) have proven to be useful in
CG, geometric modeling and animation. The main problems of this
technique are the performance, interface and interactivity.

Physics based modeling essentially is based on the Finite Element
Method which has a history in the application of structural analysis of
materials. This method is used in CAD applications and different tissue
simulations were performed for computer animation goals and surgery
planning. This models are computationally expensive.

Introduction
A model is an artificially constructed object that makes the
observation of another object easier. Examples of models
are physical models of ships and cars or human faces,
molecule models used in chemistry or biology, mathematical
models modeled in terms of numerical data and equations.
Models are useful because they can present or study
characteristics of an object more easily by specifying certain
methods or another (underlying) models if they are needed.

The key observation is that many problems are inherently
geometric and it makes sense to separate the data dealing
with the geometric shape from other, non-geometric data
called object model.

Computational geometry
Computer graphics encompasses methods for rendering
scenes.


Modeling is used to construct a scene description.
Computational geometry encompasses algorithms for
solving geometry problems.

The problems we will cover are easy to formulate and
invoke simple geometric object: points, lines, polygons.

Traditionally, computational geometry includes the
definition or statement of a problem, algorithm and an
algorithmic paradigm. Algorithms employ objects for
organizing data called data structures.

Computational geometry:Finding Dealunay
Triangulations
A triangulation of a finite point set S is a triangulation of the
convex hull CH(S) that uses all the points of S.

The convex hull of set S equals the intersection of all
convex polygons which contain S. Equivalently, CH(S) is the
convex polygon of minimum area which contains all the
points of S. Equivalent definition states that CH(S) equals
the union of all triangles determined by points of S.

A region in the plane is convex if for any two points in the
region, the line segment between the two points lies in the
region.

Finding Dealunay Triangulations
A polygon is a closed curve in the plane composed of
straight line segments.

The segments are called the edges or sides of the
polygon, and the end points where two segments meet are
called its vertex. The number of vertices that a polygon
possesses is its size.

A polygon is simple if it does not cross itself. A simple
polygon enclosed a connected region of the plane, referred
to as its interior. The unbounded region surrounding a simple
polygon forms its exterior, and the set of points lying on the
polygon itself forms its boundary.

Finding Dealunay Triangulations

Two triangulations of the same set of points.
The edges of a triangulation of S can be classified as hull
edges and interior edges. The hull edges are those edges
that lie along the boundary of the convex hull CH(S), and the
interior edges are the remaining edges, those that pierce the
convex hull interior.

Observe that every edge of the triangulation is met by two
faces: each interior edge by two triangles, and each hull
edge by one triangle and the unbounded plane.

Finding Dealunay Triangulations
Point-Set Triangulation Theorem: Suppose point set S
contains n  3 points, not all collinear. Suppose further that i
of the points are interior [lying in the interior of CH(S)]. Then
every triangulation of S contains exactly n + i – 2 triangles.

To see why this theorem is true, first consider triangulating
the n – i boundary points. Since they are the vertices of a
convex polygon any such triangulation contains (n – i) – 2
triangles. Now consider incorporating the remaining i interior
points into the triangulation, one at time. We claim that
adding each such point increases the number of triangles by
two.

Finding Dealunay Triangulations
The two cases illustrated in Figure can occur. First, if the
point falls in the interior of some triangle, the triangle is
replaced by three new triangles.

Second, if the point falls on some edge of the triangulation,
each of the two triangles that meet the edge is replaced by
two new triangles. It follows that after all i points are
inserted, the total number of triangles is (n – i - 2) + (2i), or
simply (n + i - 2).

Finding Dealunay Triangulations
 Delaunay triangulations are well balanced in the sense
that triangles tend toward equiangularity.
Figure shows the Delaunay triangulation of a large point
set (250 points chosen at random within a rectangle).

Finding Dealunay Triangulations
To define Delaunay triangulation, we need some new
definitions. A set of points is cocircular if there exists some
circle on whose boundary all the points lie. If the circle is
unique, it is called the circumcircle of the points. The
circumcircle of a triangle is simply the circumcircle of its
three (non-collinear) vertices. A circle is said to be point free
with respect to a given point set S if none of the points of S
lies in the circle`s interior. Points of S may, however, lie
along the boundary of a point-free circle.

A triangulation of point set S is a Delaunay triangulation if
the circumcircle of every triangle is point free.

Finding Dealunay Triangulations
 We will make two assumptions about point set S to
simplify the triangulation algorithm.
First, to ensure that some triangulation exists, we will
assume that S contains at least three points, not all collinear.

Second, to ensure the Delaunay triangulation is unique,
we will assume that no four points of S are cocircular.

Algorithm works by growing a current triangulation, triangle
by triangle. In each iteration, the algorithm seeks a new
triangle which attaches to the frontier of the current
triangulation.

Finding Dealunay Triangulations

The definition of frontier depends on the following scheme,
which classifies the edges of the Delaunay triangulation
relative to currentr triangulation. Every edge is either dormant,
live, or dead:
1.
Dormant edges: An edge of the Delaunay triangulation is
dormant if it has not yet been discovered by the algoritm.
2.
Live edges: An edge is live if it has been discovered but only
one of its faces is known.
3.
Dead edges: An edge is dead if it has been discovered and both
of its faces are known.
Finding Dealunay Triangulations

Initially only a single hull edge is live – the unbounded plane is
known to meet it – and all remaining edges are dormant. As the
algorithm proceeds, edges transition from dormant to live, from live
to dead. The frontier at each stage consists of the set of live edges.

In each iteration, we select any edge e of the frontier and process it,
which consist of seeking edge e`s unknown face.

If this face turns out to be some triangle t determined by the
endpoints of e and some third vertex v, edge e dies since both of its
faces are now known. Moreover, each of the other two edges of
triangle t transition to the next state: from dormant to live, or from live
to dead. Here vertex v is called the mate of edge e.

Alternatively, if the unknown face turn out to be unbounded plane,
edge e simply dies. In this case e has no mate.
Finding Dealunay Triangulations

Figure illustrates the algorithm. In the figure, the action proceeds top
to bottom, then left to right. The frontier in each stage is darkened.
A connection between Delaunay triangulation and
convex hulls.

There is a fascinating relationship between Delaunay triangulations
and the convex hull of a particular set of 3D points.

Delaunay triangulations and convex hulls appear to be quite different
structures, one is based on metric properties (distances) and the other
on affine properties (collinearity, coplanarity).

It is possible to convert the problem of computing a Delaunay
triangulation in dimension d to that of computing a convex hull in
dimension d + 1.

The connection between the two structures is the paraboloid z = x2 +
y2. Observe that this equation defines a surface whose vertical cross
sections (constant x or constant y) are parabolas, and whose
horizontal cross sections (constant z) are circles. For each point in the
plane, (x, y), the vertical projection of this point onto this paraboloid is
(x,y, x2 +y2) in 3 space.
A connection between Delaunay triangulation and
convex hulls.
Two-Dimensional Delaunay Triangulations

The paraboloid is
z = x2 + y2 ,
see Figure.
A connection between Delaunay triangulation and
convex hulls (Cont)

Given a set of points S in the plane, let S0 denote the
projection of every point in S onto this paraboloid.

Consider the lower convex hull of S0. This is the portion of
the convex hull of S0 which is visible to a viewer standing at
z = -1.

We claim that if we take the lower convex hull of S0, and
project it back onto the plane, then we get the Delaunay
triangulation of S.
A connection between Delaunay triangulation and
convex hulls (Cont)

In particular, let (p, q, r) be elements of S, and let p0 , q0 , r0
denote the projections of these points onto the paraboloid.

Then p0 q0 r0 define a face of the lower convex hull of S0 if
and only if pqr is a triangle of the Delaunay triangulation of
S. The process is illustrated in the following fFgure.
A connection between Delaunay triangulation and
convex hulls (Cont.)

Take the given sites/points
in the plane, and project
them upwards until they hit
the paraboloid, that is, map
every point as follows:
(xi, yi)  (xi, yi , x2i + y2i).

Take the convex hull of this
set of three-dimensional
points; see Figure
A connection between Delaunay triangulation and
convex hulls.
Two-Dimensional Delaunay Triangulations (Cont)

Now discard the “top” faces
of this hull (points having a
positive dot product with the
z axis vector). Result is a
bottom “shell”. Project this
to the xy-plaine.

This is the
triangulation!
See Figure
Delaunay
A connection between Delaunay triangulation and
convex hulls (Cont.)

The question is, why does this work? To see why, we need
to establish the connection between the triangles of the
Delaunay triangulation and the faces of the convex hull of
transform

In particular, recall that
 Delaunay condition: Three points p, q, r, in S form a
Delaunay triangle if and only if the circumcircle of these
points contains no other point of S.
 Convex hull condition: Three points p0, q0, r0 in S0 form a
face of the convex hull of S0 if and only if the plane passing
through p0, q0, and r0 has all the points of S0 lying to one
side.
A connection between Delaunay triangulation and
convex hulls (Cont.)
 The connection we need to establish is between the
emptiness of circumcircles in the plane and the emptiness of
halfspaces in 3 space.
 Lemma: Consider 4 distinct points p, q, r, s in the plane,
and let p0, q0, r0 s0 be their respective projections onto the
paraboloid, z = x2 + y2 . The point s lies within the
circumcircle of p, q, r if and only if s0 lies on the lower side
of the plane passing through p0, q0, r0 .
A connection between Delaunay triangulation and
convex hulls (Cont.)
 To prove the lemma, first consider an arbitrary (nonvertical)
plane in 3 space, which we assume is tangent to the
paraboloid above some point (a, b) in the plane. To
determine the equation of this tangent plane, we take
derivatives of the equation z = x2 + y2 with respect to x and
y, giving:
dz/dx = 2x
dz/dy = 2y
• At the point (a, b, a2 +b2 ) these evaluate to 2a and 2b. It
follows that the plane passing through these point has the
form
t = 2ax + 2by + k.
A connection between Delaunay triangulation and
convex hulls (Cont.)
• To solve for k we know that the plane passes through
(a, b, a2 + b2 )
so we solve giving
a2+ b2 = 2 a2 + 2 b2 + k.
• Implying that k = - (a2 + b2 ). Thus the plane equation is:
z = 2ax + 2by - (a2 + b2 )
A connection between Delaunay triangulation and
convex hulls (Cont.)
• If we shift the plane upwards by some positive amount r2
we get the plane
z = 2ax + 2by - (a2 + b2 ) + r2 .
• How does this plane intersect the paraboloid? Since the
paraboloid is defined by:
z = x2 + y2
we can eliminate z giving
x2 + y2 = 2ax + 2by - (a2 + b2 ) + r2,
which after some simple rearrangements is equal to
(x - a)2 + (y - b)2 = r2 .
• This is just a circle.
A connection between Delaunay triangulation and
convex hulls (Cont.)
• Thus, we have shown that the intersection of a plane with
the paraboloid produces a space curve (which turns out to
be an ellipse), which when projected back onto the (x, y)
coordinate plane is a circle centered at (a, b).
A connection between Delaunay triangulation and
convex hulls (Cont.)
•
Thus, we conclude that the intersection of an arbitrary lower
halfspace with the paraboloid, when projected onto the (x, y)
plane is the interior of a circle.
•
Going back to the lemma, when we project the points p, q, r
onto the paraboloid, the projected points p0, q0 and r0 define
a plane. Since p0, q0 and r0 , lie at the intersection of the
plane and paraboloid, the original points p, q, r lie on the
projected circle.
•
Thus this circle is the (unique) circumcircle passing through
these p, q, and r. Thus, the point s lies within this
circumcircle, if and only if its projection s0 onto the
paraboloid lies within the lower halfspace of the plane
passing through .
A connection between Delaunay triangulation and
convex hulls (Cont.)

The shifted plane intersects
the paraboloid in a curve (an
ellipse) that projects to a
circle!

This is illustrated in Figures
- Plane for (a, b) =(2, 2) and r = 1
cutting the paraboloid
- The curve of intersection in the
xy-plane.
dt4vornew.exe
The Voronoi diagram

The Voronoi diagram of a collection of geometric
objects is a partition of space into cells, each of
which consists of the points closer to one particular
object than to any others.
Finding Convex Hulls: Insertion Hull

Imagine the plane to be a sheet of wood with a nail
protruding from every point in S. Now stretch a rubber
band around all the nails and then release it, allowing it
to snap taut against the nails. The taut rubber band
conforms to the convex hull boundary.
Finding Convex Hulls: Insertion Hull

A point is a boundary point if it lies in the convex hull
boundary, and an interior point if it lies in the convex hull
interior.

Those boundary points which form the “corner” vertices
of the convex hull are known as extreme points.
Equivalently, a boundary point is extreme if it does not lie
between any two other points of S.

Incremental insertion approach. Initially, the current hull
consists of a single point of S; at completion, when all
points have been inserted, the current hull equals CH(S)
and we are done.
Finding Convex Hulls: Insertion Hull

When a new point s is inserted into the current hull, one
of two cases occurs. In the first case, s may lie in the
current hull, in which case the current hull does not need
to be updated.

In the second case, s lies outside the current hull,
requiring that the current hull be modified as in Figure .
Through point s can be drawn two supporting lines tangent to the current hull.
Point Enclosure: The Ray-Shooting Method

Point enclosure algorithm decides whether a given point
a lies inside, outside, or on the boundary of a convex
polygon p. In Figure , for example, the interior of the
polygon straddle both sides of the edge labeled e.
Point Enclosure: The Ray-Shooting Method

The main idea of the ray-shooting method is the
following: starting from some point far from the polygon,
move in a straight line towards a. Along the way we
cross the polygon boundary zero or more times: the first
time crossing into the polygon, the second time crossing
back out, the third time crossing back in once again, and
so forth, until arriving at a. In general, every oddnumbered crossing carries us into polygon p, and every
even-numbered crossing carries us back out of p.

If we arrive at a having undergone an odd number of
crossing, a lies inside p; and if an even number of
crossings, a lies outside p.
Point Enclosure: The Ray-Shooting Method

Transforming this idea into an algorithm turns on two key
observations:

First, any ray that originates at the point a to be classified will
do. Being free to work with any ray originating at a, we can for
simplicity, work with the right horizontal ray originating at a.

The second key observation is that the order of boundary
crossing along ray is irrelevant.
Point Enclosure: The Ray-Shooting Method

Relative to the right horizontal ray , we should distinguish
tree types of polygon edges: touching edges, which
contain point a; crossing edges, which do not contain
point a but which ray crosses; and inessential edges,
which ray does not meet at all. For example, in Figure,
edge c is crossing edge, edge d is touching edge, and
edge e is an inessential edge.

Further reading
J. O’Rourke, Computational Geometry in C, Cambridge
University Press, 2nd ed, 1998
Surfaces: Curvature Estimation
• In
the past 20 years, a number of
remarkable algorithms for calculating the
curvature of 3D surfaces have been
developed.
• Main objective is to classify each point
in the surface in a manner that allows
the detection of geometric features as
well as the initialization of matching
algorithms.
• Applications: clothing design and
manufacturing,
medical research
(disorders) and prosthesis design.
Surfaces: Curvature Based Mesh
Improvement
• It is very important to improve the quality of surface meshes for numerical
simulations, solid mesh generation, and computer graphics applications.
• Optimizing the form of the mesh elements it is necessary to preserve new
nodes of the mesh as close as possible to a surface approximated by the initial
mesh.
• In the method discussed here the new location of each node is found using
values of principal curvatures in this node. Such procedure allows preserving new
mesh very close to the initial surface while improving element quality.
• There are two main ways for mesh optimization: modification of the mesh
topology by inserting/deleting mesh nodes or edge flipping and node movement
methods, commonly called mesh smoothing.
• Good shape of mesh elements is not only the criteria of mesh quality. It is also
important to preserve the new nodes as close as possible to the smooth surface
approximated by the initial mesh.
Surfaces: Curvature Based Mesh
Improvement
• We formulate the problem of mesh improvement in the following way. A
triangular mesh which serves as a representation (discrete approximation) of a
smooth surface is given. It is necessary to improve mesh element quality in such
.
a way that new nodes keep situated on the approximated smooth surface
• Main idea:
The new position of each node is found using principal curvatures
calculated for each node.
• Such procedure allows keeping vertices of the new mesh very close to
approximated smooth surface.
Surfaces: Curvature Based Mesh
Improvement
•
Construction of the quadric

The Monge form

The quadric of the form
is used.
is fitted to the nodes in a local coordinate system whose axis is along a
normal at the concerned vertex and whose origin is at that vertex.

It is necessary to determine normals at the nodes of the initial mesh. For
that we calculate normals for each triangle and then average them at
shared points.

For quadric interpolation least squares method is used.
Surfaces: Curvature Based Mesh
Improvement
•
Construction of the quadric
For each node
of the initial mesh:

Get the k nearest neighboring nodes.

Compute the tangent plane P at concerned node (i.e. the plane
perpendicular to the normal
at
).

Define an orthonormal coordinate system
in P with a node
as an origin and take the normal
as a z axis.

Find the k coordinates, of the nearest neighboring nodes in the new
coordinate system.

Form the system:
,

, where
- required coefficients of the quadric.
Solve the system
, where
with classical Gauss method.
is the least square solution,
Surfaces: Curvature Based Mesh
Improvement
•

Curvature estimation
After the quadric
has been found for each node of the mesh the principal curvatures are calculated
using notions of classical differential geometry.

The matrix of the first fundamental form for our quadric is written in the form:

The matrix of the second fundamental form is

The eigenvalues of these pair of forms, i.e. of the equation
principal curvatures: maximal
and minimal
.
, are the
Surfaces: Curvature Based Mesh
Improvement
•



Mesh improvement
First, “improved” normals which will be as close as possible to the smooth
surface approximated by initial mesh are calculated.
To calculate such normals, area-weighted coefficients are used.
Consider an oriented triangle mesh. Let us define the “improved” normal in
some node p of the mesh. For each triangle i incident to the concerned
node we calculate the weight coefficient
.
Here
is the area of the triangle that incident to. We calculate normals
for each triangle i incident to the concerned node and averaging them at
that node with coefficients
. Then we normalize these averaged
normals.
Surfaces: Curvature Based Mesh
Improvement
•
Mesh improvement

Consider how the algorithm works in 2D case.
In this case the problem is formulated in the
following way.
It is necessary to reduce the difference
between the lengths of the segments of the
given polygonal line keeping the new nodes as
close as possible to the curve approximated
this polygonal path.
The algorithm is transformed into the following
procedure.
For each node of the polygonal line we define
the “ordinary” normals similarly to 3D case.
Then if the node is not the end vertex we draw
the circumference passing through concerned
node and two nodes incident to it.
From the center of the circumference we draw
the radius in the direction opposite to the
normal defined in.
Obtained point on the circumference is the new
position for
as shown in Figure.






Surfaces: Curvature Based Mesh
Improvement
•

Mesh
improvement.
Experiments
Comparison between images by
the algorithm and Laplacian
smoothing.
(a) The sphere optimized with
CBMI algorithm using “ideal”
normals (the difference of the
volume from the original model is
0.93%);
(b) The sphere processed with
Laplacian
smoothing
(the
difference of the volume from the
original model is 1.83%).
Assigment 2
Due Lec. 9
 Develop an Applet or OpenGL program to calculate and draw
the minimum area closing rectangle for a convex polygon
• Given a convex polygon P, what is the smallest-box (in terms of surface area)
enclosing P? Technically, given a direction, the extreme points for P can be computed
and an enclosing rectangle is therefore constructed.
• The minimum area rectangle enclosing a convex polygon P has a side collinear with an
edge of the polygon.
• Illustrating the above result: the four lines of support (red), with one coinciding with
an edge, determine the enclosing rectangle (blue).
• A simple algorithm would be to compute for each edge the corresponding rectangle
collinear with it and the construction of this rectangle would imply computing the
polygon's extreme points for each edge.
Download