area, buffer, description area of a polygon, center of mass, buffer of a polygon / polygonal line,...
Post on 22-Dec-2015
229 views
TRANSCRIPT
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
(5,1)(11,3)
(14,6)
(7,4)
(6,8)(12,7)
(8,6)(3,5)
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
Assume points given clockwise
Area(P) =
(X1 - Xn)(Y1 + Yn)/2 +
(Xi+1 - Xi)(Yi + Yi+1)/2 i=1
n-1
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
Counterclockwise triangles:positive weight; clockwise triangles: negative weight
p
Center of mass of a polygon
• Center of mass of weighted points: weighted average of the x-coordinates and of the y-coordinates
20
2111
-12-8
5
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 buffersto 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)
Assume we merge the buffers of polylines having m1 and m2 edges
Do an “ordinary” linesweep over the O(m1)+ O(m2) segmentsand circular arcs ofthe buffers
Cost:O((m1+m2+k) log (m1+m2+k))time for the merge
Merge buffers to one
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 takesO((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)
2
1
2 )(1
mean
n
ii xx
n
Geometric description
• Description of a point, polyline, polygon- location - size- orientation - shape
• Description of a point set- clustering - density
• Description of distance- two points - two polylines- two polygons
• 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
reduce
simplify
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
Max ( max min dist(a,b) , max min dist(b,a) )aA bBbB aA
A
B
A B 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
B
A
B
Vertex of A 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
B
Vertex of A
|A| = n
|B| = mO(m log m + n log m) time
• 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
A
B
Point internal toedge of A
Smallest distance to B attained at two places
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