Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999)...

99
Computational Geometry Algorithms Library www.cgal.org Nonique Ueillaud Jntroduction to DHBM - september 2004

Transcript of Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999)...

Page 1: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Computational Geometry Algorithms Library

www.cgal.org

Monique Teillaud

Introduction to CGAL - september 2004

Page 2: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Overview

• The CGAL Open Source Project

• Structure of CGAL

• The Kernel

• Numerical Robustness

• Contents of the Basic Library

• Flexibility

• Work in Progress

Introduction to CGAL - september 2004 1

Page 3: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

The Open Source Project

2

Page 4: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Goals

• Promote the research in Computational Geometry (CG)

• “make the large body of geometric algorithms developed in the field of CGavailable for industrial applications”

⇒ robust programs

Page 5: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Goals

• Promote the research in Computational Geometry (CG)

• “make the large body of geometric algorithms developed in the field of CGavailable for industrial applications”

⇒ robust programs

CG Impact Task Force Report, 1996

Among the key recommendations:

• Production and distribution of usable (and useful) geometric codes

• Reward structure for implementations in academia

Introduction to CGAL - september 2004 3

Page 6: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

History

Development started 1995

Consortium of 8 European sites

RISC LinzUtrecht University (XYZ Geobench)INRIA Sophia Antipolis (C++GAL)ETH Zurich (Plageo)MPI Saarbrucken (LEDA)Tel Aviv UniversityFreie Universitat Berlin

Martin-Luther-Universitat Halle

Introduction to CGAL - september 2004 4

Page 7: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

• Two Esprit LTR European Projects (1996-1999)

• Work continued after the end of European support in several sites.

Page 8: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

• Two Esprit LTR European Projects (1996-1999)

• Work continued after the end of European support in several sites.

• January, 2003: creation of Geometry Factory

INRIAstartupsells commercial licenses, support, customized developments

Page 9: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

• Two Esprit LTR European Projects (1996-1999)

• Work continued after the end of European support in several sites.

• January, 2003: creation of Geometry Factory

INRIAstartupsells commercial licenses, support, customized developments

• November, 2003:

Release 3.0Open Source Project

Introduction to CGAL - september 2004 5

Page 10: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

License

• kernel under LGPL

• basic library under QPL◦ free use for OS code◦ commercial license needed otherwise

Page 11: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

License

• kernel under LGPL

• basic library under QPL◦ free use for OS code◦ commercial license needed otherwise

• A guarantee for CGAL users

• Allows CGAL to become a standard

• Opens CGAL for new contributions

Introduction to CGAL - september 2004 6

Page 12: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

in numbers

• 350.000 lines of C++ code

• ∼2000 pages manual

Page 13: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

in numbers

• 350.000 lines of C++ code

• ∼2000 pages manual

• release cycle of ∼12 months

• CGAL 2.4: 9300 downloads (18 months)• CGAL 3.0.1: 6200 downloads (8 months)

Page 14: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

in numbers

• 350.000 lines of C++ code

• ∼2000 pages manual

• release cycle of ∼12 months

• CGAL 2.4: 9300 downloads (18 months)• CGAL 3.0.1: 6200 downloads (8 months)

• 4000 subscribers to the announcement list (7000 for gcc)

• 800 users registered on discussion list (600 in gcc-help)

• 50 developers registered on developer list

Introduction to CGAL - september 2004 7

Page 15: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Supported platforms

• Linux, Irix, Solaris, Windows• Mac OS X (3.1)

• g++, SGI CC, SunProCC, VC7, Intel

Introduction to CGAL - september 2004 8

Page 16: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Development process

Editorial Board created in 2001.

• responsible for the quality of CGAL

New packages are reviewed.

→ helps authors to get credit for their work.

Page 17: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Development process

Editorial Board created in 2001.

• responsible for the quality of CGAL

New packages are reviewed.

→ helps authors to get credit for their work.

• decides about technical matters

• coordinates communication and promotion

• ...

Introduction to CGAL - september 2004 9

Page 18: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Andreas Fabri (Geometry Factory)Efi Fogel (Tel Aviv University)Bernd Gartner (ETH Zurich)Michael Hoffmann (ETH Zurich)Menelaos Karavelas (University of Notre Dame, USA → Greece)Lutz Kettner (Max-Planck-Institut fur Informatik)Sylvain Pion (INRIA Sophia Antipolis)Monique Teillaud (INRIA Sophia Antipolis)Remco Veltkamp (Utrecht University)Mariette Yvinec (INRIA Sophia Antipolis)

