• Aucun résultat trouvé

Exact and efficient computations on circles in CGAL

N/A
N/A
Protected

Academic year: 2022

Partager "Exact and efficient computations on circles in CGAL"

Copied!
21
0
0

Texte intégral

(1)

Exact and efficient computations on circles in C

GAL

- Experiments

Pedro M. M. de Castro, Sylvain Pion, Monique Teillaud

European Workshop on Computational Geometry Graz - 2007

(2)

The Computational Geometry Algorithms Library Open Source project

www.cgal.org

>400.000 lines ofC++code

>3.000 pages manual

∼12.000 downloads per year

∼850 users on public mailing list

∼50 developers licenses LGPL or QPL start-up GeometryFactory interfaces: Python,Scilab

Robustness and efficiency Quality:

Editorial board (10 members)

Test-suites each night ...

(3)

kernels

Kernel=

elementary geometric objects (points, segments,. . . )

elementary operations on them

(intersection tests, intersection computations,. . . ) Up to release 3.1 (Dec’04):

essentiallylinearobjects Release 3.2 (May ’06):

2Dcircularkernel

[P.-T.]

(4)

2D circular kernel design

[Emiris-Kakargias-P.-T.-Tsigaridas socg’04]

Guidelines:

code reuse:

ability toreuse the CGALkernelfor points, circles, number types,. . .

flexibility:

possibility touse other implementationsfor points, circles, number types,. . .

possibility touse several algebraic implementations

template < LinearKernel, AlgebraicKernel > class Circular_kernel

(5)

2D circular kernel design

[Emiris-Kakargias-P.-T.-Tsigaridas socg’04]

Guidelines:

code reuse:

ability toreuse the CGALkernelfor points, circles, number types,. . .

flexibility:

possibility touse other implementationsfor points, circles, number types,. . .

possibility touse several algebraic implementations

template < LinearKernel, AlgebraicKernel >

class Circular_kernel

(6)

2D circular kernel design

[Emiris-Kakargias-P.-T.-Tsigaridas socg’04]

template < LinearKernel, AlgebraicKernel >

class Circular_kernel

Types

Must be defined byLinear_kernel

basic number types, points, lines,. . . Must be defined byAlgebraic_kernel

algebraic numbers, polynomials Defined byCircular_kernel

Circular_arc_2,Circular_arc_point_2

Predicates

e.g. intersection tests, comparisons of intersection points,. . . exactnessiscrucialfor geometric algorithms Constructions

e.g. computation of intersection points

(7)

2D circular kernel design

[Emiris-Kakargias-P.-T.-Tsigaridas socg’04]

template < LinearKernel, AlgebraicKernel >

class Circular_kernel

Types

Must be defined byLinear_kernel

basic number types, points, lines,. . . Must be defined byAlgebraic_kernel

algebraic numbers, polynomials Defined byCircular_kernel

Circular_arc_2,Circular_arc_point_2 Predicates

e.g. intersection tests, comparisons of intersection points,. . . exactnessiscrucialfor geometric algorithms Constructions

e.g. computation of intersection points

(8)

Representation

CGALCircle_2:

center

squared radius (rational)

Circular_arc_2:

supporting circleCircle_2

2Circular_arc_point_2 (algebraic)

Circular_arc_point_2 root of system

(system = 2 equations of circles) (algebraic)

(9)

Representation

CGALCircle_2:

center

squared radius (rational)

Circular_arc_2:

supporting circleCircle_2

2Circular_arc_point_2 (algebraic)

Circular_arc_point_2 root of system

(system = 2 equations of circles) (algebraic)

(10)

Experiments

Computation of arrangements with CGAL3.2 package [Wein-Fogel-Zukerman-Halperin]

* onreal industrial dataofVLSImodels

vlsi_7

VLSI N V E F

vlsi_1 11,929 20,649 26,468 6,385

vlsi_2 9,663 8,556 9,439 887

vlsi_3 35,449 101,758 163,316 61,887

vlsi_4 12,937 81,096 143,049 61,986

vlsi_5 4,063 40,636 77,598 36,965

vlsi_6 74,052 547,250 1,016,460 470,480

vlsi_7 89,918 495,209 878,799 383,871

vlsi_8 123,175 370,304 555,412 190,031

vlsi_9 139,908 1,433,248 2,690,530 1,257,684

* andsynthetic models(very dense and sparse)

(11)

Experiments - Results

Pentium 4, 2.5 GHz, 1GB, Linux (2.4.20 Kernel) g++4.0.2, -DNDEBUG -O2 times in seconds Input CGAL3.2 SpecificCGAL CGAL3.3

before arrangements after

vlsi_1 28.0 8.55 4.61

vlsi_2 48.0 2.59 1.31

vlsi_3 135 26.7 21.8

vlsi_4 569 26.9 25.4

vlsi_5 125 14.3 14.8

vlsi_6 611 137 134

vlsi_7 690 192 169

