27
Intersection of Nonconvex Polygons Using the A lternate H ierarchical D ecomposition, AHD by Rizwan Bulbul, and Andrew U. Frank Department of Geoinformation and Cartography Vienna University of Technology Vienna, Austria [email protected] AGILE 2010 May 12, 2010

Intersection of Nonconvex Polygons Using the Alternate Hierarchical Decomposition, AHD by Rizwan Bulbul, and Andrew U. Frank Department of Geoinformation

Embed Size (px)

Citation preview

Page 1: Intersection of Nonconvex Polygons Using the Alternate Hierarchical Decomposition, AHD by Rizwan Bulbul, and Andrew U. Frank Department of Geoinformation

Intersection of Nonconvex Polygons Using the Alternate Hierarchical Decomposition, AHD

by

Rizwan Bulbul, and Andrew U. Frank

Department of Geoinformation and Cartography

Vienna University of Technology

Vienna, Austria

[email protected]

AGILE 2010May 12, 2010

Page 2: Intersection of Nonconvex Polygons Using the Alternate Hierarchical Decomposition, AHD by Rizwan Bulbul, and Andrew U. Frank Department of Geoinformation

Representation of Geometry is still DifficultObserve not what we can do, but what

application problems are not yet approached:3D geometryGeometry with Movement

Page 3: Intersection of Nonconvex Polygons Using the Alternate Hierarchical Decomposition, AHD by Rizwan Bulbul, and Andrew U. Frank Department of Geoinformation

Regular Geometry needs Real NumbersComputers do REALs, which are approximations

only:a/b * b <> a <> (a*b)/b

Example problems: Test for point in polygon depends on order.Topology becomes not invariant under rotation!

Page 4: Intersection of Nonconvex Polygons Using the Alternate Hierarchical Decomposition, AHD by Rizwan Bulbul, and Andrew U. Frank Department of Geoinformation

Current solution (theoretically correct):• Approximate coordinates with REALs• Explicit representation of topologyAvoid testing the same property twice, because it

could produce inconsistencies.

Theory of simplicial complex; base of ISO standard (OGC simple features)

Page 5: Intersection of Nonconvex Polygons Using the Alternate Hierarchical Decomposition, AHD by Rizwan Bulbul, and Andrew U. Frank Department of Geoinformation

Practice

Subdivision in simplices produces too much data.Usually, the current 2D algorithm work ok using

double precision REALs.

No solution for 3D, 2D + time, 3D + time...

Page 6: Intersection of Nonconvex Polygons Using the Alternate Hierarchical Decomposition, AHD by Rizwan Bulbul, and Andrew U. Frank Department of Geoinformation

New Approach (after 20 years!):• Approximation → big rationals • Subdivisions in triangles → convex polytopes as

base geometric element

Big rationals: rationals (exactly homogenous coordinates) represented with big integers (i.e. integers which grow in size, limited only by size of memory)

Page 7: Intersection of Nonconvex Polygons Using the Alternate Hierarchical Decomposition, AHD by Rizwan Bulbul, and Andrew U. Frank Department of Geoinformation

Big Rationals

Precise representation of straight line geometry.a/b * b = a(still not invariant under rotation)

Contrary to (old) published reports, comparable speed to DOUBLE up to 100 digits length.

Page 8: Intersection of Nonconvex Polygons Using the Alternate Hierarchical Decomposition, AHD by Rizwan Bulbul, and Andrew U. Frank Department of Geoinformation

Convex polytopes

Fundamental geometric operations on geometric figures:

• Intersection• Union• Intersection of convex polytope is convex!• Union – Intersection are dual!

Page 9: Intersection of Nonconvex Polygons Using the Alternate Hierarchical Decomposition, AHD by Rizwan Bulbul, and Andrew U. Frank Department of Geoinformation

Representation of Convex Polytopes • Represented as collection of points (in any

dimension)• Other representations (e.g. faces, edges) follow

with convex hull algorithm (efficient, well known)

Algorithm for n-D (using category theory and functional programming language)

Page 10: Intersection of Nonconvex Polygons Using the Alternate Hierarchical Decomposition, AHD by Rizwan Bulbul, and Andrew U. Frank Department of Geoinformation

Not all objects are convex!

Geometries with holes, non-convex figures:Take convex hull. Too much: subtract convex hull of what is too

much. Too little now: add convex hull of what has

been subtracted too much...

