260 likes | 444 Views
An Exact, Complete and Efficient Computation of Arrangements of Bézier Curves. Iddo Hanniel – Technion, Haifa Ron Wein – Tel-Aviv University. Planar Arrangements.
E N D
An Exact, Complete and Efficient Computation of Arrangements of Bézier Curves Iddo Hanniel – Technion, Haifa Ron Wein – Tel-Aviv University
Planar Arrangements Given a collection C of curves in the plane, the arrangementA(C) is the subdivision of the plane into vertices, edges and faces induced by the curves in C.
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.
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.
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].
Our Contribution We 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.
Previous Work Previous implementations of arrangements of algebraic curves are either: • Not exact: Most current solid modeling systems use non-robust floating point arithmetic. • Not efficient: Computer algebra systems can be used for computing exact arrangements but are too slow. • 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]).
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”:
CGAL’s Arrangement Package CGAL’s arrangement package handles the topology of planar arrangements and separates it from the geometry of the curves: • 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.
Several curves with common intersection Vertical segments Overlapping curves Robustness Issues The package is designed to handle all sorts of degenerate inputs, such as: Assuming correctness of the geometric methods.
The Geometric Traits Functions 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: • 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.
Bézier Curve Properties We Use p6 • 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 . p1 p3 p0 p5 p4 p2
Bézier Curve Properties We Use p0 p0 P0(3) P2(1) P0(1) p2 p1 P1(1) P1(2) P0(2) The de Casteljau subdivision algorithm:
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/).
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.
Rational BBox 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
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.
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 C(B1) B2 C(B1)
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.
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.
Experimental ResultsExamples of Degeneracy Intersection with self intersection (~0.1 sec) 4 curves intersecting at a single point (~0.1 sec)
Experimental Results – Random Parabolas Arrangement construction time for different inputs
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.
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.