PP Area, buffer, description

advertisement
Area, buffer, description
Area of a polygon, center of mass,
buffer of a polygon / polygonal
line, and descriptive statistics
Area of a polygon
• Polygon without holes
• Polygon with holes
(6,8)
(12,7)
(8,6)
(3,5)
(7,4)
(5,1)
(14,6)
(11,3)
Given: cyclic list
of points with
their coordinates.
Idea: area under edge
(6,8)
(12,7)
(6,8)
(12,7)
Area =
width times average height
= (12 - 6) * (8 + 7)/2 = 45
Area, continued
Edges at “upper side”
give positive contribution
Edges at “lower side” give
negative contribution
Area formula
Area(P) =
(X1 - Xn)(Y1 + Yn)/2 +
n-1
 (Xi+1 - Xi)(Yi + Yi+1)/2
i=1
Assume points given
clockwise
Center of mass of a polygon
• Take arbitrary point p
• Make triangles: each side of the polygon and
point p
• Determine weight (area) and center of mass per
triangle
• Compute weighted average of the centers of mass
p
Counterclockwise triangles:
positive weight; clockwise
triangles: negative weight
Center of mass of a polygon
• Center of mass of weighted points: weighted
average of the x-coordinates and of the ycoordinates
5
-8
11
-12
21
20
Buffer of a polyline
• Buffer = Minkowski sum with a disk
• A polyline gives a polygon with holes
Buffer computation:
divide & conquer
1. Split polyline in two
2. Compute the buffer of
the halves recursively
3. Merge the buffers
to one buffer
Buffer complexity
•
•
•
•
Two non-intersecting line segments S1 and S2
Consider the buffers of S1 and S2
They intersect at most twice
So a set of buffers of non-intersecting line
segments is a set of pseudo-discs
Buffer complexity
Theorem (13.9 of computational geometry book):
Let S be a collection of [polygonal] pseudodiscs
with n edges in total. Then the complexity of their
union is O(n)
Corollary: The buffer of a polygonal line consisting
of n edges (or n+1 points) has complexity O(n)
Merge buffers to one
Assume we merge the buffers of
polylines having m1 and m2 edges
Do an “ordinary” line
sweep over the O(m1)
+ O(m2) segments
and circular arcs of
the buffers
Cost:
O((m1+m2+k) log (m1+m2+k))
time for the merge
How many intersection points?
• In general: m1 and m2 line segments can
intersect m1m2 times, so k  m1m2
• Here: Every intersection point is a vertex of the
buffer after the merge, so of a polyline with
m1+m2 edges
• This new buffer has complexity O(m1+m2)
according to the corollary, so k = O(m1+m2)
• Hence, the merge takes
O((m1+m2) log (m1+m2)) time
The algorithm
• If n >1, split polyline with n edges into two
parts with n/2 edges each
• Compute the buffer of each part recursively
• Merge the buffers of the parts into one using
plane sweep, in O(n log n) time
Recurrence: T(n) = 2 T(n/2) + O(n log n)
Gives T(n) = O(n log2 n) time (e.g. by induction)
Description: measures and use
• Mathematical description  statistics
• Sets of numbers (1-dimensional point set)
• Describe with:
- average
- range [min,max]
- variance, standard deviation
- histogram (by fixed-interval classification)
n
1
 2   ( xi  xmean ) 2