Page 11: Intersection of Nonconvex Polygons Using the Alternate Hierarchical Decomposition, AHD by Rizwan Bulbul, and Andrew U. Frank Department of Geoinformation

Level of detail (LoD) Representation

Representation can be used for a gradual (level of detail) rendering:

• Stop when enough detail is found.

Page 12: Intersection of Nonconvex Polygons Using the Alternate Hierarchical Decomposition, AHD by Rizwan Bulbul, and Andrew U. Frank Department of Geoinformation

INTRODUCTION

Intersection computation – a fundamental operation

Given two polygons (convex/nonconvex, with or without holes) compute the intersection region;

Intersection Problem Intersection computation Intersection detection

12/17

INTRODUCTION AHD ASSUMPTIONS SPECIAL CASESOUR APPROACH CONCLUSION REFERENCES

Page 13: Intersection of Nonconvex Polygons Using the Alternate Hierarchical Decomposition, AHD by Rizwan Bulbul, and Andrew U. Frank Department of Geoinformation

AHDAlternate Hierarchical Decomposition

Approach

Recursive

Convex hull tree, CHT

Dimension Independence

Convex hull computation Use any existing algorithm

Delta region extraction Symmetric difference Split connected regions

13/17

INTRODUCTION AHD ASSUMPTIONS SPECIAL CASESOUR APPROACH CONCLUSION REFERENCES

Page 14: Intersection of Nonconvex Polygons Using the Alternate Hierarchical Decomposition, AHD by Rizwan Bulbul, and Andrew U. Frank Department of Geoinformation

AHDAlternate Hierarchical Decomposition- Example

HoleConvex Hull Tree, CHT

14/17

INTRODUCTION AHD ASSUMPTIONS SPECIAL CASESOUR APPROACH CONCLUSION REFERENCES

Page 15: Intersection of Nonconvex Polygons Using the Alternate Hierarchical Decomposition, AHD by Rizwan Bulbul, and Andrew U. Frank Department of Geoinformation

INTERSECTIONAssumptions

Simple

Intersection detection – not addressed

May contain holes or nested holes

“Left handed rule” for edge representations – counterclockwise orientation

Demonstrated here for a pair of polygons- extendible for multiple polygons

Flat objects

15/17

INTRODUCTION AHD ASSUMPTIONS SPECIAL CASESOUR APPROACH CONCLUSION REFERENCES

Page 16: Intersection of Nonconvex Polygons Using the Alternate Hierarchical Decomposition, AHD by Rizwan Bulbul, and Andrew U. Frank Department of Geoinformation

INTERSECTIONOur Approach

16/17

INTRODUCTION AHD ASSUMPTIONS SPECIAL CASESOUR APPROACH CONCLUSION REFERENCES

Page 17: Intersection of Nonconvex Polygons Using the Alternate Hierarchical Decomposition, AHD by Rizwan Bulbul, and Andrew U. Frank Department of Geoinformation

INTERSECTIONConvex Convex

17/17

INTRODUCTION AHD ASSUMPTIONS SPECIAL CASESOUR APPROACH CONCLUSION REFERENCES

Page 18: Intersection of Nonconvex Polygons Using the Alternate Hierarchical Decomposition, AHD by Rizwan Bulbul, and Andrew U. Frank Department of Geoinformation

INTERSECTIONConvex-convex : Algorithm

18/17

INTRODUCTION AHD ASSUMPTIONS SPECIAL CASESOUR APPROACH CONCLUSION REFERENCES

Page 19: Intersection of Nonconvex Polygons Using the Alternate Hierarchical Decomposition, AHD by Rizwan Bulbul, and Andrew U. Frank Department of Geoinformation

INTERSECTIONConvex Nonconvex

a1 b1

a1 b2

19/17

INTRODUCTION AHD ASSUMPTIONS SPECIAL CASESOUR APPROACH CONCLUSION REFERENCES

Page 20: Intersection of Nonconvex Polygons Using the Alternate Hierarchical Decomposition, AHD by Rizwan Bulbul, and Andrew U. Frank Department of Geoinformation

INTERSECTIONConvex-nonconvex: Algorithm

20/17

INTRODUCTION AHD ASSUMPTIONS SPECIAL CASESOUR APPROACH CONCLUSION REFERENCES

Page 21: Intersection of Nonconvex Polygons Using the Alternate Hierarchical Decomposition, AHD by Rizwan Bulbul, and Andrew U. Frank Department of Geoinformation

