the design and implementation of planar arrangements of curves in cgal iddo hanniel the research has...

43
The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the supervision of Prof. Dan Halperin January 2001

Post on 19-Dec-2015

215 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

The Design and Implementation of Planar Arrangements of

Curves in CGAL

Iddo Hanniel

The research has been carried out at Tel Aviv University under the supervision of Prof. Dan Halperin

January 2001

Page 2: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

Arrangements of CurvesGiven a collection C of curves in the plane,

the arrangement of C is the subdivision of the plane into vertices edges and faces induced by the curves in C

Page 3: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

Demo 1:

Basic Arrangements Operations

Page 4: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

Arrangements Applications

• Robot Motion Planning

• Geographic Information Systems

• CAD/CAM

• Assembly Planning

• Half-plane range searching, maximal discrepancy of a point set, minimal area triangle

Page 5: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

Previous Arrangement Software

• Arrange - Arrangements of segments and polygons [Goldwasser 95]

• LEDA - Planar maps and intersection algorithms [Melhorn & Naher et. al.]

• MAPC - Manipulation of Algebraic Points and Curves [Manocha et. al. 99]

• CGAL Planar maps package

Page 6: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

Novelties of Our WorkArrangement Software Package:• General• Robust and deals with degeneracies• Flexible and Extensible• Curve Hierarchy Structure• Easy to use

Adaptive Point Location:• Geometric queries on convex parametric curves• Geometric filtering - performing operations on

bounding polygons• Extensible

Page 7: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

A GIS Application

Page 8: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

CGAL - the Computational Geometry Algorithms Library is a collaborative effort of several academic sites in Europe to develop a robust, generic, and efficient C++ library of geometric data structures and algorithms.

The generic programming paradigm was adopted to achieve these goals.

Page 9: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

Planar Maps in CGAL

• Deal with non-intersecting x-monotone curves.

• Use a Doubly Connected Edge List (DCEL) representation.

• Traversal over faces, halfedges and vertices, and traversal over a face and around a vertex.

• Support different curves through a traits mechanism (can be extended by the user).

• Different implementations of point location algorithms (can be extended by the user).

Page 10: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

Geometric TraitsThe traits class is a template parameter that defines the

geometric interface to the class (or function). This enables to use the algorithms with different geometric kernels, and with different types of geometric objects.

Page 11: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

Planar Map Traits

Types:

• Point, X_CurvePredicates and Functions:

Predicates on points, x-monotone curves and on the relationships between them.

For example: checking whether a point is above, below or on a curve.

Page 12: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

Arrangements in CGALBuilt on top of the planar map layer.

Additions over planar maps:

• Intersections

• Non x-monotone curves

• Maintaining the information on the original curves using what we call a curve hierarchy tree

• Support of overlapping curves

• Optional non-update mode

Page 13: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

Operations

Planar map operations:

• Point Location and Vertical Ray Shooting queries

• Traversal of planar map faces, edges and vertices

Arrangement Operations:

• Insertion and deletion of intersecting, non-x-monotone curves

• Tracing edges and subcurves along their original curves

• Overlaps

Page 14: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

Curve nodes

Subcurve nodes

Edge nodes

1

2

34

5

6

7

8

5 6 7 81 2 3 4

Curve Hierarchy Structure

Page 15: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

Arrangement Traits

Additions over planar map traits:

• Curve type

• Functions for detecting non x-monotone curves and splitting them into x-monotone subcurves

• Intersection functions

Page 16: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

Arrangement Classes

Faces

Vertices

Halfedges

Curves

Subcurves

Edges

Traits

Planar map Hierarchy

Page 17: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

Hierarchy ImplementationBase node

curve()set_curve()

Subcurve node

parent()children_begin()children_end()edges_begin()edges_end()

Curve_nodelevel_begin(i)level_end(i)number_of_sc_levels()

Edge_node

halfedge()

In_place_list_node

next ptrprev ptr

begin/end ptr

parent ptr

Page 18: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

Adaptive Point Location

Page 19: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

Demo 2:

Adaptive point location

Page 20: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

