1
An Exact, Complete and Efficient An Exact, Complete and Efficient Computation of Arrangements of Computation of Arrangements of
Bézier CurvesBézier Curves
Iddo Hanniel – Iddo Hanniel – Technion, HaifaTechnion, HaifaRon Wein – Ron Wein – Tel-Aviv UniversityTel-Aviv University
2
Planar Arrangements
Given a collection C of curves in the plane, the arrangement A(C) is the subdivision of the plane into vertices, edges and faces induced by the curves in C.
3
Applications of Arrangements
Robot Motion Planning. Geographic Information Systems. Assembly Planning. Many other geometric problems can be mapped
(through duality or otherwise) to problems on arrangements.
CAD – sketches, Boolean operations.
4
Robustness Problems in Geometric Computing
Robustness in geometric computing is a difficult and well-known problem [Hoffman 89, 01][Yap 04].
Machine-precision arithmetic may yield incorrect results.
5
The Exact Geometric Computation Paradigm
The Exact Geometric Computation Paradigm [Yap and Dubé 95] was successful in robustly solving many computational geometry problems.
It requires that all geometric operations within the algorithm are preformed correctly.
Makes use of exact arithmetic software libraries for multiple precision integers and rational numbers, extended floats [GMP], and algebraic numbers [CORE, LEDA].
6
Our ContributionWe present a software package for computing arrangementsof Bézier curves that is:
Exact: Employs the exact computation paradigm (uses exact arithmetic).
Complete: Handles all degenerate cases.
Efficient: Makes use of geometric properties of Bézier curves for speed-up of the computations.
Publicly available in the new CGAL 3.3 release.
7
Previous WorkPrevious implementations of arrangements of algebraic curves are either:Not exact: Most current solid modeling systems use
non-robust floating point arithmetic.
Not complete: Do not handle all degenerate cases (MAPC [Keyser et al. 2000]).
Handle only a specific family of curves (conics [Wein 2002], cubics [Eigenwillig et al. 2004]).
Not efficient: Computer algebra systems can be used for computing exact arrangements but are too slow.
8
Preliminaries
CGAL’s Arrangement package [www.cgal.org/, www.cs.tau.ac.il/CGAL/].
Exact rational and algebraic number types[CORE, LEDA].
Bézier curve properties for faster computation.
Our work is based on three “building blocks”:
9
CGAL’s Arrangement Package
The arrangement may either be constructed incrementally,or using a sweep-line algorithm.
It constructs the underlying data-structure and enables efficient traversal over the vertices, edges and faces of the arrangement.
Point-location queries are supported.
CGAL’s arrangement package handles the topology of planar arrangements and separates it from the geometry of the curves:
10
The package is designed to handle all sorts of degenerate inputs, such as:
Robustness Issues
Vertical segments
Overlapping curves
Several curves with common intersection
Assuming correctness of the geometric methods.
11
The Geometric Traits Functions
Comparing two points by their x-coordinates.
Divide a curve to x-monotone sub-curves.
Determine if a given point is above, below or on a sub-curve.
Compare the slope of two sub-curves next to their intersection.
Compute the intersection points (or overlaps) of two curves.
The users should supply a traits class that handles the geometry of the curves. The geometric functions that need to be implemented by the traits class are:
12
Bézier Curve Properties We Use
Convex hull property: B is entirely contained in the control polygon p0...pn.
Variation diminishing property: the number of intersections of B with a line l is not greater than the intersection of l with the control polygon.
Derivative of a Bézier curve: is also a Bézier curve with control points .
knkn
kk tt
k
np
tY
tXtB
1
)(
)()(
0
)( 1 kkk ppnd
p0
p3
p1
p2p4
p5
p6
13
Bézier Curve Properties We Use
The de Casteljau subdivision algorithm:
11
)1()( )1(
ik
ik
ik ppP
P2(1)P0
(3)p0
P0(1)
p1
P0(2)
P1(1)
P1(2)
p2
p0
14
Exact Algebraic Number Types
Constructed from integers, rational numbers or floating point numbers.
Support exact {+, -, *, /, √..} operations. Support the root_of_polynomial operator, but
only for polynomials with rational coefficients. Support exact comparisons! Algebraic number types:
CORE::Expr (www.cs.nyu.edu/exact/).
LEDA::real (www.algorithmic-solutions.com/).
15
Representing Geometric Types
There are three geometric types in the traits class:
Point_2. Curve_2 – represented by the input control points
p0…pn. The representation of the polynomials X(t) and Y(t) in standard monomial basis is computed only when needed (lazy evaluation).
X_monotone_curve_2 – represented by its originating Curve_2 and its two endpoints.
16
Representing Point_2 We store a reference to the originating curves of the point coupled
with a corresponding small control polygon bounding the point. The bounding polygons induce a rational bounding box on the
point and a rational bounding interval on the parameter of the point in the originating curve.
The exact algebraic intersection/x-tangency parameters (and corresponding (x,y) coordinates) are computed only if necessary.
Originating curves
Algebraic coords
Rational BBox
17
Computing Intersection Points Exactly
Computing exactly – the roots of the polynomial system:
X1(t)-X2(s)=0
Y1(t)-Y2(s)=0 Can be computed exactly as the roots of the resultants:
Ress(X1(t)-X2(s), Y1(t)-Y2(s))
Rest(X1(t)-X2(s), Y1(t)-Y2(s))
Pairing (t,s) pairs and computing the corresponding (x,y) coordinates by assigning in original curve.
Problem: the high degree of the resultants (d1d2).Thus, we wish to avoid exact computation when possible.
18
Isolating Intersection Points – Geometric Filtering
Ensuring there is at most one intersection – the tangent bounding cones of the curves are disjoint.
Ensuring there is at least one intersection – the skewed bounding boxes intersect fully, with endpoints on opposite sides of the intersection.
B1
B2
C(B1)
C(B1)
19
Comparing Points and Slopes
Comparing x-coordinates of two points:Exact – comparison of algebraic coordinates (we wish to prevent this whenever possible).Geometric filtering – compare the rational bounding boxes, refine the bounding polygons (and hence the bounding boxes) if needed.
Comparing slope of curves to the right of their intersection point:
Exact – compare the derivative at the algebraic coordinates (we wish to prevent this whenever possible).Geometric filtering – if the intersection point is isolated then the tangent cones are disjoint – compare any two tangents.
20
Determining Point-Curve Position
If we know the point is not on the curve we can subdivide until the bounding boxes are disjoint.
How do we determine if a point is on a curve?Combinatorial filtering – if the curve is one of the point’s originating curves we are done.Geometric filtering – compare bounding boxes and do some refining (in most cases this is enough to verify the point is not on the curve).
Exact – if point p=(x0,y0) is rational, evaluate the polynomial Y(t0) at the root t0 of x0=X(t) (which is a polynomial with rational coordinates).If point p is algebraic, intersect the curve with one of p’s originating curves and compare intersection parameter.
21
Experimental ResultsExamples of Degeneracy
4 curves intersecting at a single point
(~0.1 sec)
Intersection withself intersection
(~0.1 sec)
22
Experimental Results – Random Parabolas
Input fileNumber of vertices
IRIT floating point traits
Exact Conics traits
Exact Bézier traits
Filtered Bézier traits
Parabolas_10570.00720.1490.3320.240
Parabolas_201250.01257.4071.0600.632
Parabolas_302380.023126.0242.3801.576
Parabolas_40422N/A232.3154.3853.752
Arrangement construction time for different inputs
23
Experimental Results – Higher Degrees
Input fileNumber of vertices
IRIT floating point traits
Exact Bézier traits
Filtered Bézier traits
Degree_3400.0041.2200.112
Degree_4520.0167.9160.192
Degree_5500.02051.0790.244
24
Experimental Results - BOPS
Char. #1
n1
Char. #2
n2
Exact traitsFiltered traits
TinitTcompTinitTcomp
A23V200.10517.40.0280.154
H48O160.195174.90.0320.325
S35Z150.382367.70.0300.502
m52g430.402543.60.0720.532
g43s290.360737.80.0690.734
25
Future Work
Test other representations and number types for the geometric filtering (interval arithmetic, extended floats).
Further research of the algorithms under the exact computation paradigm and try to incorporate separation bounds.
Extend the implementation to rational Bézier curves.
Extend the implementation to B-spline and NURBS curves – either by repeated knot insertion or using their similar properties.
26
Thank you!Thank you!This research has been supported by:
• European FP6 NoE grant 506766 (AIM@SHAPE).• Israel Science Foundation (grant No. 857/04).
• IST Programme of the EU as Shared-cost RTD (FET Open) Project Contract No IST-006413 (ACS - Algorithms for Complex Shapes). • Israel Science Foundation (grant no. 236/06).• The Hermann Minkowski-Minerva Center for Geometry at TAU.