INTERSECTIONNonconvex Nonconvex

21/17

INTRODUCTION AHD ASSUMPTIONS SPECIAL CASESOUR APPROACH CONCLUSION REFERENCES

Page 22: Intersection of Nonconvex Polygons Using the Alternate Hierarchical Decomposition, AHD by Rizwan Bulbul, and Andrew U. Frank Department of Geoinformation

INTERSECTIONGeneric Intersection - Algorithm

22/17

INTRODUCTION AHD ASSUMPTIONS SPECIAL CASESOUR APPROACH CONCLUSION REFERENCES

Page 23: Intersection of Nonconvex Polygons Using the Alternate Hierarchical Decomposition, AHD by Rizwan Bulbul, and Andrew U. Frank Department of Geoinformation

INTERSECTIONOur Approach - Example

r1

r2

23/17

INTRODUCTION AHD ASSUMPTIONS SPECIAL CASESOUR APPROACH CONCLUSION REFERENCES

Page 24: Intersection of Nonconvex Polygons Using the Alternate Hierarchical Decomposition, AHD by Rizwan Bulbul, and Andrew U. Frank Department of Geoinformation

INTERSECTIONOur Approach - Example

Result: set of disjoint regions

24/17

INTRODUCTION AHD ASSUMPTIONS SPECIAL CASESOUR APPROACH CONCLUSION REFERENCES

Page 25: Intersection of Nonconvex Polygons Using the Alternate Hierarchical Decomposition, AHD by Rizwan Bulbul, and Andrew U. Frank Department of Geoinformation

INTERSECTIONSpecial Cases

Case Specially treated?

Complete overlap No

One is inside other No

Edges overlap No

Points overlap No

Intersection is a line Yes

Intersection is a point Yes

25/17

INTRODUCTION AHD ASSUMPTIONS SPECIAL CASESOUR APPROACH CONCLUSION REFERENCES

Page 26: Intersection of Nonconvex Polygons Using the Alternate Hierarchical Decomposition, AHD by Rizwan Bulbul, and Andrew U. Frank Department of Geoinformation

INTERSECTIONConclusion

Based on basic intersection operation between two convex hulls

Improvements and Future Work Multiple polygons Non simple polygons

Other Boolean operations – Union, Symmetric difference, Point in a polygon City modelling

26/17

Dimension independent

Ease of implementation – Haskell

Numerical robustness

Hierarchical tree data structure, CHT

CHT allows reduced number of computations

Deals most special cases

Useful for applications where decomposed output is needed

INTRODUCTION AHD ASSUMPTIONS SPECIAL CASESOUR APPROACH CONCLUSION REFERENCES

Page 27: Intersection of Nonconvex Polygons Using the Alternate Hierarchical Decomposition, AHD by Rizwan Bulbul, and Andrew U. Frank Department of Geoinformation

INTERSECTIONReferences

Chazelle, B. and D. P. Dobkin. 1987. "Intersection of convex objects in two and three dimensions." Journal of the ACM (JACM) 34(1):1-27.

David, M. Mount. 1997. "Geometric intersection." In Handbook of discrete and computational geometry: CRC Press, Inc.

Bulbul, Rizwan and Andrew U. Frank. 2009. "AHD: The Alternate Hierarchical Decomposition of Nonconvex Polytopes (Generalization of a Convex Polytope Based Spatial Data Model)." In 17th International Conference on Geoinformatics. Fairfax, USA.

Shamos, Michael Ian and Dan Hoey. 1976. "Geometric intersection problems." In Proceedings of the 17th Annual Symposium on Foundations of Computer Science: IEEE Computer Society.

O'Rourke, Joseph. 1998. Computational Geometry in C (Cambridge Tracts in Theoretical Computer Science): Cambridge University Press.

Jones, Simon. 2003. Haskell 98 Language and Libraries: The Revised Report: {Cambridge University Press}.

Bulbul, Rizwan, Farid Karimipour and Andrew Frank. 2009. "A Simplex based Dimension Independent Approach for Convex Decomposition of Nonconvex polytopes." In 10th lnternational Conference on GeoComputation (GeoComputation 2009). UNSW, Sydney, Australia.

Vatti, Bala R. 1992. "A Generic Solution to Polygon Clipping." Communications of the ACM 35(7):57-63.

27/17

INTRODUCTION AHD ASSUMPTIONS SPECIAL CASESOUR APPROACH CONCLUSION REFERENCES