Introduction to CGAL - september 2004 10

Page 19: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Tools

• Own manual tools: LATEX −→ ps, pdf, html

• CVS server for version management

Page 20: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Tools

• Own manual tools: LATEX −→ ps, pdf, html

• CVS server for version management

• Developer manual

• mailing list for developers

• 1-2 developers meetings per year, 1 week long

Page 21: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Tools

• Own manual tools: LATEX −→ ps, pdf, html

• CVS server for version management

• Developer manual

• mailing list for developers

• 1-2 developers meetings per year, 1 week long

• 3 internal releases per week(1 per day before release)

• Automatic test suites running on all supported compilers/platforms

Introduction to CGAL - september 2004 11

Page 22: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Credit

Contributors keep their identity

Page 23: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Credit

Contributors keep their identity

• up to 3.0.1: names of authors mentioned in the Preface

• 3.1 (soon) Names of authors appear at the beginning of each chapter.Section on history of the package at the end of each chapter

• CGAL developers listed on the “People” web page

Page 24: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Credit

Contributors keep their identity

• up to 3.0.1: names of authors mentioned in the Preface

• 3.1 (soon) Names of authors appear at the beginning of each chapter.Section on history of the package at the end of each chapter

• CGAL developers listed on the “People” web page

• Authors publish papers (conferences, journals) on their packages

Page 25: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Credit

Contributors keep their identity

• up to 3.0.1: names of authors mentioned in the Preface

• 3.1 (soon) Names of authors appear at the beginning of each chapter.Section on history of the package at the end of each chapter

• CGAL developers listed on the “People” web page

• Authors publish papers (conferences, journals) on their packages

• Copyright kept by the institution of the authors

Introduction to CGAL - september 2004 12

Page 26: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Introduction to CGAL - september 2004 13

Page 27: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Users

Projects using CGAL

Leonidas J. Guibas’ and co-workers, Stanford University.

Tamal K. Dey’s and co-workers, The Ohio State University.

Nina Amenta and co-workers, The University of Texas at Austin.

Xiangmin Jiao, University of Illinois at Urbana-Champaign.(Surface Mesh Overlay)

Peter Coveney and co-workers, University of London.

. . .

Page 28: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Users

Projects using CGAL

Leonidas J. Guibas’ and co-workers, Stanford University.

Tamal K. Dey’s and co-workers, The Ohio State University.

Nina Amenta and co-workers, The University of Texas at Austin.

Xiangmin Jiao, University of Illinois at Urbana-Champaign.(Surface Mesh Overlay)

Peter Coveney and co-workers, University of London.

. . .

Teaching

• Leo Guibas, Siu Wing Cheng, . . .

Introduction to CGAL - september 2004 14

Page 29: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Commercial customers of Geometry Factory

Introduction to CGAL - september 2004 15

Page 30: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Structure of

16

Page 31: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Basic Library

Algorithms and Data Structures

Kernel

Geometric objectsGeometric operations

core library

configurations, assertions, . . .

Visualization

File

I/O

NumberTypes

Generators

. . .

Support

Library

Introduction to CGAL - september 2004 17

Page 32: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

The Kernel

18

Page 33: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

In the kernel

Elementary geometric objects

Elementary computations on them

Primitives Predicates Constructions2D, 3D, dD • comparison • intersection• Point • Orientation • squared distance• Vector • InSphere . . .• Triangle . . .• Iso rectangle• Circle. . .

Introduction to CGAL - september 2004 19

Page 34: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Affine geometry

Point - Origin → VectorPoint - Point → VectorPoint + Vector → Point

Point Vector

Origin

Page 35: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Affine geometry

Point - Origin → VectorPoint - Point → VectorPoint + Vector → Point

Point Vector

Origin

Point + Point illegal

Page 36: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Affine geometry

Point - Origin → VectorPoint - Point → VectorPoint + Vector → Point

Point Vector

Origin

Point + Point illegal

midpoint(a,b) = a + 1/2 x (b-a)

Introduction to CGAL - september 2004 20

Page 37: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Kernels and Number Types

Cartesian representation

Point∣∣∣∣ x = hx

hw

y = hyhw

Homogeneous representation

Point

∣∣∣∣∣ hxhyhw

Page 38: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Kernels and Number Types

Cartesian representation

Point∣∣∣∣ x = hx

hw

y = hyhw

