Download Mo 27 February 2006

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

History of trigonometry wikipedia , lookup

Simplex wikipedia , lookup

Trigonometric functions wikipedia , lookup

Multilateration wikipedia , lookup

Dual graph wikipedia , lookup

Cartesian coordinate system wikipedia , lookup

Pythagorean theorem wikipedia , lookup

Euclidean geometry wikipedia , lookup

Lie sphere geometry wikipedia , lookup

Integer triangle wikipedia , lookup

Approximations of π wikipedia , lookup

Shapley–Folkman lemma wikipedia , lookup

Dessin d'enfant wikipedia , lookup

Rational trigonometry wikipedia , lookup

Duality (projective geometry) wikipedia , lookup

Signed graph wikipedia , lookup

Triangle wikipedia , lookup

Complex polytope wikipedia , lookup

Steinitz's theorem wikipedia , lookup

Compass-and-straightedge construction wikipedia , lookup

Line (geometry) wikipedia , lookup

Transcript
Geometric methods in shape and pattern recognition
Lecture 4: Monday 27-02-2006 13:00-15:00
Prof. dr. H. Alt
Andre Tan
0512338
Assignment 2
a)
Describe an algorithm to determine whether a given point lies inside a given
simple polygon.
Solution 1:
Determine the angle point p makes with all the edges of the polygon and calculate
the sum of all the angles. If the total sum is 360 then the point is inside the
polygon.
This works if we traverse the edges in sorted order and count the angles as
positive if we are moving in counterclockwise direction and negative in clockwise
direction.
Then:
If point p lies within the polygon, the sum of all angles is 360
If point p lies outside the polygon, the sum of all angles is 0
Calculation time would be: O(n)
Solution 2:
Divide the polygon into triangles and use barycentric coordinates to check
whether the point lies inside a triangle.
In short:
Barycentric coordinates use projection of point p on the sides of the triangle.
When the (normalized) length of both projections of point p is smaller then 1 the
point is within the triangle.
Solution 3:
Shoot a ray from point P and count the number of lines it hits. When the number
is uneven, the point was within the polygon. If the number is even, the point lies
outside the polygon.
b)
Show how a convex polygon P can be preprocessed so that for a given point it can
be determined in O(log n) time whether it lies inside the polygon.
Solution :
Preprocessing
Find a line l through two points of P so that equally many vertices (except
possibly one) of P lie on both sides of l.
Label the root of a binary tree T with l and process recursively the two convex
polygons P1 and P2 into which P is split by l making them the left and right
subtrees of T.
Query
Compare the query point q with the line l in the root of T and decide whether it
should be searched for in P1 or in P2. Then search the corresponding subtree
recursively. At the lowest level of the recursion a triangle is left. Check whether it
contains q or not.
Lecture
1.3.3 The Construction of voronoi diagrams (VD)
 Sort the points of S by x-coordinate
 Construct recursively the Voronoi diagrams of S1 (first half) and S2 (second half)
 Construct the bisector between S1 and S2 by beginning with one of the outer
edges and compute the next step per point.
It can be shown that the last step can be done in O(n) time. Therefore, if T(n) is the
runtime for a set S of n points we have:
T(n) = 2T(n/2) + O(n)
T(1) = Constant
The total runtime is therefore: O(n log n)
Example:
Alternative options:
 Apply line sweep O(n log n) (this technique will be discussed in the next lecture)
 Lift the graph into 3 dimensions and compute the convex hull. Then project the
convex hull in 2 dimensions which leaves the lines of the convex hull
representing the edges between the points.
 Randomly add points to the graph and compute the new edges.
1.3.4 Delaunay triangulation (DT)
The Delaunay triangulation is the dual graph (=connect the points which share a common
edge) of the Voronoi diagram (considered as a planar graph) with points of S as vertices.
Properties:
-
If S is in general position, (i.e., no 3 points lie on a line and no 4 points lie on a
circle) then each face is a triangle except the external one.
-
edge pq is an edge of the Delaunay Triangulation (S) <=> there is an empty
circle through p and q (an empty circle is a circle which contains no other points
of S).
-
triangle pqr is a triangle of Delaunay Triangulation (S) <=> the circumcircle of
pqr is empty.
The size of DT(S) is O(n) where n = |s|
1.3.5 Voronoi diagram of a finite set S of line segments
The shortest distance from a line segment to a point p is calculated int two steps:
- First by checking if the point lies between the two lines that are perpendicular to
the line segment and go through the two end points of the line segment. Then the
shortest distance is calculated by using the distance perpendicular to the line
segment which hits the point p.
- Otherwise the distance to the closest endpoint is calculated.
The bisector between two lines consists of their angular bisectors.
The bisector between a point and a line is a parabola.