Introduction to the Computational Geometry Algorithms Library
Monique Teillaud
www.cgal.org
January 2011 Overview
The CGAL Open Source Project Contents of the Library Robustness Triangulations Flexibility Recent and Ongoing Work Part I
The CGAL Open Source Project Goals
• Promote the research in Computational Geometry (CG)
• “make the large body of geometric algorithms developed in the field of CG available for industrial applications”
⇒ robust programs History
Development started in 1995 Consortium of 8 European sites Two ESPRIT LTR European Projects (1996-1999) History
Development started in 1995 Consortium of 8 European sites Two ESPRIT LTR European Projects (1996-1999)
Utrecht University (Plageo) INRIA Sophia Antipolis (C++GAL) ETH Zürich (XYZ Geobench) MPI Saarbrücken (LEDA) Tel Aviv University Freie Universität Berlin RISC Linz Martin-Luther-Universität Halle History
• Work continued after the end of Galia (1999) in several sites (partial support of EU Projects ECG, ACS, Aim@Shape)
• January, 2003: creation of GEOMETRY FACTORY INRIA startup sells commercial licenses, support, customized developments
• November, 2003: Release 3.0 - Open Source Project
• October, 2010: Release 3.7 License
a few basic packages under LGPL most packages under QPL ◦ free use for Open Source code ◦ commercial license needed otherwise
• A guarantee for CGAL users • Allows CGAL to become a “standard” • Opens CGAL for new contributions Contributions
Contributors keep their identity
• “People” web page.
• Copyright kept by the institution of the authors. • now: release cycle of 6 months • included in Debian, etc • > 1,000 downloads per month • 4,000 subscribers to announcement list (7,000 for gcc) • 1,000 subscribers to discussion list (600 in gcc-help) • 50 developers registered on developer list (∼ 20 active)
CGAL in numbers
• 500,000 lines of C++ code several platforms g++ (Linux MacOS Windows), VC++ • 3,500 pages manual split into 80 chapters • > 1,000 downloads per month • 4,000 subscribers to announcement list (7,000 for gcc) • 1,000 subscribers to discussion list (600 in gcc-help) • 50 developers registered on developer list (∼ 20 active)
CGAL in numbers
• 500,000 lines of C++ code several platforms g++ (Linux MacOS Windows), VC++ • 3,500 pages manual split into 80 chapters • now: release cycle of 6 months • included in Debian, etc CGAL in numbers
• 500,000 lines of C++ code several platforms g++ (Linux MacOS Windows), VC++ • 3,500 pages manual split into 80 chapters • now: release cycle of 6 months • included in Debian, etc • > 1,000 downloads per month • 4,000 subscribers to announcement list (7,000 for gcc) • 1,000 subscribers to discussion list (600 in gcc-help) • 50 developers registered on developer list (∼ 20 active) Development process
Editorial Board created in 2001.
• Responsible for the quality of CGAL Packages are reviewed. → helps authors to get credit for their work.
• Decides about technical matters
• Coordinates communication and promotion
• ... Development process
Editorial Board created in 2001.
Currently: Pierre Alliez (INRIA Sophia Antipolis - Méditerranée) Eric Berberich (Max-Planck-Institut für Informatik) Andreas Fabri (GEOMETRY FACTORY) Efi Fogel (Tel Aviv University) Bernd Gärtner (ETH Zürich) Michael Hemmer (Tel Aviv University) Michael Hoffmann (ETH Zürich) Sébastien Loriot (GEOMETRY FACTORY) Menelaos Karavelas (Univ. Crete) Marc Pouget (INRIA Nancy - Grand Est) Laurent Rineau (GEOMETRY FACTORY) Monique Teillaud (INRIA Sophia Antipolis - Méditerranée) Mariette Yvinec (INRIA Sophia Antipolis - Méditerranée) • Developer manual • Mailing list for developers • 1-2 developers meetings per year, 1 week long
• 1 internal release per day • Automatic test suites running on all supported compilers/platforms
Development tools
• Own manual tools: LATEX −→ pdf and html • svn server (INRIA gforge) for version management • 1 internal release per day • Automatic test suites running on all supported compilers/platforms
Development tools
• Own manual tools: LATEX −→ pdf and html • svn server (INRIA gforge) for version management
• Developer manual • Mailing list for developers • 1-2 developers meetings per year, 1 week long Development tools
• Own manual tools: LATEX −→ pdf and html • svn server (INRIA gforge) for version management
• Developer manual • Mailing list for developers • 1-2 developers meetings per year, 1 week long
• 1 internal release per day • Automatic test suites running on all supported compilers/platforms Users
List of identified users in various fields • Molecular Modeling • Particle Physics, Fluid Dynamics, Microstructures • Medical Modeling and Biophysics • Geographic Information Systems • Games • Motion Planning • Sensor Networks • Architecture, Buildings Modeling, Urban Modeling • Astronomy • 2D and 3D Modelers • Mesh Generation and Surface Reconstruction • Geometry Processing • Computer Vision, Image Processing, Photogrammetry • Computational Topology and Shape Matching • Computational Geometry and Geometric Computing More non-identified users. . . Customers of GEOMETRY FACTORY
(end 2008) Part II
Contents of CGAL Structure
Kernels Various packages Support Library STL extensions, I/O, generators, timers. . . Some packages Part III
Robustness The CGAL Kernels
2D, 3D, dD “Rational” kernels 2D circular kernel 3D spherical kernel In the kernels
Elementary geometric objects Elementary computations on them
Primitives Predicates Constructions 2D, 3D, dD • comparison • intersection • Point • Orientation • squared distance • Vector • InSphere . . . • Triangle . . . • Circle ... Affine geometry
Point - Origin → Vector Point - Point → Vector Point + Vector → Point Point Vector
Origin
Point + Point illegal
midpoint(a,b) = a + 1/2 x (b-a) - ex: Intersection of two lines - a1x + b1y + c1 = 0 a1hx + b1hy + c1hw = 0 a2x + b2y + c2 = 0 a2hx + b2hy + c2hw = 0
(x, y) = (hx, hy, hw) =
b1 c1 a1 c1 b1 c1 a1 c1 a1 b1 , − ,
b2 c2 a2 c2 b2 c2 a2 c2 a2 b2 , − a1 b1 a1 b1
a2 b2 a2 b2 Field operations Ring operations
Kernels and number types
Cartesian representation Homogeneous representation hx x = hx Point hw y = hy Point hy hw hw Field operations Ring operations
Kernels and number types
Cartesian representation Homogeneous representation hx x = hx Point hw y = hy Point hy hw hw
- ex: Intersection of two lines - a1x + b1y + c1 = 0 a1hx + b1hy + c1hw = 0 a2x + b2y + c2 = 0 a2hx + b2hy + c2hw = 0
(x, y) = (hx, hy, hw) =
b1 c1 a1 c1 b1 c1 a1 c1 a1 b1 , − ,
b2 c2 a2 c2 b2 c2 a2 c2 a2 b2 , − a1 b1 a1 b1
a2 b2 a2 b2 Kernels and number types
Cartesian representation Homogeneous representation hx x = hx Point hw y = hy Point hy hw hw
- ex: Intersection of two lines - a1x + b1y + c1 = 0 a1hx + b1hy + c1hw = 0 a2x + b2y + c2 = 0 a2hx + b2hy + c2hw = 0
(x, y) = (hx, hy, hw) =
b1 c1 a1 c1 b1 c1 a1 c1 a1 b1 , − ,
b2 c2 a2 c2 b2 c2 a2 c2 a2 b2 , − a1 b1 a1 b1
a2 b2 a2 b2 Field operations Ring operations The “rational” Kernels
CGAL::Cartesian< FieldType > CGAL::Homogeneous< RingType >
−→ Flexibility typedef double NumberType; typedef Cartesian< NumberType > Kernel; typedef Kernel::Point_2 Point; Numerical robustness issues
Predicates = signs of polynomial expressions
Ex: Orientation of 2D points
r
q
p
px py 1 orientation(p, q, r) = sign det qx qy 1 rx ry 1
= sign((qx − px )(ry − py ) − (qy − py )(rx − px )) Numerical robustness issues
Predicates = signs of polynomial expressions
Ex: Orientation of 2D points 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
(x, y) 7→ > 0, = 0, < 0
double −→ inconsistencies in predicate evaluations 6= exact arithmetics
Filtering Techniques (interval arithmetics, etc) exact arithmetics only when needed
Degenerate cases explicitly handled
Numerical robustness issues
Speed and exactness through
Exact Geometric Computation Degenerate cases explicitly handled
Numerical robustness issues
Speed and exactness through
Exact Geometric Computation
6= exact arithmetics
Filtering Techniques (interval arithmetics, etc) exact arithmetics only when needed Numerical robustness issues
Speed and exactness through
Exact Geometric Computation
6= exact arithmetics
Filtering Techniques (interval arithmetics, etc) exact arithmetics only when needed
Degenerate cases explicitly handled The circular/spherical kernels
Circular/spherical kernels • solve needs for e.g. intersection of circles. • extend the CGAL (linear) kernels
Exact computations on algebraic numbers of degree 2 = roots of polynomials of degree 2
Algebraic methods reduce comparisons to computations of signs of polynomial expressions Application of the 2D circular kernel
Computation of arrangements of 2D circular arcs and line segments
Pedro M.M. de Castro, Master internship Application of the 3D spherical kernel
Computation of arrangements of 3D spheres
Sébastien Loriot, PhD thesis Part IV
2D and 3D Triangulations 2D and 3D Delaunay triangulations
empty sphere property 2D and 3D Delaunay triangulations
1 M points in ∼ 10 sec Flexibility
Generic algorithms
Delaunay_Triangulation_2
Traits parameter provides: • Point • orientation test, in_circle test Flexibility
2D Kernel used as traits class
typedef CGAL::Exact_predicates_inexact_constructions_kernelK; typedef CGAL::Delaunay_triangulation_2< K > Delaunay;
• 2D points: coordinates (x, y) • orientation, in_circle Flexibility
Changing the traits class
typedef CGAL::Exact_predicates_inexact_constructions_kernelK; typedef CGAL::Triangulation_euclidean_traits_xy_3< K > Traits; typedef CGAL::Delaunay_triangulation_2< Traits > Terrain;
• 3D points: coordinates (x, y, z) • orientation, in_circle: on x and y coordinates only Recent and Ongoing Work
3D periodic triangulations released in CGAL 3.5 Manuel Caroli, PhD thesis 2D: in progress Nico Kruithof Recent and Ongoing Work
Meshing of periodic surfaces Vissarion Fisikopoulos, Master internship Recent and Ongoing Work
Meshing of periodic volumes Mikhail Bogdanov, internship, now PhD student Recent and Ongoing Work
Triangulation on the sphere participation of Olivier Rouiller, internship École Centrale Lille To know more
www.cgal.org
http://www.inria.fr/sophia/members/Monique.Teillaud/