Homogeneous representation

Point

∣∣∣∣∣ hxhyhw

Intersection of two lines{a1x + b1y + c1 = 0a2x + b2y + c2 = 0

(x, y) =

∣∣∣∣∣ b1 c1

b2 c2

∣∣∣∣∣∣∣∣∣∣ a1 b1

a2 b2

∣∣∣∣∣,−

∣∣∣∣∣ a1 c1

a2 c2

∣∣∣∣∣∣∣∣∣∣ a1 b1

a2 b2

∣∣∣∣∣

{a1hx + b1hy + c1hw = 0a2hx + b2hy + c2hw = 0

(hx, hy, hw) =(∣∣∣∣ b1 c1

b2 c2

∣∣∣∣ ,− ∣∣∣∣ a1 c1

a2 c2

∣∣∣∣ , ∣∣∣∣ a1 b1

a2 b2

∣∣∣∣)

Page 39: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Kernels and Number Types

Cartesian representation

Point∣∣∣∣ x = hx

hw

y = hyhw

Homogeneous representation

Point

∣∣∣∣∣ hxhyhw

Intersection of two lines{a1x + b1y + c1 = 0a2x + b2y + c2 = 0

(x, y) =

∣∣∣∣∣ b1 c1

b2 c2

∣∣∣∣∣∣∣∣∣∣ a1 b1

a2 b2

∣∣∣∣∣,−

∣∣∣∣∣ a1 c1

a2 c2

∣∣∣∣∣∣∣∣∣∣ a1 b1

a2 b2

∣∣∣∣∣

{a1hx + b1hy + c1hw = 0a2hx + b2hy + c2hw = 0

(hx, hy, hw) =(∣∣∣∣ b1 c1

b2 c2

∣∣∣∣ ,− ∣∣∣∣ a1 c1

a2 c2

∣∣∣∣ , ∣∣∣∣ a1 b1

a2 b2

∣∣∣∣)

Field operations Ring operations

Introduction to CGAL - september 2004 21

Page 40: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

C++ Templates

CGAL::Cartesian< FT > (CGAL::Simple Cartesian)CGAL::Homogeneous< RT > (CGAL::Simple Homogeneous)

Page 41: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

C++ Templates

CGAL::Cartesian< FT > (CGAL::Simple Cartesian)CGAL::Homogeneous< RT > (CGAL::Simple Homogeneous)

Cartesian Kernels : Field type

double

Quotient<Gmpz>

leda real

Homogeneous Kernels : Ring type

int

Gmpz

double

Page 42: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

C++ Templates

CGAL::Cartesian< FT > (CGAL::Simple Cartesian)CGAL::Homogeneous< RT > (CGAL::Simple Homogeneous)

Cartesian Kernels : Field type

double

Quotient<Gmpz>

leda real

Homogeneous Kernels : Ring type

int

Gmpz

double

−→ Flexibility

typedef double NumberType;typedef Cartesian< NumberType > Kernel;typedef Kernel::Point 2 Point;

Introduction to CGAL - september 2004 22

Page 43: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Numerical Issues

typedef CGAL::Cartesian<NT> Kernel;NT sqrt2 = sqrt( NT(2) );

Kernel::Point 2 p(0,0), q(sqrt2,sqrt2);Kernel::Circle 2 C(p,2);

assert( C.has on boundary(q) );

OK if NT gives exact sqrtassertion violation otherwise

Introduction to CGAL - september 2004 23

Page 44: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Orientation of 2D points

p

q

r

orientation(p, q, r) = sign

(det

[px py 1qx qy 1rx ry 1

])= sign((qx − px)(ry − py)− (qy − py)(rx − px))

Introduction to CGAL - september 2004 24

Page 45: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

p = (0.5 + x.u, 0.5 + y.u)0 ≤ x, y < 256, u = 2−53

q = (12, 12)r = (24, 24)

Page 46: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

p = (0.5 + x.u, 0.5 + y.u)0 ≤ x, y < 256, u = 2−53

q = (12, 12)r = (24, 24)

orientation(p, q, r)evaluated with double

Page 47: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

p = (0.5 + x.u, 0.5 + y.u)0 ≤ x, y < 256, u = 2−53

q = (12, 12)r = (24, 24)

orientation(p, q, r)evaluated with double

256 x 256 pixel image

> 0 , = 0 , < 0

Page 48: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

p = (0.5 + x.u, 0.5 + y.u)0 ≤ x, y < 256, u = 2−53

q = (12, 12)r = (24, 24)

orientation(p, q, r)evaluated with double

256 x 256 pixel image

> 0 , = 0 , < 0

−→ inconsistencies in predicate evaluations

[Kettner, Mehlhorn, Pion, Schirra, Yap, ESA’04]

Introduction to CGAL - september 2004 25

Page 49: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Numerical Robustness in

26

Page 50: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

imprecise numerical evaluations−→ non-robustness

combinatorial result

Page 51: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

imprecise numerical evaluations−→ non-robustness

combinatorial result

Exact Geometric Computation

Page 52: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

imprecise numerical evaluations−→ non-robustness

combinatorial result

Exact Geometric Computation

6=exact arithmetics

Introduction to CGAL - september 2004 27

Page 53: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Predicates and Constructions

Predicates

> 0< 0 = 0

Combinatorial

Structure

Input

Constructions

Geometric

embedding

Introduction to CGAL - september 2004 28

Page 54: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Delaunay triangulation

only predicates are usedorientation, in sphere

Page 55: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Delaunay triangulation

only predicates are usedorientation, in sphere

Voronoi diagram

constructions are neededcircumcenter

Introduction to CGAL - september 2004 29

Page 56: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Arithmetic tools

• Multiprecision integersExact evaluation of signs / values of polynomial expressions with integercoefficientsCGAL::MP Float, GMP::mpz t, LEDA::integer, ...

Page 57: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Arithmetic tools

• Multiprecision integersExact evaluation of signs / values of polynomial expressions with integercoefficientsCGAL::MP Float, GMP::mpz t, LEDA::integer, ...

• Multiprecision floatsidem, with float coefficients (n2m, n,m ∈ Z)CGAL::MP Float, GMP::mpf t, LEDA::bigfloat, ...

Page 58: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Arithmetic tools

• Multiprecision integersExact evaluation of signs / values of polynomial expressions with integercoefficientsCGAL::MP Float, GMP::mpz t, LEDA::integer, ...

• Multiprecision floatsidem, with float coefficients (n2m, n,m ∈ Z)CGAL::MP Float, GMP::mpf t, LEDA::bigfloat, ...

• Multiprecision rationalsExact evaluation of signs / values of rational expressionsCGAL::Quotient< · >, GMP::mpq t, LEDA::rational, ...

Page 59: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Arithmetic tools

• Multiprecision integersExact evaluation of signs / values of polynomial expressions with integercoefficientsCGAL::MP Float, GMP::mpz t, LEDA::integer, ...

• Multiprecision floatsidem, with float coefficients (n2m, n,m ∈ Z)CGAL::MP Float, GMP::mpf t, LEDA::bigfloat, ...

• Multiprecision rationalsExact evaluation of signs / values of rational expressionsCGAL::Quotient< · >, GMP::mpq t, LEDA::rational, ...

• Algebraic numbersExact comparison of roots of polynomialsLEDA::real, Core::Expr (work in progress in CGAL)

Introduction to CGAL - september 2004 30

Page 60: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Filtering Predicates

sign (P (x)) ?

y n

Approximate evaluation P a(x)+ Error ε

|P a(x)| > ε?

sign (P (x)) = sign (P a(x)) Exact computation

Introduction to CGAL - september 2004 31

Page 61: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Static filtering

Error bound precomputed faster

Page 62: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Static filtering

Error bound precomputed faster

Dynamic filtering

Interval arithmetic more precise

Number types: CGAL::Interval nt, MPFR/MPFI, boost::interval

Page 63: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Static filtering

Error bound precomputed faster

Dynamic filtering

Interval arithmetic more precise

Number types: CGAL::Interval nt, MPFR/MPFI, boost::interval

CGAL::Filtered kernel < K > kernel wrapper [Pion]

Replaces predicates of K by filtered and exact predicates.( exact predicates computed with MP Float )

Page 64: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Static filtering

Error bound precomputed faster

Dynamic filtering

Interval arithmetic more precise

Number types: CGAL::Interval nt, MPFR/MPFI, boost::interval

CGAL::Filtered kernel < K > kernel wrapper [Pion]

Replaces predicates of K by filtered and exact predicates.( exact predicates computed with MP Float )

Dynamic only in CGAL 3.0 (Static filters exist but undocumented)Static + Dynamic in CGAL 3.1

−→ more generic generator also available for user’s predicates

Introduction to CGAL - september 2004 32

Page 65: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Filtering Constructions

Number type CGAL::Lazy exact nt < Exact NT > [Pion]

Delays exact evaluation with Exact NT:

• stores a DAG of the expression

• computes first an approximation with Interval nt

• allows to control the relative precision of to double

Page 66: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Filtering Constructions

Number type CGAL::Lazy exact nt < Exact NT > [Pion]

Delays exact evaluation with Exact NT:

• stores a DAG of the expression

• computes first an approximation with Interval nt

• allows to control the relative precision of to double

CGAL::Lazy kernel in progress

Introduction to CGAL - september 2004 33

Page 67: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Predefined kernels

Exact predicates exact constructions kernelFiltered kernel< Cartesian< Lazy exact nt< Quotient< MP Float >>>>

Exact predicates exact constructions kernel with sqrtFiltered kernel< Cartesian< Core::Expr >>

Exact predicates inexact constructions kernelFiltered kernel< Cartesian< double >>

Introduction to CGAL - september 2004 34

Page 68: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Efficiency

3D Delaunay triangulationCGAL-3.1-I-124

Pentium-M 1.7 GHz, 1GBg++ 3.3.2, -O2 -DNDEBUG

1.000.000 random pointsSimple Cartesian< double > 48.1 secSimple Cartesian< MP Float > 2980.2 secFiltered kernel (dynamic filtering) 232.1 secFiltered kernel (static + dynamic filtering) 58.4 sec

Page 69: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Efficiency

3D Delaunay triangulationCGAL-3.1-I-124

Pentium-M 1.7 GHz, 1GBg++ 3.3.2, -O2 -DNDEBUG

1.000.000 random pointsSimple Cartesian< double > 48.1 secSimple Cartesian< MP Float > 2980.2 secFiltered kernel (dynamic filtering) 232.1 secFiltered kernel (static + dynamic filtering) 58.4 sec

49.787 points (Dassault Systemes)double loop !exact and filtered < 8 sec

Introduction to CGAL - september 2004 35

Page 70: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Robustness of Delaunay triangulations

Kernel and arithmetics −→ Numerical robustness

Page 71: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Robustness of Delaunay triangulations

Kernel and arithmetics −→ Numerical robustness

Algorithms −→ explicit treatment of degenerate cases

Symbolic perturbation for 3D dynamic Delaunay triangulations[Devillers Teillaud SODA’03]

Introduction to CGAL - september 2004 36

Page 72: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Contents ofthe Basic Library

37

Page 73: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Convex Hull

[MPI]

• 5 different algorithms in 2D

• 3 different algorithms in 3D

Introduction to CGAL - september 2004 38

Page 74: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Triangulations and related

[INRIA]

• 2D/3D Triangle/Tetrahedron baseddata-structure

Page 75: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Triangulations and related

[INRIA]

• 2D/3D Triangle/Tetrahedron baseddata-structure

• Fully dynamic 2D/3D Delaunay triangulationDelaunay hierarchy [Devillers ’98 ’02]

• 2D/3D Regular Triangulations(3D: dynamic in 3.1)

• 2D Constrained Delaunay Triangulation

Page 76: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Triangulations and related

[INRIA]

• 2D/3D Triangle/Tetrahedron baseddata-structure

• Fully dynamic 2D/3D Delaunay triangulationDelaunay hierarchy [Devillers ’98 ’02]

• 2D/3D Regular Triangulations(3D: dynamic in 3.1)

• 2D Constrained Delaunay Triangulation

• 2D Apollonius diagram• 2D Segment Voronoi Diagram

(3.1 [Karavelas])• 2D Meshes (3.1)

Page 77: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Triangulations and related

[INRIA]

• 2D/3D Triangle/Tetrahedron baseddata-structure

• Fully dynamic 2D/3D Delaunay triangulationDelaunay hierarchy [Devillers ’98 ’02]

• 2D/3D Regular Triangulations(3D: dynamic in 3.1)

• 2D Constrained Delaunay Triangulation

• 2D Apollonius diagram• 2D Segment Voronoi Diagram

(3.1 [Karavelas])• 2D Meshes (3.1)

Introduction to CGAL - september 2004 39

Page 78: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Polyhedra

[MPI]

• Half-edge data-structure

Page 79: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Polyhedra

[MPI]

• Half-edge data-structure

• Polyhedral surface(orientable 2-manifold with boundary)

Page 80: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Polyhedra

[MPI]

• Half-edge data-structure

• Polyhedral surface(orientable 2-manifold with boundary)

• 2D Nef polygons• 3D Nef polyhedra (3.1)

Introduction to CGAL - september 2004 40

Page 81: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Geometric Optimization

[ETH]

• Smallest enclosing circle and ellipse in 2D• Smallest enclosing sphere in dD• Largest empty rectangle• . . .

Introduction to CGAL - september 2004 41

Page 82: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Arrangements

[Tel-Aviv]

• Line segments or polylines

• Conic arcs with Leda or Core

Introduction to CGAL - september 2004 42

Page 83: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Search Structures

Arbitrary dimension

• Range-tree, Segment-tree, kD-tree

• Window query

• Approximate nearest neighbors

• . . .

Introduction to CGAL - september 2004 43

Page 84: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Flexibility in the BasicLibrary

44

Page 85: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

“Traits” classes

convex hull 2<InputIterator, OutputIterator, Traits>Polygon 2<Traits, Container>Polyhedron 3<Traits, HDS>Triangulation 3<Traits, TDS>Min circle 2<Traits>Range tree k<Traits>. . .

Page 86: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

“Traits” classes

convex hull 2<InputIterator, OutputIterator, Traits>Polygon 2<Traits, Container>Polyhedron 3<Traits, HDS>Triangulation 3<Traits, TDS>Min circle 2<Traits>Range tree k<Traits>. . .

Geometric traits classes provide:Geometric objects + predicates + constructors

Page 87: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

“Traits” classes

convex hull 2<InputIterator, OutputIterator, Traits>Polygon 2<Traits, Container>Polyhedron 3<Traits, HDS>Triangulation 3<Traits, TDS>Min circle 2<Traits>Range tree k<Traits>. . .

Geometric traits classes provide:Geometric objects + predicates + constructors

• The Kernel can be used as a traits class for several algorithms• Otherwise: Default traits classes provided• The user can plug his own traits class

Introduction to CGAL - september 2004 45

Page 88: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Playing with traits classes

Delaunay Triangulation

Requirements for a traits class:• Point• orientation test, in circle test

Page 89: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Playing with traits classes

Delaunay Triangulation

Requirements for a traits class:• Point• orientation test, in circle test

typedef CGAL::Exact predicates inexact constructions kernel K;typedef CGAL::Delaunay triangulation 2< K > Delaunay;

Introduction to CGAL - september 2004 46

Page 90: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

• 3D points: coordinates (x,y, z)• orientation, in circle: on x and y coordinates

Page 91: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

• 3D points: coordinates (x,y, z)• orientation, in circle: on x and y coordinates

typedef CGAL::Exact predicates inexact constructions kernel K;typedef CGAL::Triangulation euclidean traits xy 3< K > Traits;typedef CGAL::Delaunay triangulation 2< Traits > Terrain;

Introduction to CGAL - september 2004 47

Page 92: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

More flexibility

The user can add information in vertices and cells

. . .

Introduction to CGAL - september 2004 48

Page 93: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Work in Progress

49

Page 94: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Kinetic Data Structures[Russel Karavelas]

Page 95: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Kinetic Data Structures[Russel Karavelas]

Persistent Homology[Kettner Zomorodian]

Page 96: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Kinetic Data Structures[Russel Karavelas]

Persistent Homology[Kettner Zomorodian]

Surface reconstruction[Oudot Rey]

Page 97: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Kinetic Data Structures[Russel Karavelas]

Persistent Homology[Kettner Zomorodian]

Surface reconstruction[Oudot Rey]

3D Meshes[Rineau Yvinec]

Page 98: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Kinetic Data Structures[Russel Karavelas]

Persistent Homology[Kettner Zomorodian]

Surface reconstruction[Oudot Rey]

3D Meshes[Rineau Yvinec]

2D Interpolation[Flototto]

Page 99: Computational Geometry Algorithms Library ... · • Two Esprit LTR European Projects (1996-1999) • Work continued after the end of European support in several sites. • January,

Kinetic Data Structures[Russel Karavelas]

Persistent Homology[Kettner Zomorodian]

Surface reconstruction[Oudot Rey]

3D Meshes[Rineau Yvinec]

2D Interpolation[Flototto]

Curved KernelExtension of the CGAL kernelAlgebraic issues[Emiris Kakargias Pion Tsigaridas Teillaud SoCG’04]

. . .

Introduction to CGAL - september 2004 50