Previous WorkNeagu & Lacolle `98 - computing the combinatorial

structure of an arrangement of convex Bezier curves.

Differences of our work:

• Point location.

• Local and adaptive, not global.

• Connectivity is not assumed.

• Heauristic to deal with degeneracies.

• Easily extended framework based on CGAL.

Page 21: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

P0

P1P2

P3

C

Carrier Polygon

Control polygon

Conditions on Curves

Page 22: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

Subdivision of a Convex Curve

P0 P2

P

P11

P1

P01

T(P)

T(P2) T(P0)

Page 23: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

Vertical Ray Shooting - General Idea

Bound the curves by a bounding polygon, and perform all operations on this polygon rather than on the curve itself. If the bounding polygon’s approximation is not sufficient, we refine it by a subdivision process.

Page 24: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

Ray Shooting: Condition 1

The bounding polygon directly above q (i.e., the result of the vertical ray shooting query in the arrangement of bounding polygons) does not intersect any other polygon.

Page 25: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

q

Page 26: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

Intersection Graph

1 2

3

1 2

3

Page 27: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

Ray Shooting: Condition 2

Both control and carrier polygons of the bounding polygon are above the query point q.

Page 28: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

q

Page 29: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

Point Location Outline

• Finding the boundary of a simply connected face– Vertical ray shooting– Extending the edges– Isolating intersections

• Finding the boundary of a face with holes

• Dealing with degeneracies

Page 30: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

Boundary Polygons and Intersection Polygons

Intersection polygon

Boundary polygon

Page 31: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

Implementation

Curve level original curve

nodes edgesSubcurve level

Edge level

halfedges

vertices

faces

Planar map Traits class

Intersection graphHierarchy tree

Page 32: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the
Page 33: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

Adaptive Point Location Experiments

0

1

2

3

4

5

6

7

0 10 20 30 40 50 60

number of queries

seco

nd

s vertical rayshootingpoint location

Page 34: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

Trade-off between Different Initializations

initialization time

0

10

20

30

40

50

60

70

0 10 20 30 40 50 60

number of curves

seco

nds

no subdivisions one subdivision two subdivisions

first point location query time

0

5

10

15

20

25

30

35

40

45

50

0 10 20 30 40 50 60

number of curves

seco

nds

no subdivisions one subdivision two subdivisions

Page 35: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

Canonical Parabolas

Page 36: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

Comparison of 10 Canonical Parabolas

0

5

10

15

20

25

1 9

17

25

33

41

49

57

65

73

81

89

97

query number

se

co

nd

s

Page 37: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

Comparison of 20 Canonical Parabolas

0

50

100

150

200

2501 9

17

25

33

41

49

57

65

73

81

89

97

query number

se

co

nd

s

Page 38: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

Another Application- Boolean Operations

Page 39: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

Boolean Operations

Finding the intersection of N polygons:

Label each face in the arrangement of the polygons with a covering number.

-1-1

-1

0

1

1 2

Page 40: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

Demo 3:

Boolean operations

Page 41: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

Code for covering_DFS

void covering_DFS(Face_handle f) {

Ccb_halfedge_circulator start,circ;

if (f->outer_ccb_exists()) {

start = circ = f->outer_ccb();

do {

Face_handle other_face= circ->twin()->face();

if (other_face->covering_num == -1) {

int diff = face_diff(circ);

other_face->counter = (f->covering_num + diff);

covering_DFS(other_face);

}

} while (++circ != start);

}

Page 42: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

Holes_iterator hit = f->holes_begin();

for(; hit != f->holes_end(); ++hit) {

start = circ = *hit;

do {

Face_handle other_face= circ->twin()->face();

if (other_face->covering_num == -1) {

int diff = face_diff(circ);

other_face->counter = (f->covering_num + diff);

covering_DFS(other_face);

}

} while (++circ != start);

}

}

Page 43: The Design and Implementation of Planar Arrangements of Curves in CGAL Iddo Hanniel The research has been carried out at Tel Aviv University under the

Future Work• Optimization of the arrangement package - improving the

internal algorithms.• Implementing new traits classes (using filtering schemes,

for conic sections) for the arrangement package.• Implementing adaptive point location traits to other

parametric curves.• Packages based on arrangements: generic planar map

overlay, fixed precision approximation of arrangements of segments and polygons.

Websites: www.math.tau.ac.il/~hanniel/ARRG00/

www.math.tau.ac.il/CGAL/