CLASS3
CLASS3
INTRODUCTION
Computational geometry emerged from the field of algorithms design and analysis in the late 1970s. It has grown into a
recognized discipline with its own journals, conferences, and a large community of active researchers. The success of the
field as a research discipline can on the one hand be explained from the beauty of the problems studied and the solutions
obtained, and, on the other hand, by the many application domains—computer graphics, geographic information systems
(GIS), robotics, and others—in which geometric algorithms play a fundamental role. For many geometric problems the
early algorithmic solutions were either slow or difficult to understand and implement. In recent years a number of new
algorithmic techniques have been developed that improved and simplified many of the previous approaches.
BY DEFINTION
Computational geometry Is defined as a branch of computer science devoted to the study of algorithms which can be
stated in terms of geometry.
Computational geometry is also a term claimed by a number of different groups. The term was coined perhaps by Marvin
Minsky in his book “perceptions”, which was about pattern recognition, and it has also been used often to describe
algorithms for manipulating curves and surfaces in solid modeling.
Some purely geometrical problems arise out of the study of computational geometric algorithms, and such problems are
also considered to be part of computational geometry.
Computational complexity is central to computational geometry, with great practical significance if algorithms are used
on very large datasets containing tens or hundreds of millions of points. For such sets the difference between days and
seconds of computation.
The main impetus for the development of computational geometry as a discipline was progress in computer graphics and
computer-aided design and manufacturing (CAD/CAM), but many problems in computational geometry are classical in
nature and may come from mathematical visualization.
It most widely recognized use, however, is to describe the subfield of algorithm theory that involves the design and
analysis of efficient algorithms for problems involving geometric input and output.
The field of computational geometry developed rapidly in the late 70’s and through the 80’s and 90’s, and it still continues
to develop. Historically, computational geometry developed as a generalization of the study of algorithms for sorting and
searching in 1-dimensional space to problems involving multi-dimensional inputs, because of its history the field of
computational geometry has focused mostly on problems 2-dimensional space and to a lesser extent in 3-dimensional
space.
Because the field was developed by researchers whose training was in discrete algorithms (as opposed to numerical
analysis) the field has also focused more on the discrete algorithms (as opposed to numerical analysis) the field has also
focused more on the discrete nature of geometric problems (combinatorics and topology in particular) as opposed to
continuous issues.
1
The field primarily deals with straight or flat objects (lines, line segments, polygons, planes and polyhedral) or simple
curved objects such as circles. This is in contrast; say to fields such as solid modeling which focus on issues involving
curves and surfaces and their representations.
One of the goals of computational geometry is to provide the basic geometric tools needed from which applications areas
can then build their programs. There are many fields of computer science that deal with solving problems of a geometric
nature. These include computer graphics, computer vision and image processing, robotics, computer-aided design and
manufacturing (CAD/CAM), computational fluid-dynamics, geographic information systems to name a few.
Many situations which we need to write programs that involve computations of a geometric nature:
i. In video games such as Doom, the computer must display scenes from a three-dimensional environment as
the player moves around. This involves determining where the player is what he or she would see in different
directions and how to translate this three-dimensional information to the two-dimensional computer screen.
A data structure known as a binary space partition is commonly used for this purpose.
ii. In order to control robot motion, the computer must generate a model of the obstacles surrounding the robot,
find a position for the robot that is suitable for whatever action the robot is asked to perform, construct a plan
for moving the robot to that position and translate that plan into controls of the robot’s actuators. One example
of this is parking a car: How can you compute a plan for entering or leaving a parking spot, given knowledge
of nearby obstacles (other cars) and the turning radius of your own car?
iii. In scientific computation such as the simulation of the airflow around a wing, one typically partitions the
space around the wing into simple regions such as triangles and uses some simple approximation such as
linear function for the flow in each region. The computation of this approximation involves the numerical
solution of differential equations.
To calculate a point in the plane, 3-dimensional space, and higher dimensional space can be done with the following
formulas:
A point in geometry is a location. It has no size, i.e no width, no length and no depth. A point is shown by a dot.
●P
Line segments
A line is defined as a line of points that extends infinitely in two directions. It has one dimension, length. Points
that are on the same line are called collinear points.
2
Two line segments intersect if they have some point in common. It is a proper intersection if it is exactly one interior point
of each line segment.
In geometry, a line segment is a part of a line that is bounded by two distinct end points, and contains every
point on the line between its endpoints.
A closed line segment includes both endpoints, while an open line segment excludes both endpoints; a half-
open line segment includes exactly one of the endpoints.
Examples of line segments include the sides of a triangle or square. More generally, when both of the segment's
end points are vertices of a polygon or polyhedron, the line segment is either an edge (of that polygon or
polyhedron) if they are adjacent vertices, or otherwise a diagonal.
When the end points both lie on a curve such as a circle, a line segment is called a chord (of that curve).
A Line segment
aaaaAintersection
line AA pq is
defined by its
two endpoints p
and q:
To solve map overlay questions, we need (at the least) intersection points from two sets of line segments (possibly,
boundaries of regions).
3
The Distance Formula
Very often, especially when measuring the distance in the plane, we use the formula for the Euclidean distance. According
to the Euclidean distance formula, the distance between two points in the plane with coordinates (x, y) and (a, b) is given
by
As an example, the (Euclidean) distance between points (2, -1) and (-2, 2) is found to be
Given a set of n line segments in the plane, find all intersection points efficiently
Algorithm FINDINTERSECTIONS(S)
4
Polygons
A polygon is a closed figure where the sides are all line segments. Each side must intersect exactly two others
sides but only at their endpoints. The sides must be noncollinear and have a common endpoint.
A polygon is usually named after how many sides it has, a polygon with n-sides is called a n-gon. E.g. the
building which houses United States Department of Defense is called pentagon since it has 5 sides.
Line segments called edges, their endpoints called vertices. A simple polygon is a closed polygonal curve
without self-intersction.
Sides Polygon
3 triangle
4 quadrilateral
5 pentagon
6 hexagon
7 heptagon
9 nonagon
10 decagon
A regular polygon is a polygon in which all sides are congruent and all the angles are congruent.
simple polygon
polygon with holes
convex polygon
non-simple polygon
The line segments of a polygon are called its edges; the endpoints of those edges are the vertices.
5
simple polygon
convex polygon
non-simple polygon
In elementary geometry, a polyhedron (plural polyhedra or polyhedrons) is a solid in three dimensions with flat
polygonal faces, straight edges and sharp corners or vertices. The word polyhedron comes from the Classical
Greek πολύεδρον, as poly- (stem of πολύς, "many") + -hedron (form of ἕδρα, "base" or "seat"). Cubes and
pyramids are examples of polyhedra.
A polyhedron is said to be convex if its surface (comprising its faces, edges and vertices) does not intersect
itself and the line segment joining any two points of the polyhedron is contained in the interior or surface.
A polyhedron is a 3-dimensional example of the more general polytope in any number of dimensions.
6
Convex Hull
The convex hull (or the hull), austerely beautiful object, is one of the most fundamental structure in
computational geometry and plays a central role in pure mathematics. No wonder, the convex hull of a set of
points is one of the most studied geometric problems both in algorithms and in pure mathematics. Indeed,
computing convex hull is a fundamental operation in computational geometry. The in depth study of the hulls
is useful in its own right and as a tool for constructing other structures in a variety of circumstances in the design
of algorithms. The convex hull represents something of a success story in the area of algorithmic geometry. The
computation of convex hull is one of the first papers in this area. There has been an amazing variety of research
on hulls which ultimately lead to optimal algorithm known as Graham's scan. To trace the history of Graham's
scan algorithm is worth it especially, in the context of algorithm design and analysis.
The importance of the topic demands an intuitive appreciation. So intuitively, if we think of each point in given
set as being a nail sticking out from a board, the convex hull is the shape formed by a tight rubber band that
surrounds all the nails.
In the computational geometry, the convex hull of Q is denoted by H(Q) or (as in CLRS) by CH(Q).
The importance of the topic demands not only an intuitive appreciation (rubber band example above) but formal
definition of a convex hull.
7
The convex hull Q is the set of all convex combinations of points in the given set.
The convex hull of a finite set of points Q in the plane is the smallest convex polygon P that encloses Q. Here,
the notion of "smallest" is in the sense that there is no other polygon P' such that (P is a superset of P' is a
superset or equal to Q).
The convex hull of a finite set of points Q in the plane is the enclosing convex polygon P with smallest perimeter.
That is, the convex hull is the smallest convex polygon containing the points:
Polygon: A region of the plane bounded by a cycle of line segments, called edges, joined end-to-end in
a cycle. Points where two successive edges meet are called vertices.
Convex: For any two points p, q inside the polygon, the line segment pq is completely inside the
polygon. Formally, a set S is convex if p is in S and q is in S implies that the segment pq is a subset of
S. See the figure below. Note that this can be taken as the primary definition of convexity.
Smallest: Any convex proper subset of the convex hull excludes at least one point in P. This implies
that every vertex of the convex hull is a point in P.
Equivalently, we can also define the convex hull as the largest convex polygon whose vertices are all points in
P, or the unique convex polygon that contains P and whose vertices are all points in P. Notice that P might have
interior points that are not vertices of the convex hull.Mathematically speaking, we say the convex envelop for
set of point Q in a real vector space V is the minimal convex set containing Q. In the mathematics literature,
the convex hull of Q is denoted by conv Q.
The computation of the convex hull of a finite set of points has found applications in diverse areas, such as
pattern recognition, image processing, robotics, and stock cutting and allocation. There are numerous
applications in the literature. Lets briefly look at a few of them.
Collision avoidance: Suppose our problem is to plan the path for a robot from point a to point b in the
presence of obstacles. If the convex hull of a robot avoids collision with obstacles, then so does the
robot. So, the convex hull structure often used to plan paths.
8
Fitting ranges with a line: Suppose our problem is to find a straight line that fits between a collection of
data ranges. Our solution requires finding a straight line that fits between a collection of data ranges
maps to finding the convex region common to a collection of halfplanes.
Smallest box: Suppose our problem is to place an object (convex polygon) in a smallest box. The smallest
area rectangle that encloses a polygon has at least one side flush with the convex hull of the polygon,
and so hull is computed at the first step of minimum rectangle algorithms. Similarly, finding the smallest
three-dimensional box surrounding an object in space depends on the convex hull of the object.
Shape analysis: Shapes may be classified for the purpose of matching by their "convex deficiency trees,"
structures that depend for their computation on convex hulls.
Developing an Algorithm
To develop an algorithm:
Find useful properties, make various observations, and draw many sketches to gain insight.
9
All points lie right of the directed line from p to q, if the edge from p to q is a CW convex hull edge.
Problem: So,
the problem we want to solve is this: Given a set Q = {p1, p2, ..., pn} of points in the plane, compute a list that contains
those points from Q that are the vertices of CH(Q), listed in counterclockwise order.
Input = Set of points: p1, p2, p3, p4, p5, p6, p7, p8, p9
Output = Representation of the convex hull: p8, p5, p4, p9, p2
Main Idea: Sort the points from left to right , then insert the points in this order and maintain the upper hull so far.
10
11