vlsi_8 3,650 220 136

vlsi_9 2,320 581 492

Very dense 335 77.9 76.2

Sparse 0.91 0.51 0.21

(12)

Caching

bit-field(2 bytes) inCircular_arc_2 Stores information like

monotone arc full circle . . .

caching intersections

ofeach pairof supporting circles

memory overflow on big data sets−→abandoned

(13)

First enhancements of algebraic number type

Optimizingparticular cases

cases when algebraic numbers are in fact rational (intersection of tangent circles)

Arithmetic filtering

general idea for comparison

compute approximate values + error boundε ifεsmall enough: conclude

otherwise compute exact values

(14)

Reference counting

High cost of copying coefficients of polynomials

(multiprecision numbers) Storehandlesto objects instead of objects

Copying = copying the reference

(15)

Intermediate results

(some of the enhancements were already in the CGALspecific implementation for arrangements)

Input before now SpecificCGAL

arrangements

vlsi_1 28.0 8.42 8.55

vlsi_2 48.0 3.01 2.59

vlsi_3 135 25.8 26.7

vlsi_4 569 33.4 26.9

vlsi_5 125 15.2 14.3

vlsi_6 611 135 137

vlsi_7 690 185 192

vlsi_8 3,650 445 220

vlsi_9 2,320 525 581

Very dense 335 84.5 77.9

Sparse 0.91 0.40 0.51

(16)

Further improvements

Representation ofalgebraic numbers

Initialrepresentation ofalgebraic numbers:

root ofax2+bx +c 3rationalcoefficientsa,b,c

(multi-precision-GMP or CGAL::MP_Float) one boolean

Computation of approximation and error for filtering:

(−b±

b24ac)/2a . . .

Newrepresentation ofalgebraic numbers:

α+β√ γ 3 numbersα, β, γ

allows less efficient comparisons, but

reduces the lengthsof multi-precision numbers (and allows additions in easy cases)

(17)

Further improvements

Representation ofalgebraic numbers

Initialrepresentation ofalgebraic numbers:

root ofax2+bx +c 3rationalcoefficientsa,b,c

(multi-precision-GMP or CGAL::MP_Float) one boolean

Computation of approximation and error for filtering:

(−b±

b24ac)/2a . . .

Newrepresentation ofalgebraic numbers:

α+β√ γ 3 numbersα, β, γ

allows less efficient comparisons, but

reduces the lengthsof multi-precision numbers (and allows additions in easy cases)

(18)

Further improvements

Representation ofalgebraic numbers

Histograms (on vlsi_8)

quantity of numbers vs. lengths (number of digits) Initial

New

(19)

Further improvements

Geometric filtering

Forpredicates(e.g. intersection tests) usebounding boxof objects:

Test intersection on the boxes if they don’t intersect: conclude

otherwise test intersection on the exact objects

(20)

Results

Input CGAL3.2 SpecificCGAL CGAL3.3 before arrangements after

vlsi_1 28.0 8.55 4.61

vlsi_2 48.0 2.59 1.31

vlsi_3 135 26.7 21.8

vlsi_4 569 26.9 25.4

vlsi_5 125 14.3 14.8

vlsi_6 611 137 134

vlsi_7 690 192 169

vlsi_8 3,650 220 136

vlsi_9 2,320 581 492

Very dense 335 77.9 76.2

Sparse 0.91 0.51 0.21

(21)

Conclusion and future work

Combination of

generalityandre-usabilityof the functionality robustnessandefficiency

Integration in CGAL3.3.

Future work

manipulations of spheres, circles, and circular arcs in3D

(submitted to CGAL) [dC.-T.]

filtering ofconstructions?

[Funke-Mehlhorn’00, Fabri-P. lcsd’06]

Work partially supported by the EU STREP Project IST-006413

Références

Documents relatifs

3 Fairy circles in vegetation models for arid regions 56 3.1 The strong nonlocal logistic-type

cgal currently offers kernels for linear objects (points, segments, lines, triangles. ), and the first version of a kernel for circles and circular arcs in 2D, called 2D circular

In this paper we make explicit the system of differential equations satisfied by R -circles, and use these equations to prove our main theorem (Theorem 7.1) that a

Since the Voronoi diagram of smooth convex pseudo-circles is an abstract Voronoi diagram, given 3 sites, there may exist at most one CCW Voronoi disk and at most one CW Voronoi

This section focuses on general basics underlying the 3D Spherical Kernel, as well as on the mathematics needed for two non-trivial operations: The construction of the θ-extremal

The areal patterns can be summarised as fol- lows: a core New Guinea area in which only conjoined comparatives occur, a maritime Melanesian area circum-New Guinea in which

Having an analytical characterization has many advantages: it provides a way of verifying if a given set of digital points is a given digital circle or a subset of such a

In effect, writing the history of the Académie Royale des Sciences gave Fontenelle the opportunity to test some of the principles supporting his most polemical writings, especially