n i 1
Geometric description
• Description of a point, polyline, polygon
- location
- orientation
- size
- shape
• Description of a point set
- clustering
- density
• Description of distance
- two points
- two polygons
- two polylines
• Description of similarity in shape
- two polylines
- two polygons
Description of location
• Description of object as two coordinates (point)
• For a point: trivial
• Center of mass: for polyline or polygon;
can lie outside polygon
• Center of largest inscribed circle:
for polygon
Applications of location
• Symbolizing a city as point object during map
generalization
• Place to put information (name) of polygon
• Preparation for cluster analysis type that only
applies to point (set)
Description of size
• For point: not applicable
• For polyline: length
• For polygon: area or diameter or width
Diameter: largest
distance between two
points in the object
Width: smallest distance
between two parallel lines
that contain the object
Applications of size
• Length polyline for network analysis (shortest
routes)
• Area preservation during map generalisation
• Cartograms
Description of orientation
• For polyline:
- direction of vector
between endpoints
• For polygon:
- direction of diagonal
- direction of parallel lines that define width
- direction of line that minimizes the average
distance of all points in polygon to that line
Description of shape by a
number
• Elongatedness: 1.27 * area / diameter2
• Compactness: 0.32 * area / (radius smallest
enclosing circle)2
• Circularity: 12.6 * area / perimeter2
All between 0 and 1
Application of shape by a
number
• Analysis of voting districts:
when making districts for
voting and representatives,
the areas must have “nice”
shape to group shared
interests of the population
(zoning = making districts)
Description of shape by
skeleton
• Internal skeleton, also: medial axis, or
centerline
• Voronoi diagram of the edges of the polygon
Applications of shape by
skeleton
• Replacement of lakes in a river by a linear object
during map generalisation
• Also: centers of roads, for network analysis
Computation skeleton
• Voronoi diagram of line segments; adaptation of
sweep-line algorithm for Voronoi diagram of
points
• Voronoi edges and vertices outside polygon can
be removed later
• O(n log n) time for polygon with n vertices
• Note: the largest enclosed circle of the polygon
has its center on a Voronoi vertex
Description of shape of polyline
• Also: boundary of polygon
• Sinuosity: total angular change
• Curviness: average change of angle
(per unit of length)
• Number of inflection points
Applications of shape polyline
• Generalisation of a road with hairpin turns, or a
meandering river
• Suitability of a river segment for label placement
along it
simplify
reduce
typify
Description of point sets
• Clustering
• Density
• Examples of point sets to be analyzed
– epicenters of earthquakes
– occurrences of road
accidents in a city
– burglary locations
proportional
symbol map
Description of a point set
• Clustering: even, random, clustered distribution
E.g., compare actual nearest neighbor distance
with nearest neighbor distance of random set
Description of a point set
• Density: scale-dependent, locally defined
point count inside a
square or circle;
size determines the
scale of interest
Example of density
• Population
density
Distance between two objects
• For two arbitrary subsets of the plane: smallest
Euclidean distance
• Average smallest Euclidean distance
Applications of distance
• Smallest distance: overlap when drawing lines
with thickness
• Average distance: part of a measure for cultural
influence received by one area from another
area
Description of similarity
• Hausdorff distance: for any two subsets of the
plane
A
B
Max ( max min dist(a,b) , max min dist(b,a) )
aA bB
AB
bB aA
BA
Description of similarity
• Area of symmetric difference: for polygons
= complement of area of intersection
Application of similarity
• Detection of change between two maps with
same theme but different date
For example:
- land use in Zeeland in 1975 and 2005
- area of lost forest and newly grown forest
• Joint occurrence of two values in different
themes (co-location)
For example, forest type and geological soil type
Computation Hausdorff
distance
• Where can largest distance from A to B occur?
A
A
B
Vertex of A
B
Point internal to edge of A

In this case, the minimum distance
must be attained from that point on
A to two places on B
Computation Hausdorff
distance
• Vertex of A that minimizes distance to B:
- Compute Voronoi diagram of edges of B
- Preprocess for planar point location
- Query with ever vertex of A to find the closest
point to B and the distance to it
A
|A| = n
|B| = m
O(m log m + n log m) time
B
Vertex of A
Computation Hausdorff
distance
Point internal to
edge of A
A
B
Smallest distance to B
attained at two places
• Compute Voronoi diagram of the edges of B
• Compute intersection points of the edges of A
with the Voronoi edges of B
• Compute intersection point on A with
maximum smallest distance to B
Computation Hausdorff
distance
• Worst case: (nm) intersection points
between A and the Voronoi diagram of B,
then O(nm log (nm)) time
• Typical: O(n+m) intersection points, then the
algorithm takes O((n+m) log (n+m)) time
• Inclusive of distance B to A and taking
maximum: O((n+m) log (n+m)) time
Computation area of
symmetric difference
• Perform map overlay (boolean operation) on
the two polygons
• Compute area of symmetric difference of the
polygons and add up
• Worst case: O(nm log (nm)) time
• Typical case: O((n+m) log (n+m)) time
Summary
• There are many possible size and shape
descriptors (measures) for geometric objects
• Different descriptors have different applications;
the options should always be studied
• Computation of some measures/descriptors
requires advanced algorithms
Download