Sweeping and Maintaining Two-Dimensional Arrangements on

Sweeping and Maintaining Two-Dimensional Arrangements on
Surfaces: A First Step∗
Eric Berberich†
Efi Fogel‡
Dan Halperin‡
Kurt Mehlhorn†
Ron Wein‡
We introduce a general framework for processing a set of curves defined on a continuous
two-dimensional parametric surface, while sweeping the parameter space. We can handle
planes, cylinders, spheres, tori, and surfaces homeomorphic to them. A major goal of our
work is to maximize code reuse by generalizing the prevalent sweep-line paradigm and its
implementation so that it can be employed on a large class of surfaces and curves embedded
on them. We have realized our approach as a prototypical Cgal package. We present
experimental results for two concrete adaptions of the framework for: (i) arrangements of
arcs of great circles embedded on a sphere, and (ii) arrangements of intersection curves
between quadric surfaces embedded on a quadric.
We are given a surface S in IR3 and a set C of curves embedded on this surface. The curves
divide S into cells of dimension 0 (vertices), 1 (edges) and 2 (faces), the arrangement A(C)
induced by C on S. Arrangements are widely used in computational geometry [10].
Cgal, the Computational Geometry Algorithms Library (http://www.cgal.org/) aims at
a generic and robust, yet efficient, implementation of widely used geometric data structures
and algorithms. The arrangement package [19] included in Cgal (Version 3.2) is capable of
constructing and maintaining planar arrangements of bounded curves. That is, the surface S is
the xy-plane, and all curves in C are bounded. When working with unbounded curves, users are
required to properly clip them as a preprocessing step, so that no essential information about
the arrangements (e.g., a finite intersection point) is lost. However, this solution is generally
inconvenient and outright insufficient for some applications. For example, it is possible to
represent the minimization diagram of a set of surfaces in IR3 as a planar arrangement, where
each face is labeled with the subset of surfaces that induces the lower envelope over that face [16].
As an arrangement of bounded curves has only a single unbounded face, it is impossible to
represent the minimization diagram of a set of unbounded surfaces, where several unbounded
faces might be required.
In this paper we present an extended arrangement package, which is capable of constructing
and maintaining arrangements on parametric surfaces. Our software is currently implemented
as a prototypical Cgal package, and we anticipate it will become publicly available in the next
Cgal version.
This work has been supported in part by the IST Programme of the EU as Shared-cost RTD (FET Open)
Project under Contract No IST-006413 (ACS - Algorithms for Complex Shapes), by the Israel Science Foundation
(grant no. 236/06), and by the Hermann Minkowski–Minerva Center for Geometry at Tel Aviv University.
Max-Planck-Institut für Informatik, Saarbrücken, Germany, {eric,mehlhorn}@mpi-inf.mpg.de .
School of Computer Science, Tel-Aviv University, Israel, {efif,danha,wein}@post.tau.ac.il .
Related work: Effective algorithms for manipulating arrangements of curves have been a topic
of considerable interest in recent years, with an emphasis on exactness and efficiency of implementation [10]. Mehlhorn and Seel [15] propose a general framework for extending the sweep-line
algorithm to handle unbounded curves; however, their implementation can only handle lines in
the plane. Andrade and Stolfi [2] develop exact algorithms for manipulating circular arcs on a
sphere. Halperin and Shelton [12] incrementally construct arrangements of circles on a sphere.
Berberich et al. [6] construct arrangements of algebraic surfaces of degree two by considering the
planar arrangements of their projected intersection curves and requires a postprocessing step
(which, however, is not implemented). Our approach avoids the need for a postprocessing step.
Cazals and Loriot [7] have recently developed a software package that can sweep over a sphere
and compute exact arrangements of circles on a sphere. However, their software is specialized
for the spherical case.
Paper outline: The rest of the paper is organized as follows. In Section 2 we review the
Bentley-Ottman sweep. In Sections 3 and 4 we generalize the sweep to a class of parameterized
surfaces. We first describe a theoretical framework and then discuss the implementation, in particular, how to encapsulate the adaption to different surfaces into the concepts of geometry- and
topology-traits classes. We have implemented four topological traits classes; they are discussed
in Section 5. In Section 6 we give experimental results. We finally give some concluding remarks
and future-work directions in Section 7.
The Bentley-Ottmann Sweep
Recall that the main idea behind the Bentley-Ottmann sweep-line algorithm [3] is to sweep
a vertical line starting from x = −∞ onward and maintain the set of x-monotone curves that
intersect it. These curves are ordered according to the y-coordinate of their intersection with the
vertical line and stored in a balanced search tree named the status structure. The contents of the
status line change only at a finite number of event points, where an event point may correspond
to a curve endpoint or to an intersection of two curves. The event points are sorted in ascending
xy-lexicographic order and stored in an event queue. This event queue is initialized with all curve
endpoints, and is updated dynamically during the sweep process as new intersection points are
discovered. The sweep was originally described for line segments. In [17], it was extended to
x-monotone curves. Handling degeneracies is somewhat more involved in the latter case and is
discussed in [5].
The sweep can handle Jordan curves and arcs and isolated points. The output of the sweep
is a data structure describing the arrangement, e.g., in the form of a doubly-connected-edge-list
For our generalization, it is convenient to split the overall sweep paradigm into three phases:
Preprocessing, Sweep, and Postprocessing. The preprocessing step splits the input curves and
arcs into sweepable arcs. Sweepable curves are weakly x-monotone. It then initializes the event
queue with the endpoints of the sweepable arcs. The sweep starts at x = −∞ with an empty
status structure. It stops at every event. When an arc starts at the event, it is inserted into the
status structure, and when a arc ends at the event, it is deleted from the status structure. When
two arcs meet at the event, they are either interchanged (proper intersection) or stay unchanged
(kissing). In either case, arcs which became adjacent in the status structure are checked for
intersections in front of the sweep line and any such intersection is inserted into the event
structure. We call the set of events, the order in which they are processed, and their adjacency
information (which events are connected by a curve segment) the canonical output of the sweep.
The postprocessing phase turns the canonical output into a Dcel. The postprocessing phase
is easily integrated into the sweep phase so that the Dcel-structure is generated on the fly.
For our discussion it is convenient to separate sweep and postprocessing phase. An elegant way
of coupling the sweep phase and the construction phase is given by the visitor pattern [11] as
implemented in Cgal’s Arrangement 2 package [18].
The standard sweep needs a number of geometric primitives. They are collected in a socalled geometry traits class. A full list is given in the Appendix A.1. In particular, it needs to
compare points (type pt) by xy-lexicographic order (compare xy(pt,pt)) and it needs to order
events (evt) using a function cmp(evt,evt). In the standard sweep, all events are points and
hence there is no need to distinguish between cmp and compare xy. The distinction will become
important below.
Sweeping Surfaces
We generalize the sweep to surfaces such as half-planes, cylinders, spheres, tori, etcetera,
and surfaces homeomorphic to these. We will do so in a unified way, i.e., we aim for an implementation that can handle all these surfaces. We capture the geometry of our surfaces through
parameterization. A parameterized surface S is defined by a function fS : IP → IR3 where IP
is a two-dimensional parameter space and fS is a continuous function. For example, the unit
sphere is parameterized via IP = [−π, π] × [− π2 , π2 ] and fS (u, v) = (cos u sin v, sin u sin v, cos v).
A curve on the sphere, say the equator, is a function γ : [0, 1] → IP, e.g., the equator is defined
by γ(t) = (2π(t − 1/2), 0). We want to stress that we do not assume that either surfaces or
curves are given through their parameterization. We use the language of parameterization in
our definitions. The algorithm can learn about curves and points only through a well-defined set
of predicates. The idea is now to sweep the parameter space IP in much the same way as the
standard sweep sweeps the plane. However, there are some added difficulties. First, the parameterization fS is not necessarily bijective and so some points in S have multiple pre-images.
In the example of the sphere, fS (−π, v) = fS (+π, v) for all v and fS (u, −π/2) = const and
fS (u, +π/2) = const for all u. The function v 7→ fS (−π, v) is a meridian on the sphere and the
points fS (u, −π/2) and fS (u, +π/2) are south and north pole, respectively. Also, the equator
curve is an non-closed curve in the parameter space, but a closed curve on the surface, and it has
its endpoints on the boundary of the parameter space. The standard sweep sweeps the infinite
plane and all arcs are finite. So there is need for generalization. We describe the generalization
in two steps. In the first step, we generalize to unbounded curves, and in the second step, we
generalize to non-bijective parameterizations.
We require the parameter space to be a plane rectangle with IP = U × V , where U = [0, 1],
U = [0, +∞), U = (−∞, 0], or U = (−∞, +∞) and similarly for V . We use umin , umax , vmin ,
and vmax to denote the interval endpoints. Intervals that are open at finite endpoints bring no
additional power and we therefore do not discuss them here. In the examples, we will also use
more general intervals. The standard sweep corresponds to U = V = (−∞, +∞).
Curves and arcs are functions γ : D → IP with (1) D is an open, half-open, or closed interval
with endpoints 0 and 1; (2) γ is continuous and injective except for closed curves where we have
γ(0) = γ(1); (3) if 0 6∈ D, i.e., the arc has no start point, “the arc must come from infinity”,
i.e., limt→0+ |γ(t)| = ∞. We have a similar condition if 1 6∈ D; (4) A sweepable arc must, in
addition, be weakly u-monotone, i.e., if t1 < t2 then γ(t1 ) precedes γ(t2 ) in the lexicographic
uv-ordering. In the standard sweep, we only have the case D = [0, 1]. We want to stress once
more, that the algorithm has no access to the parameterization.
Generalization I: Bijective Parameterizations and Boundary Events
Our parameter space directly models rectangles, strips, quadrants, half-planes, planes. A
large class of surfaces can be modelled through continuous and injective
√ parameterizations; for
example, a hemisphere is modelled by U = V = [−1, 1], x = u, y = v 1 − x2 , and z = x2 + y 2 .
We next discuss the generalizations required for the different phases of the sweep.
The preprocessing phase splits the input into sweepable arcs. It also adds fictitious ends
to arcs coming from infinity and similarly for arcs going to infinity. We avoid the use of use
the word “endpoint” because ends have no geometric meaning. So for any u-monotone arc
γ : D → IP we add the fictitious end (γ, 0) if 0 6∈ D and we add the fictitious end (γ, 1) if
1 6∈ D. We say that (γ, 0) lies in the left (right) outback if limt→0+ u(γ(t)) = −∞ (+∞) lies in
the lower (upper) outback if limt→0+ γ(t) = (u0 , −∞) ((u0 , +∞)) for some u0 ∈ IR. Fictitious
ends in the left outback precede all real points and all fictitious points in the lower and upper
outback which in turn precede all fictitious ends in the right outback. Consider next two ends
in the left outback. We consider the intersection of the involved curves with a vertical line
u = u0 for small enough u0 and return the y-order of these points. Small enough means that
the result does not depend on the choice of u0 . Analogous rules apply to the other situations.
Figure 2(a) gives an example. In the implementation, a fictitious end has type cve and an event
is either pt or a cve. The former type stands for a point in S and the latter type for a curve
end. The discussion above explains the functionality of cpm(evt,evt); it can be reduced to
simpler geometric predicates; see the Appendix A.2. The preprocessing phase inserts all events
into the event queue. The sweep phase is unchanged. In the postprocessing phase, we generate
the Dcel from the sequence of events. We may want to close faces extending to the boundary
of IP by fictitious edges, i.e., edges which have only combinatorial but no geometric meaning.
Alternatively, we may want to have a single “point at infinity”, see Figure 3. We come back to
this point in Section 4.
Generalization II: Remove Injectivity on Boundary
In order to model cylinders, tori, spheres, paraboloids, and surfaces homeomorphic to them,
we need a larger class of parameterizations. First, we require bijectivity only in the interior
of IP and allow non-injectivity on the boundary. More precisely, we require that fS (u1 , v1 ) =
fS (u2 , v2 ) and (u1 , v1 ) 6= (u2 , v2 ) imply (u1 , v1 ) ∈ bd IP and (u2 , v2 ) ∈ bd IP. On the boundary,
we allow injectivity in a controlled way, contractions to a single point and identification of
opposite sides.
Contraction of a side is possible if the side is closed. So if 0 ∈ U and the left vertical side
is contracted, we have fS (0, v) = p for some fixed point p and all v ∈ V , i.e., the entire left
boundary is mapped to the same point. We call such a point a contraction point. For the sphere,
we have contraction at the lower and upper boundary. Identification couples opposite sides of
the domain IP and requires them to be closed. The identification of the vertical sides is possible
if U = [0, 1]. It requires that the left boundary and right boundary of IP define the same curve
in S, i.e., fS (0, v) = fS (1, v) for all v ∈ V . The function v 7→ fS (0, v) is required to be bijective
except if we also have contraction. We call the curve v 7→ fS (0, v) the curve of identification or
identification line. For v similar definitions exist.
Let us see what we can model using identification and contraction. A triangle with corners
(a1 , b1 ), (a2 , b2 ), and (a3 , b3 ) is parameterized via IP = [0, 1] × [0, 1] with fS (u, v) = (a1 + u(a2 −
a1 )+uv(a3 −a2 ), b1 +u(b2 −b1 )+uv(b3 −b2 ), 0). The left side of the rectangle forms a contraction
point. An open or closed cylinder is modelled by identifying the vertical sides and having V open
or closed. A torus is modelled by identifying the vertical and the horizontal sides. A paraboloid
or cone is modelled by identifying the vertical sides and contracting one of the horizontal sides
to a point. A sphere is modelled by identifying the vertical sides and contracting both horizontal
sides to a point.
We come to the phases of the sweep. The preprocessing phase splits the input curves and
arcs into sweepable (i.e., weakly u-monotone) arcs. Consider any such sweepable arc γ and one
of its endpoints, say p. If p does not lie on the line of identification or a contraction point, p
has a unique pre-image in IP and we generate the event p, a point in S. If p lies on the line of
identification or the point of contraction, we generate the event (γ, 0) or (γ, 1) to indicate that
p is the start or endpoint of γ, respectively. Why do we do so? Because, at least conceptually,
we need the coordinates of the endpoint in parameter space. The point p does not give enough
information, only the incident curve does. For example, the start point of the equator has
parameterization (−π, 0) and the endpoint has (+π, 0) and this information cannot be inferred
from the point on the sphere alone, but only from its relation to the curve. Similarly, a meridian
emanates from the south pole at a certain angle and the endpoint must know about this angle.
Only the meridian can tell us, the south pole cannot. So we again have two kinds of events,
real points (= points corresponding to a point in the interior of the parameter space) and curve
ends. Isolated points on the line of identification or point of contraction and curve segments
contained in the line of identification can be viewed as any one of its pre-images and hence cause
no additional problem. The required geometric predicates are discussed in Appendix A.3.
The sweep proceeds exactly as before.
We come to postprocessing. We describe identification at u. Identification at v and contraction is similar. We have two descriptions of the situation at the line of identification. One was
generated at the start of the sweep and contains at least the points having curves emanating
to the right, one was generated at the end of the sweep and contains at least the points having
curves emanating to the left. Isolated points and arcs contained in the line of identification are
contained in one description. We walk along the two descriptions and insert any object contained
only in one also in the other. The walk uses the geometric primitive compare xy(pt,pt). After
this step the vertices in both descriptions are in one-to-one correspondence. It is best to view
these vertices as half-vertices as shown in Figure 1. The half-vertex in the left boundary has
curves emanating to the right and the half-vertex on the right boundary has curves emanating
to the left. If we have identification in u and v, the corners would be quarter vertices. We also
ensured that a curve segment running along one of the vertical boundaries has a counterpart in
the other vertical boundary. So in the Dcel computed during the sweep, the curve of identification appears twice and with the same number of vertices. Also the edges between them are in
correspondence. Either both copies of an edge are real or both copies of an edge are fictitious. It
is easy now, to make the identification. For every vertex, we join the corresponding half-vertices.
The cyclic order of incident curves is simply given as the order of the curves emanating to the
right out of the copy on the left boundary followed by the order of the curves emanating to the
left out of the copy on the right boundary. Fictitious edges are removed.
It remains to describe how we determine the faces of the arrangement on S and their face
cycles. After the sweep, we have the faces of the arrangement in IP. Facing incident to the
boundary may contain fictitious edges. If identification along such an edge occurs faces and/or
face cycles may change. Figure 1 gives an example. We proceed as follows. We discuss identification in u. Identification in v and identification in u and v are analogous.
Consider any face f in the arrangement in IP and let C(f ) be the set of its face cycles. If f
has holes, C(f ) will have more than one element. Observe however, that at most one face cycle in
C(f ) may contain fictitious edges; this holds, since f is connected. By traversing all face cycles,
we can associate with each half-edge (real or otherwise) on the line of identification, the face to
its left. In Figure 1, we would associate face f4 with fictitious half-edges 5 and 6 and face f5 with
fictitious half-edges 7, 8, and 9, and face f3 with real half-edge 4. For each fictitious half-edge
and its companion on the other vertical side, we declare the corresponding faces equivalent. In
our example, we could generate the equivalences f1 ≡ f1 , f5 ≡ f6 , f6 ≡ f7 , and f8 ≡ f8 . We
next determine the equivalence classes. For example, by setting up a graph whose vertices are
the faces and which has an edge for each equivalence statement. The connected components of
this graph are the equivalence classes. In our example, we have classes {f1 }, {f2 }, {f3 }, {f4 },
{f5 , f6 , f7 }, and {f8 }. The classes correspond to the faces on S.
f8 f8
f5 f7
f6 f5
f6 f5
f3 f2
f3 f2
f1 f1
Figure 1: Left: Situation after the sweep and before identification at u. Fictitious edges are
shown dashed and real edges are shown solid. Observe that there is one real edge running along
the line of identification. Middle: Situation after the first stage of postprocessing on line of
identification. Fictitious half edges have disappeared, but faces are not identified yet. Right:
After identification of faces.
Let F be any such class. The half-edges bounding F are simply the edges in the union of the
face cycles of the members in the class (minus the fictitious edges deleted during identification),
i.e., the edges in E(F ) := ∪f ∈F ∪C∈C(f ) C. We determine the face cycles of F in the usual way.
We declare all half-edges in E(F ) unvisited. As long as there is an unvisited half-edge in E(F ),
we trace the face cycle containing it and declare all its edges visited. In this way, the face cycles
of all faces are traced in linear time. Altogether, postprocessing takes linear time.
The Dcel and the Traits Classes
In the preceding section, we gave an abstract view of the generalized sweep. In this section we
want to fill in some more details. In particular, we want to discuss how modularity is achieved.
The output of the sweep is a doubly-connected-edge-list (Dcel). For an arrangement of
bounded planar curves in the plane, the Dcel structure is unique. In particular, there is a single
unbounded face. Already for unbounded curves in the plane, there is a choice of representations, in particular, in the representation of the unbounded faces. Figure 3(a) demonstrates
one possibility, where we use an implicit bounding rectangle embedded in the Dcel structure
using fictitious edges that are not associated with any concrete planar curve. An alternative
representation is shown in Figure 3(b). It uses a single “vertex at infinity” and all unbounded
curves share the same vertex at infinity. Both alternative are useful and none is to be preferred
over the other.
Our implementation aims for flexibility and modularity. For example, we want to give the
user the choice between different Dcel-representations as discussed in the preceding paragraph
and we want to encapsulate the geometric and topological information into a small interface.
The geometry-traits class encapsulates all primitive geometric predicates and constructions
(e.g, comparing two points by their uv-lexicographic order, computing intersection points, etc.).
The topology-traits class encapsulates the topology of the surface on which the arrangement
is embedded, and determines the underlying Dcel representation of the arrangement. In this
Figure 2: Comparing sweep events: (a) The order of the events is: left end of `1 , left end of `2 , left end of
h1 , top end of h1 , intersection of `1 and `2 , lower end of h2 , right end of h2 , right end of `2 , and right end of
`1 . (b) Comparing near the line of identification: c`2 < c`1 right of red point (c) Comparing near a singularity
Figure 3: Possible Dcel representations of an arrangement of four lines in the plane.
traits class it is specified whether identifications or contractions take place and whether the
parameter space is bounded or unbounded. Appendix B give details.
A number of optimizations are possible and implemented. We describe one. When we discussed the postprocessing phase in the case of identification of the vertical sides of the parameter
space, we suggested the following implementation: first the Dcel as shown in Figure 3(a) is
constructed and then the vertical sides are merged. In the merging process vertices of the Dcel
are identified and faces are merged. The postprocessing can also be done on the fly. For example, when an event on the right boundary is processed and a vertex is to be created, it is
first checked whether this vertex already exists on the left boundary. If it does, it is used (and
hence the identification of the boundaries is being made). Otherwise, it is created at the proper
position. Similarly, when contraction takes place, we may either first construct many copies of
the point of contraction in the Dcel and then contract in the postprocessing phase or make the
contractions on the fly.
We have implemented four topology classes and the corresponding geometry classes: bounded
curves in the plane, unbounded curves in the plane, arcs of great circles on a sphere, and
intersection curves of quadrics. For lack of space, we discuss only the last example. The given
examples concentrate on how the surfaces and curves fit into the proposed framework. Algebraic
complexities issues are not the focus of the current paper and will be discussed elsewhere.
A quadratic surface, quadric for short, is an algebraic surface defined by the zero set of
a trivariate polynomial with degree 2: q(x, y, z) ∈ Q[x, y, z]. For simplicity, we denote the
polynomial and the corresponding surface by Q. We present an implementation of the twodimensional arrangement embedded on a base quadric Q0 , induced by intersections of quadrics
Q1 , . . . Qn with Q0 . Our implementation handles all degeneracies, and is exact as long as the
underlying operations are carried out using exact algebraic number types. We mention that some
quadrics (e.g., hyperboloids of two sheets, hyperbolic cones) comprise two connected component.
For simplicity, we consider each such component as a separate surface.
Non xy-monotone quadratic surfaces can be subdivided into two xy-monotone surfaces by
a single continuous curve (e.g., the equator
subdivides a sphere into two xy-monotone hemi
projection of such a curve onto the xy-plane is
spheres), given by sil(Q) = gcd Q, ∂Q
called a silhouette curve. The projection of an intersection curve between two quadrics onto
the xy-plane results in a planar algebraic curve of degree 4, which can be be subdivided into
sweepable curves by intersecting it with sil(Q0 ). The interior of each such sweepable curve can
then be uniquely assigned to the lower part or to the upper part of the base quadric Q0 . Further
details can be found in [6].
All regular quadrics are (u, v)-parameterizable [14]. However, in our
current implementation we consider only ellipsoids, elliptic cylinders, and
elliptic paraboloids for the embedding surface Q0 , as these types are
˜ = (l, r) × [0, 2π), with l, r ∈ IR ∪ {±∞},
nicely parameterizable by IP
using fS (u, v) = (u, y(v), r(u, y(v), − sin v)). We define y(v) = ymin +
(sin 2v)(ymax − ymin ), where [ymin , ymax ] denotes the y-range of the ellipse
that Q0 induces on the plane x = u. The function r(x, y, s) returns the
minimal (s ≤ 0) or maximal (s > 0) value of Rq,x,y := {z | Q(x, y, z) = 0},
|RQ,x,y | ≤ 2. For Q, we detect open boundaries or contraction points in
u and a line of identification in v. Note that the quadrics Qi intersecting
the base quadric Q0 can be arbitrary.
We partition the parameter space of v into two ranges V1 := [0, π] and
V2 := (π, 2π). Given a point p(u, v) on the base surface Q0 , the level of
p is ` ∈ {1, 2} if v ∈ V` (see the lightly shaded area in the figure to the right, which illustrates
this partitioning for an arrangement on a paraboloid). Our geometry-traits class represents a
sweepable intersection curve by its projected curve [6], the level of its projected curve (that
needs to be unique in the interior), and its two endpoints. A point pi (ui , vi ) is represented by
its projection (xi , yi ) and its level `i . Given two points p1 and p2 , it is possible to compare their
lexicographic order in parameter space, as u1 and u2 are given by x1 and x2 , and the order of v1
and v2 can be inferred from (y1 , `1 ), (y2 , `2 ). If the levels of p1 and p2 are equal (`1 = `2 =: `),
then their v-order is identical to their y-order if ` = 1, and opposite to the their y-order if ` = 2.
The topology of an arrangement embedded on a base quadric q requires special handling:1
The initialization of the Dcel consists of the creation of a single face, which can be bounded
or unbounded depending on Q. Boundary vertices vleft and vright are used to record incidences
to points of contraction or open boundaries. For example, for an ellipsoid both vleft and vright
represent points of contraction; for a paraboloid we have one vertex that corresponds to a point of
contraction and the other represents an open boundary; for a cylinder, both vertices represent
open boundaries.2 The topology-traits class maintains a sequence of vertices that lie on the
The topology of an arrangement embedded on a sphere requires the same handling as the one embedded on
an ellipsoids, but with the role of u and v interchanged.
Compare with the representation of a vertex at infinity depicted in Figure 3(b). Note however that in our
case we distinguish between a vertex at −∞ and a vertex at +∞.
Figure 4: The Gaussian map of various polyhedra. DP — Dioctagonal Pyramid, PH — Pentagonal Hexecontahedron, TI — Truncated Icosidodecahedron, GS4 — An icosahedron, every triangle of which is divided
into 52 triangles, whose vertices are elevated to the circumscribing sphere, El16 — Ellipsoid-like polyhedron
made of 16 latitudes and 32 longitudes.
curve of identification, sorted by the order of the u-coordinate of the points. Comparisons,
which require geometric knowledge, are forwarded to the geometry-traits class, which in turn is
implemented using the QuadriX library of Exacus [4].
We briefly mention that there are also some difficulties that arise in the quadric-topology
traits-class, which are quite straightforward to handle in the planar case. For example, when
applying vertical ray shooting from a point in order to check whether it is contained in a given
face, the class has to account for the possibility that this ray crosses the curve of discontinuity.
Experimental Results
Arrangements of Great Arcs on Spheres
We demonstrate the usage of arrangements of arcs of great circles on the unit sphere through
the construction of the Gaussian map [9] of convex polyhedra, polytopes for short, and then
through overlaying such maps as a key step in computing the Minkowski sums of polytopes.
The geometric traits defines the point type to be a direction in space, representing the place
where the a vector emanating from the origin in the relevant direction pierces the sphere. An
arc of a great circle is represented by its two endpoints, and by the plane that contains the
endpoint directions and goes through the origin. The orientation of the plane determines which
one of the two great arcs defined by the endpoints is considered. This representation allows the
implementation of all geometric operations required from the geometry-traits class to apply only
to unnormalized directions and planes and to be carried out using only rational arithmetic, an
exact one preferred for robustness reasons.
The overlay of the Gaussian maps of two polytopes P and Q identifies all the pairs of features
of P and Q respectively that have common supporting planes, as they occupy the same space
on the unit sphere, thus, identifying all the pairwise features that contribute to the boundary
of the Minkowski sum of P and Q, namely P ⊕ Q = {p + q | p ∈ P, q ∈ Q}.
The construction of the Minkowski sum amounts to the computation of the overlay of the
arrangements, a well supported operation in Cgal [19] that exploits the sweep-line framework.
60 12
64 17
60 300 92
62 360 120
500 1500 252
512 1984 482
We demonstrate the usage of arrangements of arcs
of great circles on a sphere through the construction
of the Gaussian map of polytopes, and then through
overlaying such maps as a key step in computing the
Minkowski sum of polytopes. We have created a large
database of convex polyhedra models stored in an extended Vrml format [1]. We omit here a detailed description of the polytope representation, and just mention that constructing the Gaussian map of a polytope
model is done indirectly via the Cgal Polyhedron 3
data structure [13].
The table on the left lists the number of features in the arrangement of arcs of great circles
embedded on a sphere that represents the Gaussian map of a small subset of our polytope
collection. Recall that the number of vertices, halfedges, and faces is equal to the number
of facets, twice the number of edges, and the number of vertices of the primal representation
respectively. The table also lists the time consumption in seconds it takes to construct the
arrangement once the intermediate polyhedron is in place on a Pentium PC clocked at 1.7 GHz.
Tetra. ⊕ Cube
Eli6 ⊕ OEli6
Figure 5: The Gaussian map of the Minkowski sums. ODP — Orthogonal DP, OEl16 — Orthogonal ELI6.
We also have conducted a few experiments Obj. 1 Obj. 2
that construct the Minkowski sums of pairs
16 0.11
of various polyhedra in our collection. This
131 261 132 0.73
demonstrates the successful overlay of pairs of
248 586 340 2.45
arrangements on a sphere. The table on the
2260 4580 2322 19.93
right lists the number of features in the arrangement that represents the Gaussian map
of the Minkowski sums and the time consumption in seconds it takes to construct the arrangement once the Gaussian maps of the summands are in place. These performance results are
preliminary. We expect the time consumption to reduce significantly once all filtering steps are
Arrangements on Quadrics
We also measured the performance when computing the arrangement on given base quadrics
induced by intersections with other quadrics. As base quadrics we created a random ellipsoid,
a random cylinder, and a random paraboloid. These quadrics are intersected by two different
families of random quadrics. The first family consists of sets with up to 200 intersecting generic
quadrics, sets of the other family include up to 200 ellipsoids intersecting each of the base
quadrics. The coefficients of all quadrics are 10-bit integers. All performance checks are executed
on a 3.0 GHz Pentium IV machine with 2 MB of cache, using g++-3.3 as compiler with flags
-DNDEBUG -O2 and the exact arithmetic number types of Leda version 4.4.1.
q50 5722 20884 4722 28.3 1714
6164 1370 12.5 5992 21868 4944 29.3
q200 79532 310352 75646 399.8 27849 108124 26214 189.9 82914 323576 78874 418.3
7.2 1812
6504 1442 14.4
e200 10330 39484 9414 74.6 24528 94792 22870 175.8 9172 34716 8189 68.8
Table 1: Performance measures for arrangements induced on an ellipsoid, a cylinder, a paraboloid by intersections with example instances containing 50, 200 quadrics (q), or ellipsoids (e).
Table 1 shows the performance measures, i.e., number of vertices (V), halfedges (HE), and
faces (F), as well as time consumption (t) in seconds for example instances. Figure 6 illustrates
the average running time on up to 5 instances containing sets of quadrics of different size
intersecting the base quadrics. Growth is more than linear, as one expects, since we have
implemented the sweep line paradigm.
Clearly, the more complex the arrangement,
more time is required to compute it. To give
Ellipsoid (Q)
Cylinder (Q)
Paraboloid (Q)
feeling for the relative time consumpEllipsoid (E)
Cylinder (E)
Paraboloid (E)
tion, we indicate the time spent for each pair of
half-edges in the Dcel of the computed arrange300
ment. This time varies in the narrow range be250
tween 2.5ms and 6.0ms. Other parameters have
significant effect on the running time as well, for
example the bit-size of the coefficient of the in100
tersection curves.
A more detailed experimental analysis, i.e.,
with additional data, or the overlay computation
Number of Quadrics
of two such arrangements, is currently being conFigure 6: Running times as function of number of ducted and will be contained in the full version
quadrics (Q), and ellipsoids (E) respectively, having of the paper. Especially overlays are of high inintersections with the three base quadrics.
terest, since they built a fundamental basis to
compute 2D boolean operations, which itself will
be a key ingredient for boolean operations on solids defined by quadrics.
Conclusions and Future Work
We describe a general framework, together with a generic software package, for computing
and maintaining 2D arrangements of arbitrary curves embedded on a class of parametric surfaces. We give special attention to code reuse, which allows the development of traits classes
for handling new families of curves and new surface topologies in a straightforward manner.
Such developments benefit from a highly efficient code base for the main arrangement-related
We will offer our extended arrangement package for inclusion in the next public release of
Cgal. We also plan to add new traits classes, in particular to add a geometry traits class for
handling arbitrary circles and circular arcs on a sphere (not necessarily great circles), and to
generalize the quadric-topology traits to operate on all forms of quadric surfaces.
Single- vs. multi-domain surfaces: In this work we focus on the single domain case, namely
our parameter space is represented by a single rectangle IP as described in Section 3. Our
major future goal is to extend the framework to handling general smooth surfaces, which can be
conveniently represented by a collection of domains, each of which supported by a rectangular
parameter space. The individual parameter spaces are glued together according to the topology
of the surface and therefore will naturally be described in and handled by an extension of the
topology-traits concept introduced in this paper.
[1] The web3D homepage. http://www.web3d.org/.
[2] M. V. A. Andrade and J. Stolfi. Exact algorithms for circles on the sphere. International J. of
Computational Geometry & Applications, 11(3):267–290, June 2001.
[3] J. L. Bentley and T. Ottmann. Algorithms for reporting and counting geometric intersections. IEEE
Transactions on Computers, 28(9):643–647, 1979.
[4] E. Berberich, A. Eigenwillig, M. Hemmer, S. Hert, L. Kettner, K. Mehlhorn, J. Reichel, S. Schmitt,
E. Schömer, and N. Wolpert. Exacus: Efficient and exact algorithms for curves and surfaces. In
Proc. 13th Europ. Sympos. Alg. (ESA), volume 3669 of LNCS, pages 155–166, 2005.
[5] E. Berberich, A. Eigenwillig, M. Hemmer, S. Hert, K. Mehlhorn, and E. Schömer. A Computational
Basis for Conic Arcs and Boolean Operations on Conic Polygons. In ESA, volume 2461 of LNCS,
pages 174–186, 2002.
[6] E. Berberich, M. Hemmer, L. Kettner, E. Schömer, and N. Wolpert. An exact, complete and
efficient implementation for computing planar maps of quadric intersection curves. In Proc. 21st
Annu. Sympos. Comput. Geom. (SCG), pages 99–106, 2005.
[7] F. Cazals and S. Loriot. Computing the exact arrangement of circles on a sphere, with applications
in structural biology. Technical Report 6049, INRIA Sophia-Antipolis, 2006.
[8] H. Edelsbrunner and R. Seidel. Voronoi diagrams and arrangements. Discrete Comput. Geom.,
1:25–44, 1986.
[9] E. Fogel and D. Halperin. Exact and efficient construction of Minkowski sums of convex polyhedra
with applications. In Proc. 8th Workshop Alg. Eng. Exper. (ALENEX), 2006.
[10] E. Fogel, D. Halperin, L. Kettner, M. Teillaud, R. Wein, and N. Wolpert. Arrangements. In J.-D.
Boissonnat and M. Teillaud, editors, Effective Computational Geometry for Curves and Surfaces,
chapter 1, pages 1–66. Spinger, 2006.
[11] E. Gamma, R. Helm, R. Johnson, and J. Vlissides. Design Patterns — Elements of Reusable ObjectOriented Software. Addison-Wesley, 1995.
[12] D. Halperin and C. R. Shelton. A perturbation scheme for spherical arrangements with application
to molecular modeling. Comput. Geom. Theory Appl., 10:273–287, 1998.
[13] L. Kettner. Using generic programming for designing a data structure for polyhedral surfaces.
Computational Geometry — Theory and Applications, 13:65–90, 1999.
[14] W. Lü. Rational parameterization of quadrics and their offsets. Computing, 57(2):135–148, 1996.
[15] K. Mehlhorn and M. Seel. Infimaximal frames: A technique for making lines look like segments. J.
Computational Geometry & Applications, 13(3):241–255, 2003.
[16] M. Meyerovitch. Robust, generic and efficient construction of envelopes of surfaces in threedimensional space. In Proc. 14th Europ. Sympos. Alg. (ESA), volume 4168 of LNCS, pages 792–803,
[17] J. Snoeyink and J. Hershberger. Sweeping arrangements of curves. In Proc. 5th Annu. ACM Sympos.
Comput. Geom. (SCG), pages 354–363, 1989.
[18] R. Wein, E. Fogel, B. Zukerman, and D. Halperin. Advanced programming techniques applied to
Cgal’s arrangement package. In 1st Workshop Library-Centric Software Design. (LCSD’06), 2005.
[19] R. Wein, E. Fogel, B. Zukerman, and D. Halperin. Advanced programming techniques applied
to Cgal’s arrangement package. Computational Geometry — Theory and Applications, 2007. To
The Geometry-Traits Concept
As mentioned in Section 2, a geometry-traits class that is used to instantiate the Sweep line 2
template must satisfy a set of requirements. First, it has to define three nested types, representing curves, x-monotone curves and points. Note that a curve is too complicated to handle
directly, as it may comprise several disconnected branches, contain self intersections etc. The
traits class should therefore support the operation of subdividing a curve into x-monotone subcurves.3 All other traits-class operations involve only x-monotone curves and points, which in
turn represent endpoints of x-monotone curves or intersections between curves.
Traits-Class Methods for Bounded Planar Curves
In its original setting, the geometry-traits concept was designed to handle bounded planar
curves. The set of operations that any model of that concept should have provided used to be
as follows:
Compare x: Compare the x-coordinates of two points p1 and p2 .
Compare xy: Compare two points lexicographically, by their x-coordinates, and in case of
equality by their y-coordinates. (This predicate is used to maintain the order of the event
Min/max endpoint: Return the lexicographically smaller (left), or the lexicographically larger
(right), endpoint of a given x-monotone curve.
Compare y at x: Given an x-monotone curve C and a point p = (x0 , y0 ) such that x0 is in
the x-range of C (namely x0 lies between the x-coordinates of C’s endpoints), determine
whether p is above, below, or lies on C. (This predicate is used for inserting new curves
into the status line, where p is the left endpoint of the inserted curve.)
Compare y to right: Given two x-monotone curves C1 and C2 that intersect at a given point
p, determine the relative position of the two curves immediately to the right of p. (This
predicate is used for inserting new curves into the status line, when the left curve-end
coincides with an existing curve on the status line.)
Intersect: Compute the intersection points of two given x-monotone curves C1 and C2 .
Handling Unbounded Planar Curves
In order to handle unbounded planar curves, we require our geometry-traits class to support
additional operations as follows:
Infinity type: Given a curve-end (the left end or the right end of the x-monotone curve C),
determine whether it lies at x = ±∞. If the curve-end has a finite x-coordinate, determine
whether it lies at y = ±∞ or whether it also has a finite y-coordinate. (For example, the
left end of the hyperbolic branch y = x1 , x > 0 has a bounded x-coordinate but lies at
y = +∞.)
Compare y at infinity: Given the unbounded left ends of C1 and C2 , both defined at x = −∞,
compare the vertical positions of C1 and C2 at x = −∞ (similarly for unbounded right
ends at x = +∞).
For example, a planar circle is subdivided into two circular arcs that correspond to the upper semicircle and
the lower semicircle.
C3 : x = 100
C2 : y =
C1 : y = − x2
p = (0, 0)
C2 : y =
C2 : y = − x2
C1 : y =
C3 : y = − x1
C1 : y =
Figure 7: Comparing unbounded curve-ends: (a) Comparing curve-ends at x = −∞. Note that C1 is
obviously above C2 and C3 , but C2 is considered to be above C3 as there exists x0 such that for each x < x0 ,
C2 (x) > C3 (x). (b) Comparing the horizontal positions of curve-ends and a point. The vertical curve that
passes through p is to the right of C1 ’s right end and to the left of C2 left end. (c) Comparing the horizontal
positions of curve-ends at y = +∞. Note that C1 ’s left end is to the left of C2 ’s left end and both are to the
left of C3 .
Compare x at infinity (I): Given a curve C whose end lies at y = ±∞ and a point p, compare
the horizontal position of C’s end and the vertical line that contains p.
Compare x at infinity (II): Given two curves C1 and C2 whose ends lie at y = ±∞, compare
the horizontal positions of the two curve-ends.
The last three comparison operations should consider the asymptotic behavior of the curve-ends,
as shown in Figure 7. Thus, two curve-ends are equal at infinity only in case of overlap between
the curves. We especially do not fix how to implement these comparisons: Compare y at infinity
can use the slopes in the case of lines, while general curves may search for a small (large) enough
x0 to compare C1 (x0 , y) and C2 (x0 , y).
Traits-Class Methods on a Parametric Surface
When additionaly introducing identifications and contractions, as explained in Section ??,
the concept of required geometric operations must be generalized as well. Note that we switch
from prefer u and v over x and y. This should indicate that the sweep is processed in the
parameter space, but note that the predicate may obtain the correct answer in a different way.
The following operations involve only sweepable curves and points on the surface defined by
the interior of the parameter space.
Compare u: Given two points p1 , p2 compare the u-values of fS−1 (p1 ) and fS−1 (p2 ).
Compare uv: Compare fS−1 (p1 ) and fS−1 (p2 ) lexicographically, by their u-values, and in case
of equality by their v-values.
Boundary type: Given a curve-end (the minimal or the maximal end of a sweepable curve C),
determine whether it has a boundary condition in u (infinity, identification, or contraction).
If it has no boundary condition in u, determine if the curve-end has a boundary condition
in v.
Min/max endpoint: Return the uv-lexicographically smaller, or the uv-lexicographically larger,
endpoint of a given sweepable curve, with the precondition that the corresponding curveend is not unbounded.
Compare v at u: Given a sweepable curve C and a point p0 = fS (u0 , v0 ) such that u0 is in
the u-range of C, compare v0 and C(u0 ).
Compare v to right: Given two x-monotone curves C1 and C2 that intersect at a given point
p0 = fS (u0 , v0 ), let u0 > u0 > umin such that for any other intersection point p1 =
fS (u1 , v1 ) we have u0 < u1 , compare C1 (u0 ) and C2 (v 0 ). If u is identified, we may have
u0 = umin .
Intersect: Compute the intersection points of two given x-monotone curves C1 and C2 .
Compare v at boundary: Given two curve-ends of C1 and C2 , both having a boundary condition at û, compare limu→û1 C1−1 (u) and limu→û2 C2−1 (u).
Compare u at boundary (I): Given a sweepable curve-end of C with a boundary condition
at v̂ and a point p0 = fS (u0 , u0 ), compare limv→v̂ C1−1 (v) and u0 .
Compare u at boundary (II): Given two sweepable curve-ends of C1 and C2 , having boundary conditions at v̂1 and at v̂2 , respectively, compare limv→v̂1 C1−1 (v) and limv→v̂2 C2−1 (v).
Note that also for comparisons at boundaries we do not fix the implementation. People may
introduce sophisticated methods to obtain the correct comparison results.
The Topology-Traits Concept
In previous Cgal versions, planar arrangements used to be represented by the Arrangement 2
<GeomTraits,Dcel> class template. This template has two parameters: the first is a geometrytraits class, which must be a model of the geometry-traits model (see Appendix A), and the
other is a class that represents a Dcel structure.
We now introduce a class template named Arrangement on surface 2<GeomTraits,TopTraits>,
which represents an arrangement on an arbitrary surface. For backward compatibility, the
geometry-traits class maintains the same interface. However, its predicates related to x and y
should interpreted in the two-dimensional parameter space that defines the surface. The second
template parameter is a topology-traits class, which defines the specific manner the arrangement
is represented as a Dcel structure. We next give a more detailed description on the requirements
from the topology-traits class.
First, the topology-traits class must define a nested Dcel type, which corresponds to the
Dcel class used to represent the arrangement. In addition it must define visitors that perform
certain tasks. The most important visitors are:
Construction sweep-line visitor: A sweep-line visitor class that can construct the arrangement of a set of curves from scratch.
Insertion sweep-line visitor: A sweep-line visitor class that can insert a set of curves into a
non-empty arrangement.
Overlay sweep-line visitor: A sweep-line visitor class that constructs a new arrangement
corresponding to the overlay of two input arrangements.
Insertion zone visitor: Used to insert a single curve into an existing arrangement by computing its zone. Like the sweep-line algorithm, the zone-computation algorithm is also
implemented in a generic fashion and its output is determined by a visitor class.
The fact that the visitor classes are defined by the topology-traits classes makes it possible to
support generic functions that operate on the Arrangement on surface 2 class. For example, the
function insert curves(arr, begin, end) accepts an arrangement instance arr and a range of
curves defined by [begin, end). If the arrangement is empty, it uses the construction sweep-line
visitor to sweep over the input curves and construct their arrangement. Otherwise, it uses the
insertion sweep-line visitor to insert them into the existing arrangement.
As mentioned above, there are usually several alternatives for the actual Dcel representation
of an arrangement on a specific surface; see Figure 3 for an illustration.
The topology-traits class encapsulates the actual Dcel representation of the arrangement.
It provides access to the Dcel class, such that the Arrangement on surface 2 class can directly
update Dcel records with no boundary conditions (i.e., all vertices and edges related to points
and curves in the augmented parameter space). The topology-traits class is however responsible for handling the Dcel records that represents the surface boundaries: infinity, curves of
discontinuity, and singularity points. To do so, it provides the following functionality:
Initialize: Construct a Dcel structure that represents an empty arrangement.
Place boundary vertex: Locate the Dcel vertex to which a given curve object with a boundary condition will be assigned, if existing. Otherwise it returns NULL.
Notify on boundary vertex creation: This function is used to notify the topological traits
that a new Dcel vertex has been created which carries a boundary condition. This way
it is possible to keep the internal objects of the topological traits up-to-date.
Locate around boundary vertex: For a given Dcel vertex, this functions returns the predecessor half-edge which identifies where to insert a given curve with a boundary condition.
If may return NULL, if there is no such.
Is redundant: Determine whether a given vertex with a boundary condition becomes redundant. For example, a vertex that lie on a fictitious halfedge becomes redundant after one of
its non-fictitious incident halfedges is deleted (typically it is only incident to two fictitious
halfedges), or consider the case where a vertex representing a singularity point becomes
Remove redundant vertex: Remove a redundant vertex from the Dcel structure.
Is perimetric path: Determine whether a sequence of halfedges (given by first and last halfedge)
forms a perimetric path, i.e., crosses an existing curve of discontinuity an odd number of
Boundaries of same face: Check whether two given perimetric loops (each indicated by an
halfedge) form outer boundaries of the same incident face.
Planar Arrangements of Unbounded Curves
We also implemented a traits class for full lines, rays, and line segments, following the design
scheme presented in this paper. It was then an easy task to adapt our code for lower envelopes of
surfaces in three-dimensional space [16] to handle unbounded surfaces. Using the latter, through
a well known transformation [8], we computed Voronoi diagrams of points in the plane. The
diagrams are represented as planar arrangements of unbounded curves. The following figures
demonstrate the output of the program on degenerate input, which poses no difficulty to our
implementation: points along a line segment, points on a grid inside a square, points on a circle,
and points on the boundary of a square.
Related flashcards

20 Cards

Analytic geometry

14 Cards


24 Cards

Koltsevaya Line

14 Cards

Create flashcards