0% found this document useful (0 votes)
12 views21 pages

Convex Hulls of Objects Bounded by Algeb

This document presents an O(n.d^6) algorithm for computing the convex hull of objects bounded by algebraic curves, which is significant in computational geometry. The authors discuss the limitations of existing algorithms and propose improvements by eliminating unnecessary computations and introducing a preprocessing step for monotone segmentation of curve segments. The paper details the algorithm's efficiency and practical applications, particularly in intersection detection and motion planning for complex geometric objects.

Uploaded by

giuliano
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views21 pages

Convex Hulls of Objects Bounded by Algeb

This document presents an O(n.d^6) algorithm for computing the convex hull of objects bounded by algebraic curves, which is significant in computational geometry. The authors discuss the limitations of existing algorithms and propose improvements by eliminating unnecessary computations and introducing a preprocessing step for monotone segmentation of curve segments. The paper details the algorithm's efficiency and practical applications, particularly in intersection detection and motion planning for complex geometric objects.

Uploaded by

giuliano
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Algorithmica (1991) 6:533 553

Algorithmica
9 1991 Springer-Verlag New York Inc.

Convex Hulls of Objects Bounded by Algebraic Curves 1


Chanderjit Bajaj 2 and Myung-Soo Kim 3

Abstract. We present an O(n.d~ algorithm to compute the convexhull of a curved object bounded
by O(n)algebraic curve segments of maximum degree d.

Key Words. Computational geometry,Algorithms and data structures, Algebraicgeometry.

1. Introduction. Convex-hull computation is fundamental in computational geo-


metry. There are numerous applications in which the convex hulls of complex
objects can be used effectively to make certain geometric decisions easier. For
example, a null intersection between the convex hulls of two objects implies a null
intersection between the original objects. Since intersection testing for convex
objects is easier than for general objects, convex hulls intersection is often used as
an efficient first test in an intersection detection algorithm for nonconvex objects.
Additional motivation arises from the use of convex hulls for heuristic collision-free
motion planning of general objects among obstacles. Motion planning is easier for
convex objects and obstacles, see for example [5].
Several linear-time algorithms for computing the convex hulls of simple planar
polygons are known [8], [11], [-14], [173, [22]. These algorithms achieve the more
efficient O(n) bound whereas the ~(n log n) lower bound applies to the general
problem of computing the convex hull of n points in the plane, see [15] and [!83.
The above algorithms for planar polygons are iterative and vertex-based, i.e., the
computation in each step depends on the region where the next vertex lies. By
generalizing [11] to an edge-based algorithm Sch/iffer and Van~Wyk [20] extend
the planar polygon results to a linear-time algorithm for curved objects bounded
by piecewise-smooth Jordan curves. Souvaine [23] also suggests a linear-time
convex-hull algorithm based on a bounding polygon approach for a class of curved
objects (termed splinegons). In this paper we propose a simple linear-time algo-
rithm for computing the convex hulls of objects bounded by algebraic curves. The
algorithm, which is partly a generalization of [14], is linear in n, the number of
algebraic curve segments, and is a small polynomial in the maximal degree d of the
algebraic curves. It also reflects various practical considerations such as simplicity
of implementation and flexibility to heuristic modifications as discussed below.

1Research supported in part by NSF Grant MIP-85 21356, ARO Contract DAA G29-85-C0018under
Cornell MSI, and ONR Contract N00014-88-K-0402.This paper is an updated versionof a part of [6].
ZDepartment of Computer Science,Purdue University,West Lafayette,IN 47907, USA.
3Department of Computer Science,POSTECH, P.O. Box 125, Pohang 790-600, Korea.
ReceivedJanuary 4, 1988;revised November23, 1988,and May 30, 1989.Communicatedby D. T. Lee.
534 C. Bajaj and Myung-Soo Kim

c~
/ /

Fig. 1. Difference between polygonal and curved cases.

The basic strategy of convex-hull algorithms for simple polygons [8], [11], [14],
[17], [22] is to construct a sequence of convex polylines which converges to the
convex-hull boundary within O(n) steps. Each convex polyline consists of bound-
ary edges and line segments (lids) connecting two vertices of the simple polygon.
The pocket bounded by a lid is the region bounded by the lid and the polygon
boundary. Convex-hull algorithms for planar curved objectes [6], [20], [23] follow
a similar strategy. In the curved case, we construct a sequence of convex polyarcs
(termed current hulls) instead of convex polylines. Each current hull consists of
convex subedges and common tangent line segments (termed lids) between two
convex edges. Pockets can be defined in a similar way. However, it is not entirely
obvious how to modify algorithms for planar polygons to deal with curved planar
objects with piecewise algebraic boundary curves. Figure 1 shows a difference
between simple polygons and curved objects, where a single edge may intersect two
different pockets. In the polygonal case, when an edge exits from a pocket, the
ending vertex should be outside of all the pockets and becomes a vertex on the new
current hull. Further, this edge is totally contained in the convex hull interior. This
fact is not generally true for planar curved objects, namely, the ending vertex of an
exciting edge may lie in a pocket, see Figure 1, and an interior point of this edge
may lie on the new current hull. To determine the exact portion of an exiting edge
which appears on the new current hull [20], [23], compute a common tangent line
between this edge and the previous current hull. As we see in Section 2, common
tangent computation is the most expensive geometric operation among those
required to compute the convex hull of an object. Though common tangents need
to be computed for those edges in the final output, the common tangents computed
for all the intermediate edges are wasted. Avoiding these wasted expensive
computations is crucial in the design of a fast convex-hall algorithm for a general
planar curved object.
We suggest two ways of limiting common tangent computations. Edges are
classified as convex and concave with respect to the object interior. Their
definitions are given in Section 2.2.1. First, we do not compute common tangents
for concave edges. In Figure 1, the edge Cj is a concave edge and it is not on the
final convex-hull boundary. However, [20], [23] have to update the current hull
Convex Hulls of Objects Bounded by Algebraic Curves 535

with respect to this concave edge C~ because their algorithms maintain the
invariant "at any point on the current hull, the tangent line supports all the edges
seen so far." This invariant has been used in the prior convex-hull algorithms for
polygons, too, see [8], Ell], [14], and [17]. We suggest a new invariant (,) "if a
point p seen so far is a convex-hull boundary point, this point p is on the current
hull and the subarc of current hull between Po (the starting vertex) and p is on the
convex-hull boundary." Further, we define pockets which may self-intersect. See
Section 3.1 for a precise definition of a self-intersecting pocket and Figure 9. Using
these new techniques, we eliminate the common tangent computations for concave
edges and consequently also present a concise correctness proof and a simple
algorithm.
Another important factor to be considered in computing with curved objects is
how to use approximate solutions in intermediate decision steps. In practice this
yields substantial time savings as well as increases the robustness of our algorithm.
Figure 2 shows two examples of situations that arise in convex-hull computation.
In both cases the computed tangent lines L1 and L2 have slopes very close to each
other. Exact comparison of these slopes is difficult since we have to refine the
approximate solutions. Since both tangent lines may turn out to be useless later,
this exact slope comparison may be wasted. A better strategy is to keep both
tangent lines on the stack by assuming the slope of the lower one to be smaller than
that of the upper one. Only if two tangents remain on the final output stack, do we
apply an expensive algebraic comparison to make an exact decision. Keeping both
tangents is easy when we update the convex-hull boundary for convex edges or
convex vertices. However, concave edges and concave vertices (vertices with inner
angles > ~) causes difficulties. We cannot keep both tangents simultaneously on
the stack, see Figure 2. To keep the lower tangent L1, we have to delete the upper
tangent L2, and vice versa. Deleting Lz is difficult since it may appear in the final
output. Further, deleting L 2 is also difficult since, when computing with approxi-
mate solutions, there may occur a self-intersecting pocket. For example, in Figure
3, where L 1 and L2 have close slopes, if we delete L2 and later L 3 is determined to
have lower slope than L1, then the pocket bounded by the lid L 3 self-intersects.
This fact justifies the choice of our invariant (,) which allows self-intersecting
pockets enabling the deletion of the upper tangent in the case of concave edges.

L2

S
Fig. 2. Tangent lines with close slopes.
536 C. Bajaj and Myung-Soo Kim

L2

L3

Fig. 3. Difficulty with concave edge.

Though our algorithm does not compute common tangents for concave edges, we
close certain pockets with concave vertices, see our case 3(a) in Section 3.1.1 and
Figure 6. We can also use certain points on concave edges for the same purpose.
The exact locations of such concave vertices or accurate computations of tangents
with other curve segments are not important, see, for example, Figure 4. Thus,
using the invariant (,), we can also delete the upper tangents for concave vertices
without causing any difficulties.
To simplify the design of our algorithm further, we introduce a preprocessing
step in Section 2.2.1 which divides each edge into monotone subedges. With
monotone curved edges, we can make easy vertex-coordinate comparisons for
many geometric decisions. The rest of this paper is organized as follows. Section 2
describes certain preliminary information of use in later sections. In Section 2.1 we
describe the boundary representation for a planar geometric model with algebraic
boundary curves. In Section 2.2 we present a monotone curve segmentation of
boundary curve segments (a preprocessing step of out algorithm) and basic
operations on these monotone curve segments. Algebraic curves are treated in each
of two internal representations; namely, the implicit and the parametric forms [1],
[25]. In Section 3 we present an O(n. d 6 log d) (resp. O(n. (dlZlog d + T(d)))) time

P*

Fig. 4. Nontangent lid.


Convex Hulls of Objects Boundedby AlgebraicCurves 537

algorithm to compute the convex hull of planar curved objects with parametric
(resp. implicit) boundary curves. Here T(d) is the worst-case time taken to trace an
algebraic curve segment of degree d [4].

2. Preliminaries. In this section we describe the algebraic boundary model of the


planar curved object, and consider monotone curve segmentations and other
related geometric operations on monotone curve segments.

2.1. Planar Geometric Model A planar geometric model with algebraic bound-
ary curves has the following boundary representation. A single, simple oriented
cycle of algebraic curve edges, where each edge is directed and incident to two
vertices. Each edge also has curve equations, which are implicit and/or rational
parametric equations of algebraic curves. An algebraic curve is implicitly defined
by a single polynomial equationf(x, y) = 0 and parametrically defined by the pair
(x =fl(t)/f3(t), y =fz(t)/f3(t)), where f l , f2, and f3 are polynomials. Further, an
interior point is also provided on each implicitly defined edge which helps remove
any geometric ambiguity in the case of vertices which are singularities of the
algebraic curve [19]. Finally, each vertex is exactly specified by Cartesian coordin-
ates.
The curve equations for each edge are chosen such that the direction of the
normal at each point of the edge is toward the exterior of the object. For a simple
point on the curve the normal is defined as the vector of partials to the curve
evaluated at that point. For a singular point on the curve we associate a range of
normal directions determined by normals to the tangents at the singular point.
Further, the orientation of the cycle of edges is such that the interior of the object is
to the left when the edges are traversed.

2.2. Computations with Algebraic Curves. We assume some primitive geometric


algorithms to manipulate algebraic curve segments, see [1], [3]-[5], [7], [9], [-12],
and [13]. Prior work has considered the generation of rational parametric
equations for certain implicitly defined algebraic plane curves 1-1], the generation of
implicit equations for parametrically defined algebraic curves [3], as well as the
robust tracing of algebraic curve segments with correct connectivity [4]. Tracing,
for instance, is very useful in determining when a given point lies within a general
algebraic curve segment. In the following T(d) denotes the time required to trace a
curve segment C. For this last problem the method of sorting along the curve [13],
also provides an efficient solution for low degree algebraic curves.

2.2.1. Monotone Segmentation. We consider the monotone segmentation of a


geometric model boundary and other geometric operations on monotone curve
segments. We show the time complexities of these operations which are of
relevance to timing analysis of the algorithms described in later sections. Our
model of computation is the RAM model with arithmetic operations requiring unit
time cost, see [2] and [21]. We first define monotone edges.
538 c. Bajaj and Myung-SooKim

DEFINITION 2.1. Let C be a directed boundary edge without any inflection or


singular point. Then
(1) C is convex r the gradient of C turns counterclockwise along C,
(2) C is concave ~ the gradient of C turns clockwise along C,
(3) C is monotone ~ C is either convex, concave,or linear, and the interior of C does
not include any extreme point along the x or y directions.

We analyze the time complexity of solving systems of polynomial equations.

LEMMA 2.1.
(I) All the roots of a univariate polynomial equation of deoree O(d) can be computed
in O(d 3 log d) time.
(II) The common solutions of two polynomial equations of degree O(d) in two
variables can be computed in O(d 6 log d) time.
(III) The common solutions of three (resp. four) polynomial equations of deyree O(d)
in three (resp. four) variables can be computed in O(d 12) (resp. O(d16)) time.

PROOF. (I) The squarefree part of a univariate polynomial can be calculated in


O(d log 2 d) time using fast techniques for the required GCD computation and
division steps I-2], and further all roots can be computed using root isolations in
O(d 3 log d) time, see [21].
(II) We can eliminate one variable from two polynomial equations using the
Sylvester resultant in O(d 4 log 3 d) time, see [7] and [10], and then compute the
roots of the resulting univariate polynomial equation of degree O(d2) in O(d 6 log d)
time. Doing this twice for each variable in turn together with the pairwise
substitutions then allows computing the common solutions in overall O(d 6 log d)
time.
(III) We homogenize the polynomial equations by adding a homogenizing
variable w. Thus we have three (resp. four) homogenous polynomials in four (resp.
five) variables. The u-resultant of this system of equations can be computed in O(d9)
(resp. 0(d12)) time, see [-93, [24], and also [16]. This u-resultant can effectively be
reduced to univariate polynomials of degree O(d 3) (resp. O(d4)) which contain all
the solutions of each variable. We can solve resulting equations of degree O(d 3)
(resp. O(d~)) in one variable in O(d 9 log d) (resp. O(d 12 log d)) time. Though the
resultant computation takes naively O(d9) (resp. O(dt2)) time and solving real root
solutions takes O(d 9 log d) (resp. O(d 12 log d)) time, the overall time is bounded by
the pairwise substitution which takes O(d12) (resp. O(d16)) time. []

Monotone segmentation requires adding singular points, inflection points, and


extreme points on the curve as extra vertices. First we take care of singular points
on curved edges. Singularities are determined for each curved edge and are
computed by using Lemma 2.2I(i) and II(i). The boundary of the object is next
modified such that nonsingular edges are either convex, concave, or linear segments.
Such conditions are easily met by adding extra vertices to inflection points of
curved edges. Inflection points of curves are obtained and the edges are marked
Convex Hulls of Objects Boundedby AlgebraicCurves 539

convex, concave, or linear, respectively, by using Lemma 2.2I(iv)-(vi) and


II(iv)-(vi). We may also assume edges are further segmented so that extreme points
along the x or y directions are added as vertices. These extreme points are
computed by using Lemma 2.2I(ii), (iii) and II(ii), (iii).

LEMMA 2.2.
(I) Let C: (a, b) --* R 2 be a curve parametrized by t ~ (a, b) and let p = C(t) = (cl),
c2(t)) be a point on this curve. Then
(i) p is a (non-self-intersecting) singular point r c'1 (t) = c'2(t) = O,
(ii) p is a nonsingular x-extreme point r162c'z(t) = 0 and c'l(t) # O,
(iii) p is a nonsingular y-extreme point ~ c'a(t) = 0 and c'z(t) # 0 and
(iv) p is an inflection point of the curve C ~ c ' l ( t ) . c~(t) - c'2(t), c'l'(t) = O.
I f C has no inflection point, then
(v) C is convexc>c'l(t), c~(t) - c'z(t), c~(t) > O, and
(vi) C is concave,**-c'l(t). c'~(t) - c'2(t), c"l(t) < O,
(II) Let C be a curve implicitly defined b y f ( x , y) = 0 and let p = (x, y) be a point on
the curve C. Then
(i) p is a singular p o i n t , ~ f = fx = fr = O,
(ii) p is a nonsingular x-extreme point,c~ f = fr = 0 and fx # O,
(iii) p is a y-extreme point ez, f = fx = 0 and fr # O, and
(iv) p is an inflection point r f = f~x. f ~ - 2f~y. f~fr + fry" fZx = O.
I f C has no inflection point, then
(v) C is convex r f~x" f r2 - 2f~y. f~fr + fry" f ~ > 0, and
(vi) C is concave,,~ f ~ . f 2 _ 2f~y. f~fr + frr" f ~ < 0.

PROOF, Most of these results are classical, see [25]. []

LEMMA 2.3.
(I) For a parametric curve segment C of degree d, a monotone segmentation can be
obtained in O(d a log d) time.
(II) For an implicit algebraic curve segment C of degree d, a monotone segmentation
can be obtained in O(d 6 log d + T(d)) time.

PROOF. (I) The equations in Lemma 2.2(I) are of degree O(d) in a single variable t
using Lemma 2.1.
(II) The equations in Lemma 2.2(II) are two simultaneous polynomial equa-
tions of degree O(d) in two variables x and y. []

2.2.2. Basic Operations on Monotone Curve Segments. We consider primitive


operations on monotone curve segments C and D, and a line segment L:
1. The intersection of C and L.
2. The containment of C in the upper-left halfplane HUZ(L) of L.
3. The tangent line L of C from a point q.
4. The common tangent line L of C and D.
540 C. Bajaj and Myung-SooKim

(1) Line-Curve Segments Intersection. Assume C is a monotone curve segment


and L i s a line segment. Let R(C) and R(L) be the minimal rectangles with sides
parallel to coordinate axes and containing C and L, respectively, and let A(C) be
the minimal triangle defined by the line connecting both endpoints of C and two
tangent lines of C at both endpoints of C. The intersection of C and L is computed
as follows:
i f ( R ( C ) ~ R(L) = ~ o r A ( C ) c~ L = ~ ) then C n L = ~ ;
else Let Pl = (Xl, Yl) and P2 = (x2, Y2) be the starting and ending
points of/2 = A(C) c~ L, then the intersection point of C and E is com-
puted by Lemma 2.4.

LEMMA 2.4.
(I) I f C is a monotone parametric curve segment given by C(s) = (x(s), y(s)) with
a < s <_ b, then C intersects L' at a point p = C(s) = t ' p l + (1 - t).p2 if and
only if s and t satisfy
(1) a <_ s <_ b and 0_<t_<l,
(2) x(s) = t. xl + (1 - t ) . x z ,

(3) y(s) = t . y 1 + (1 - t ) . y 2.

(II) I f C is a monotone implicit algebraic curve segment given by f (x, y) = O, then C


intersects L' at a point p = t . p l + (1 - t)'p2 if and only if t satisfies
(1) psC and 0_<t___l,
(2) f ( t . x 1 + (1 - - t).x2, t . y 1 + (t - t).y2) = 0.

PROOF. Straightforward. []

LEMMA 2.5.
(I) For a monotone parametric curve segment C, the curve-line segments intersec-
tion is computed in O(d 3 log d) time.
(II) For a monotone implicit algebraic curve segment C, the curve-line segments
intersection is computed in O(d 3 log d + T(d)) time.

PROOF. (I) The elimination of t from Lemma 2.4(I) can be done in constant time
resulting in a single polynomial of degree d in a single variable s. This polynomial
can be solved in O(d 3 log d) time using Lemma 2.1. There are at most d solutions for
s with a _< s _< b and the corresponding t to each s can be solved within constant
time.
(II) When we expand equation (2) of Lemma 2.4(I) in an increasing order of t, it
gives a polynomial of degree d in a single variable t. The expansion can be done in
O(d 2) time and the polynomial can be solved in O(d 3 log d) time using Lemma 2.1.
Finally, we need to trace along the curve segment C to check whether these
solutions are on the curve segment C in T(d) time. []
Convex Hulls of Objects Bounded by Algebraic Curves 541

(2) Containment in a Half-plane. The half-plane containment for points and line
segments can be done within constant time. Assume C is a convex monotone edge
along which x and y-coordinates are strictly increasing, L is an infinite line with
slope m _> 0, and HVL(L) is the upper-left closed half-plane of the line L. These are
the only types of curved edges and half-planes considered in Section 3. Then
C c HVL(L).e,>ps and pe~HVL(L), and C c~ E ~ ~ , where Ps and PE are
the starting and ending points of C, respectively, and E = A(C)c~ L. Hence,
the time complexity of half-plane containment testing is O(d 3 log d) (resp.
O(d 3 log d + T(d))), the same as that of line-curve segments intersection.

(3) Common Supporting Line of a Curve Segment and a Point. Assume L i s a


common supporting line of a monotone curve segment C and a point q = (a, fl) r C
such that C u {q} c HVL(L). Then the supporting point p of L at C is given by the
following lemma.

LEMMA 2.6.

(I) I f C is given by a monotone parametric curve C(t) = (x(t), y(t)) with a <_ t < b,
then p = (x(t), y(t)) is given by
(1) [ a < t < b,
(2) [(x(t) -- e). y'(t) -- (y(t) -- fl). x'(t) = O.

(II) I f C is given by a monotone implicit curve f ( x , y) = O, then the point p = (x, y) is


given by

(1) f((x,y)=0 and p=(x,y)~C,


(2) x - ~ ) - L + (y - / ~ ) - f , = 0.

PROOV. Straightforward. []

LEMMA 2.7.

(I) For a monotone parametric curve segment C, the common supporting line of C
and q is computed in O(d 3 log d) time.
(II) For a monotone implicit algebraic curve segment C, the common supporting line
of C and q is computed in O(d 6 log d + T(d)) time.

PROOF. Similar to Lemma 2.3. []

(4) Common Supporting Line of Two Curve Segments. Assume L i s a common


supporting line of two disjoint monotone curve segments C and D such that
C u D c HWL)(L). Then the supporting points p = (x, y) and q = (~, fl) of L at C
and D, respectively, are given by the following lemma.
542 C. Bajaj and Myung-Soo Kim

LEMMA 2.8.

(I) I f C and D are given by monotone parametric curves C(s) = (x(s), y(s)) with
a < s < b and D(t) = (~(t), fl(t)) with c < t < d, then p = (x(s), y(s)) and
q = (~(t), fl(t)) are given by

(1) [a<s<b and c<t<d,


I
(2) {(x(s) -- e(t)), y'(s) -- (y(s) -- fl(t)), x'(s) = O,
I
(3) [(x(s) - c~(t)), fl'(t) - (y(s) - fi(t))..'(t) = o.

(II) I f C is given by a monotone parametric curve C(s) ~ (x(s), y(s)) with a <_ s <_ b
and D is given by a monotone implicit curve g(a, fi) = O, then p = (x(s), y(s)) and
q = (cr fi) are given by

(1) ]a<_s<_b,
(2) jg(~,fl)=o, and q=(~,fl)~D,
|
(3) | (x(s) - o0. y ' ( s ) - (y(s) - fl). x'(s) = o,
I
(4) [ (x(s) -- cO.g ~ + (y(s) -- fl)'gt~ = O.

(III) I f C and D are given by, monotone implicit curves f ( x , y) = 0 and g(cq fl) = O,
then p = (x, y) and q = (~, fl) are given by

(1) [f(x,y)=O and p=(x, yeC,


I
(2) Jg(e, fl)=0 and q=(c~,fl) e D
/
(3) | (x - ~ ) . L + (y - 13).L = 0,
/
(4) [ (x - e).g~ + (y --/3)'ga = O.

PROOF. Straightforward. []

LEMMA 2.9.
(I) For monotone parametric curve segments C and D, the common supporting line
of C and D is computed in O(d 6 log d) time.
(II) For a monotone parametric curve segment C and a monotone implicit alge-
braic curve segment D, the common supporting line of C and D is computed in
O(d 9 log d + T(d)) time.
(III) For monotone implicit algebraic curve segments C and D, the common support-
ing line of C and D is computed in O(d 12 log d + T(d)) time.

PROOF. Through the common solutions of three (resp. four) polynomial equa-
tions as stated in Lemma 2.1 take O(d 12) (resp. O(d16)) time, for monotone
curve segments and the application of common tangents, this can be reduced to
O(d 9 log d + T(d)) (resp. O(d 12 log d + T(d)) time. []
Convex Hulls of Objects Bounded by Algebraic Curves 543

Now, initially assume there are O(m) algebraic curve segments of maximum
degree d on the model boundary. Then monotone segmentation preprocessing can
be done in O(m.d a log d) (resp. O(m.(d 6 log d + T(d)))) time if all the boundary
curve segments are parametric (resp. implicit). By the fundamental theorem of
algebra and Bezout's theorem, see [25], a single polynomial of degree d in one
variable t can have at most d real solutions, and a system of two polynomial
equations in two variables x and y of degree d can have at most d 2 real solutions.
Thus, Lemma 2.1 implies that each parametric (resp. implicit) algebraic curve
segment of degree d can be segmented into O(d) (resp. O(d2)) m o n o t o n e curve
segments by adding extra vertices into singular points, inflection points, and
extreme points. After this preprocessing step of monotone segmentation, we let the
total number of boundary edges be n, which is O(m.d) (resp. O(m.d2)) for
parametric (resp. implicit) curves. In the following, we assume the object boundary
is already segmented into O(n) monotone curve segments and the timing analysis is
given in terms of n.

3. Convex Hull of Geometric Model. In this section we present an algorithm to


compute the convex hull of a planar geometric model bounded by O(n) monotone
curve segments. The algorithm runs in O(n) steps, where each step takes poly-
nomial time in degree d. In the following we consider the construction of the lower-
right subpart of the convex-hull boundary which lies between the bottommost
vertex Po and the rightmost vertex PM of the original object. The entire convex hull
is obtained by applying the same algorithm to the remaining three subparts.
Without loss of generality we may assume there are unique bottommost and
rightmost vertices.
In the following let C 1, C 2. . . . . C~t be a connected sequence of edges from Po to
PM, where each C~ has p~_ 1 and p~ as its starting and ending vertices, respectively.
For a point p# (resp. p#) we denote its x and y-coordinates by x# and y# (resp. x #
and y #). We also denote the line segment connecting two points p and q by L(p, q)
and the path from p to q along the boundary curve by ?(p, q). Also let A ~ B denote
everything in A which is not in B.

3.1. Sequences of Event Edge and Current Hull. We give a constructive definition
of a sequence of event edges {Cik}~= 1 with C~u = CM and a sequence of current hulls
{CHk}N= 1' Further, we show the following property of CHk:

(,) If p e 7(Po, Plk) is a point on the convex-hull boundary, then p ~ CHk and
the subarc of CHk between Po and p is on the convex-hull boundary.

This invariant (,) and the fact that PM is the endpoint of CH N imply that CH N is the
lower-right subpart of the convex-hull boundary between Po and P~t.
3.1.1. Definition of Ci~ and C H k. Let io = 0 and CH o = {Po}- Assume that the
index ik and the kth current hull CH k (0 < k < N) have been defined. We define the
(k + 1)th event edge Cik+, and the (k + 1)th event component E C k + 1 ~ Ci~,+ 1 in
terms of ik and CHk as follows, see also Figures 5 and 6. The terms lid and pocket,
544 C. Bajaj and Myung-Soo Kim

Pi k

/. / / / / _C_H
. k Pik+1-1

PO ~ ~- - -

Fig. 5. Event edge of case 3 with ECk+ 1 = Ci~,+t .

having similar meanings as in [18], are first used without definition and are
rigorously defined later.
1. If x ~ , l < xi~ and the inner angle of p~ < n, then

ik+ 1 = min{j[j > ik and xj > Xk}.

(a) E C k + 1 = C i k + l if yi~.l -- 1 < Yik+~ and Cik+l is convex,


(b) ECk+ 1 = Pi~., otherwise.
2. If xi~ < xi~+ 1, Y~k < Yik+l, and the inner angle ofpik < 3rc/2, then ik+ 1 = ik + 1.
(a) ECk+ 1 = Ci~+l if Ci~+l is convex,
(b) ECk+ 1 = Pi~+l otherwise.
3. Otherwise, let Jo be the smallest j such that j > ik + t, and either pj_ 1 is not
inside of any pocket of CHk with y~_ 1 < yj or Cj intersects with a lid L(p', p") at a
point p**, but it is not totally inside of the pocket implied by L(p', p"), and
further Xj-1 < xj, yj_ 1 < Yj, and y** < m i n { y . [ p , e 7(P~, Pj-1) c~ L(p', p")}.
(a) If Pjo- 1 is not inside of any pocket of CHk and either the inner angle of
Pjo-~ > rr or X~o < Xjo_ ~, then ik+~ = J o -- t and ECk+~ = p~+~.
(b) Otherwise, ik + ~ = Jo and
(i) E C k - 1 = Ci~ +l if Cik+l is convex, and
(ii) ECk+ t = L(p~+~ - 1, p~+ 1) otherwise.

Pilc

~~ C H k ~1

Fig. 6. Event edge of case 3 with E C k + 1 = P~k. i.


Convex Hulls of Objects Bounded by Algebraic Curves 545

Pik
h,
Cik) ~ Pik+l

P~ ~ o ~ ~-

Fig. 7. The (k + 1)th currenthullCHk+1.

Next we inductively define the (k + 1)th current hull CHk+ 1. It is easy to show
there is a unique common tangent line Lp,, p,, of CHk and ECk +1 (with x' < x" and
y' < y") such that CHk u ECk+I ~ HUE(L). If there is more than one choice ofp'
(resp. p'), we chose p' (resp. p") so that the distance between p' and p" is minimal.
Further, let FRONT_ CHk+ a denote the subarc of CHk between the points Po and
p', and R E A R C H k _ 1 denote the subarc of EC k+l between the points p" and
P ik+l. The (k + 1)th current hull CHk+I is defined as the connected union
FRONT_CHk+ 1 u L(p', p") ~ R E A R CHk+I, see Figure 7. CHk+1 is a convex arc
along which both x- and y-coordinates are strictly increasing. L(p', p") is called the
lid determined by p' and p". Let p be the closed path given as 7(P', P") followed by a
path from p" to p' along L(p', p'). If ~ has no self-intersection, the region bounded
by ~7is called the pocket determined by the lid L(p', p"). Otherwise, 7(P', P") has an
even number of intersections with the lid L(p', p") counting intersections with
multiplicities and p divides the plane into a finite number of connected regions. The
union of all the regions which are to the right of ~7is the pocket implies by L(p', p"),
see Figures 8 and 9.

3.1.2. Properties of CHk. We prove the invariant (.) of CHk in Lemmas 3.1
and 3.2.

Fig. 8. Simple pockets.


546 C. Bajaj and Myung-Soo Kim

p0-
P
Fig. 9. Self-intersecting pocket.

LEMMA 3.1. I f a point p ~ Ci(1 < i <_ ik) is on the convex-hull boundary, then
p ~ C H k.

PROOF. Using induction we can easily show that the interior of the path 7(Pik,
P~k+l - 1), the arc C~+ 1 ~ ECk+ 1, and ( CHk ~ cik+ 1) ~ CHk + 1 are in the convex-hull
interior. []

LEMMA 3.2. I f a point p ~ C H k is on the convex-hull boundary, then the subarc of


C H k between Po and p is contained entirely in the convex-hull boundary.

PROOF. The case k = 1 is easy to show. By induction, we assume for k(1 < k < N)
and consider k + 1. Assume a point p ~ CHk§ ~ is on the convex-hull boundary.
(a) If p ~ F R O N T _ C H k + 1 c CHk, then the statement follows by induction.
(b) If p ~ L(p', p"), then L(p', p") is also on the convex-hull boundary. Further,
F R O N T - C H k + 1 is on the convex-hull boundary by induction.
(c) If p ~ R E A R _ C H k § 1, then there is a supporting line Lp at p.

We now prove that the lid L(p', p") is on the convex-hull boundary. Assume there is
a boundary point q in the region R~, see Figure 10. We may assume q is extreme to
the outward normal direction of the lid and thus on the convex-hull boundary.
(i) If q ~ Cj(1 < j < ik+l), then Lemma 3.1 implies q ~ CH~,+I, however, this is
impossible since CHk+~ is convex.
(ii) Otherwise, there is a continuous path from Pik+l to q.

This path should pass through either the region R 2 or R3, however, both are
impossible. Hence the lid L(p', p") is on the convex-hull boundary, and by
induction F R O N T _ C H k + I is also on the convex-hull boundary. Similarly we can
show that the subarc of R E A R _ C H k + ~ between p" and p is on the convex-hull
boundary. []

Since p~ is on the convex-hull boundary and it is the endpoint of CHN, Theorem


3.1 below follows easily from Lemmas 3.1 and 3.2.
Convex Hulls of Objects Bounded by AlgebraicCurves 547

( /D
/ t!

/
~2k~" R2

Fig. 10. The Regions R1, R2, and R3.

THEOREM 3.1. CH N is the lower-right part of the convex-hull boundary between Po


and PM.

3.2. Description of the Algorithm. We describe an algorithm to compute the


sequences of event edges (Cik}~=l and current hulls {CHk}~=I by using a single
stack CH. The stack CH contains segments of the kth current hull CH k which are
subarcs of some convex edges, some linear edges, and the lids of pockets.
Consecutive elements on the stack share a common endpoint and the connected
sequence of elements on the stack CH generate the current hull CH k (we say then
that "the stack CH implies the current hull C H k " ).
3.2.1. Computing Event Edges. We start by pushing a single point interval [Po, Po]
into an empty stack CH. The stack CH implies the current hull CH o = {Po}.
A s s u m e i k is detected and the stack CH implies the kth current hull C H k (0 <_ k(N).
We consider how to detect i k + 1 using the stack CH. Since cases 1 and 2 of Section
3.1.1 are easy, we consider only case 3. We detect Jo by using a loop variable j
initialized to i k and by maintaining the following invariant f o r j at the beginning of
each loop:

(**) pj is outside (including the boundary) of any pocket of C H k and


T O P ( C H ) is not strictly below the horizontal line y = yj.

In each loop, j is first incremented by 1. Then: (1) if y~_ 1 < Yj with j > ik -[- 1, then
Jo = Jj (2) otherwise, pop all the stack elements until
(a) T O P ( C H ) which is a lid containing pj in the interior of its pocket, or
(b) T O P ( C H ) which is not strictly above the line y = yj.
In case (b), repeat the j-loop. In case (a), initially let p, be the first intersection of Cj
with L(p', p"). We let p, = Plk only when Plk has been detected by case 3(a), see
Figure 11. Next walk along the path y(pj_ 1, PM) and count the number of
right-to-left cuts and left-to-right cuts this path makes with the lid L(p', p"). At each
548 C. Bajaj and Myung-Soo Kim

~ pik Pik

Fig. l l . p,
w h e n j = ik + 1.

intersection point, say p** make p, = p** if y** < y,. While the number of
right-to-left cuts is larger than left-to-right cuts, we are inside the pocket implied by
L(p', pp"). In Figure 12, a path 7(p,, p j) is totally contained in a self-intersecting
pocket and has its first interior intersection with a lid L(p', p") in a right-to-left
direction. When 7(P,, Pj) comes out of a pocket through a point p**, the total cuts
in both directions are equal. If these two numbers become equal at a point
p** e C j,, compare y** with y,. If y** > y,, then continue walking along the path
7(P**, PM). If y** < y,, then
(i) let Jo = J' if y j,_ 1 < Yj', and
(ii) otherwise, let j = j' and further treat p** as pj and repeat the j-loop.
It is easy to show that the j-loop invariant holds everytime the loop is repeated and
Jo is detected correctly.

~iik+l "r(p,,;ik+~)

Fig. 12. ?(p,, pi) in the interior of a pocket.


Convex Hulls of Objects Bounded by AlgebraicCurves 549

procedure Detect-Event-Edge ( C H , ik, ik + 1, EC);


begin
if (xik + 1 -< Xik and the inner angle of Pi~ < n) then begin
ik+l = min{j[j > ik + 1 and x2 > xi~};
if(yi~+l- 1 < Yik+ l and Ci~+1 is convex) then E C = Cik+ l else E C = Pik+ l end;
else if (x~ < xi~ +I,Y~ < Yi~+1, and the inner angle of Pi~ < 3n/2) then begin
ik+ 1 = ik + 1;if (Ci~+l is convex) then E C = Ci~+~ else E C = Pik+l end;
else begin
j = ik; F O U N D = false;
while (not F O U N D ) do begin
j=j+l;
if (3)- 1 < Yj and j - 1 r then begin
F O U N D = true;
if (x j_ 1 -< xj and the inner angle of pj_ 1 < n) then begin
ik+ 1 = j , if (Cik+l is convex) then E C = Ci~+~ else E C =
L(pi~ +1 - 1,Pik + l) end;
else begin ik + ~ = j - 1; E C = Pi~ +1; end
else begin
Pop all the stack element until (a) a lid L(p', p") which contains pj
in the interior of the pocket bounded by the lid L(p', p") or (b) a
stack element which is not strictly above the horizontal line
y = yj;
if (pj is an interior point of the pocket bounded by the lid L(p', p")
which intersects with Cj at p,) then begin
D O N E = false, R i g h t L e f t C u t = 1; L e f t R i g h t C u t = O, Y M I N = y , ;
repeat
Skip all the subsequent edges until an edge C j, which
traversally intersects with L(p', p");
for (each transversal intersection point p** on Cj,) do begin
if (the intersection is a left-to-right cut)
then L e f t R i g h t C u t = L e f t R i g h t C u t + 1;
else R i g h t L e f t C u t = R i g h t L e f t C u t + 1;
if (y** < Y M I N and R i g h t L e f t C u t = L e f t R i g h t C u t )
then D O N E = true;
else Y M I N = m i n ( Y M I N , y**); end; (, for ,)
until ( D O N E ) ;
if (Yj,- 1 < Yj,) then begin ik+l = j ' ; F O U N D = true;
if (Ci~+l is convex) then E C = Ci~ +~ else E C = Pi~+1 end
elsej = j ' ; pj = p** end; end; end; end;
end; (, detect-Event-Edge ,)

3.2.2. Computing Current Hulls. We consider next how to construct C H k+ 1 from


CHk and ECk+ 1 using the stack CH. Though we have popped some stack elements
from C H , the elements on the stack C H imply a convex arc F which contains
F R O N T CHk+ 1. T o remove redundant elements F ~ F R O N T CHk+ 1 from C H ,
we consider the top stack element TOP(CH). We check whether T O P ( C H )
550 C. Bajaj and Myung-Soo Kim

contains the common tangent point p' for the new lid L(p', p') of CHk+~. Since
ECk+ ~ is not strictly below y = Ys, we have
(1) p' = PE if ECk+ 1 ~ H UL (Lp~) and ECk+ 1 is not strictly below the horizontal
line y = y~; otherwise,
(2) p' E T O P ( C H ) if ECk+~ c HUL(Lp,), and
(3) p' (~ T O P ( C H ) otherwise.

Here Ps and PE are the starting and ending points of TOP(CH), and Lp~ and Lp~ are
the tangent lines of T O P ( C H ) at Ps and PE, respectively. In cases (1) and (2), p' and
p" can be computed by using Lemmas 2.6-2.9. In case (3), we pop T O P ( C H ) and
repeat the same procedure. Once we have computed p' and p', we can adjust the
stack appropriately to imply CHk= 1. In the following code, SUPPI(C, D) (resp.
SUPP2(C,D)) is the function which returns the supporting point p' at C (resp. p" at
D) of the supporting line L such that C u D ~ H Ue (L).

procedure Update-Current-Hull (CH, EC);


begin
DONE = false;
while (not DONE) do begin
Let Ps and PE be the starting and ending points of TOP(CH);
Let Lp~ and LpE be the tangent lines of T O P ( C H ) at Ps and PE
respectively;
if(EC c HVL(LpE) and EC is not strictly below the horizontal line 3; =
YE) then begin
if (EC is a point Pik,l) then p" = Pik+l;
else if (EC is a convex edge C~k+1) then p" = SUPP2 (PE, Ci~+,);
else if (EC is a line segment L(pik+l _ 1, Pik+1)) then
if (P~k+1- 1 e H UL (L(pE, Pik + ~))) then p" = p~ +1 else p" = p~k+l - 1;
Push the lid L(pE, p") into CH;
if (p" ~ p~, 1) then
if (EC = Cik +1) then Push the subsegment of C~.1 between p"
and P~.I into CH;
else Push the lid L(Pik +1-1, Pik. ~) into CH;
DONE = true end;
else if (EC c HUL(Lp~)) then begin
if(EC is a point Pi,,+1) then p" = P~k+l and p' = SUPP1 (TOP(CH),
Pik+ 1);
else if (EC is a convex edge C~ +1) then
p'=SUPP1 (TOP(CH), C~k+~); p " = S U P P 2 (TOP(CH),
Ci~+l);
else if (EC is a line segment L(Pi . . . . P~. 1)) then begin
p' = SUPP1 (TOP(CH), p,~+ ~);
if (P~,,+I- ~ ~ HUL (L(p', p~. 1))) then p" = P~.+I ;
else p" = Pik=l-~; P' = SUPP1 (TOP(CH), Pi~,.l-1) end;
Let C = the subsegment of T O P ( C H ) between Ps and p';
Convex Hulls of Objects Boundedby AlgebraicCurves 551

Pop TOP(CH) from CH, and push C and the lid L(p', p") into CH;
if (p" -r Pik + 1) then
if (EC = C~+ 1) then Push the subsegment of Ci~+l between p"
and Pi~+l into CH;
else Push the lid L(pi~.l_ 1,Pi~+1) into CH;
DONE = true end;
else Pop TOP(CH) from the stack CH end; (, while ,)
end; (* Update-Current-Hull *)

3.3. Timing Analysis. There are basically two types of operations in this algo-
rithm. Operations to manipulate the edge sequence directly or operations to
manipulate the stack. Each edge as input is processed within a constant number of
steps before it is determined whether it is an event or not. If it is an event edge, a
segment of this edge is pushed on the stack. While an edge is on the stack, it may be
used to process other edges and/or the segment of this edge be changed into a
shorter subsegment. Finally, it is popped if it is not On the convex-hull boundary or
it appears in the final output as an edge of the convex-hull boundary.
Before an edge is determined to be an event edge or not, we apply to this edge
such computations as coordinate comparisons, an inner angle computation, and
intersections with stack elements. If a stack element is popped after certain
computations, we charge the cost of these computations to this popped stack
element. Since the popping occurs at most once to an edge, the cost of the popping
time will be charged at most once to each edge. Further, there is at most one stack
element which is involved in the operation with the input edge and still remains on
the stack. We can charge this cost and other trivial computation costs to the input
edge. The most expensive computation cost here is line-curve segment intersection
which is O(d 3 log d) (resp. O(d 3 log d + T(d))) time for a parametric (resp. implicit)
curve segment. Since there are totally O(n) input edges and popped edges, the
total cost for event edge detections is O(n. d 3 log d) (resp. O(n. (d 3 log d + T(d))))
time.
After an event edge is detected, the stack is modified to imply the new current
hull. The stack elements are popped after two half-plane containment testings
which cost O(d 3 log d) (resp. O(d 3 log d + T))) time. The new stack is constructed
by computing the lid L (p', p") and modifying itself appropriately, which costs at
most O(d 6 log d) (resp. O(d 12 log d + T(d))) time for common tangent computa-
tions. Note that this last operation takes constant time if both p' and p" are known,
and O(d 3 log d) (O(d 6 log d + T(d))) time if one of p' and p" is known. We charge
this cost to the event edge. Thus, the total cost for the current-hull computation is
O(n.d 6 log d) (resp. O(n.(d 12 log d + T(d)))) time, which is also the overall time
complexity of the convex-hull algorithm.

4. Conclusion. In this paper we propose an O(n.d 6 log d) (resp. O(n.(d 12 log


d + T(d)))) time algorithm to compute the convex hull of a planar curved object
bounded by O(n) rational (resp. nonrational) algebraic monotone curve segments.
Though within the same asymptotic time complexity, this paper improves [203 and
552 C. Bajaj and Myung-Soo Kim

[23] in the case of planar curved objects bounded by arbitrary algebraic curve
segments. Main differences between this algorithm and [20] and [-23] are:
(1) the boundary curves are divided into monotone curve segments by adding
inflection and extreme points as extra vertices in a preprocessing step,
(2) simple coordinate comparisons between vertex coordinates make many geo-
metric decisions very easy,
(3) it reduces the number of common tangent computations by detecting next
event edges with a correct orientation, and
(4) it is robust when used with approximations to save expensive computations in
the intermediate steps.
A robust implementation of this algorithm is currently underway.

References

[I] Abhyankar, S., and Bajaj, C. (1988), Automatic Rational Parameterization of Curves and
Surfaces, III: Algebraic Plane Curves, Computer-Aided Geometric Desion, Vol. 5, pp. 309-321.
[2] Aho, A., Hopcroft, J., and Ullman, J. (1974), The Design and Analysis of Computer Algorithms,
Addison-Wesley, Reading, Mass.
[3] Bajaj, C. (1988), Algorithmic Implicitization of Algebraic Curves and Surfaces, CAPO Research
Report CER-88-11, Department of Computer Science, Purdue University.
[4] Bajaj, C., Hoffman, C. M., Hopcroft, J. E., and Lynch, R. E. (1988), Tracing Surface Intersections,
Computer-Aided Geometric Design, Vol. 5, pp. 285-307.
[5] Bajaj, C., and Kim, M.-S. (1987), Generation of Configuration Space Obstacles: The Case of
Moving Algebraic Curves, Proceedings of the 1987 IEEE International Conference on Robotics
and Automation, North Carolina, pp. 979-984. An updated version appears in Algorithmica, Vol.
4, No. 2 (1989), pp. 157-172.
[6] Bajaj, C., and Kim, M.-S. (1988), Algorithms for Planar Geometric Models, Proceedings of the
15th International Colloquium on Automata, Languages and Programming (I CALP 88), Tempere,
Finland, Lecture Notes in Computer Science, Springer-Verlag, Berlin, pp. 67-81.
[7] Bajaj, C., and Royappa, A. (1988), A Note on an Efficient Implementation of the Sylvester
Resultant for Multivariate Polynomials, Computer Science Technical Report CSD-TR-718,
Purdue University.
[8] Bhattacharya, B., and E1 Gindy, H. (1984), A New Linear Convex Hull Algorithm for Simple
Polygons, IEEE Transactions on Information Theory, Vol. 30, No. 1, pp. 85-88.
[9] Canny, J. (1988), The Complexity of Robot Motion Planning, ACM Doctoral Dissertation Series,
MIT Press, Cambridge, Mass.
[10] Collins, G. (1971), The Calculation of Multivariate Polynomial Resultants, Journal of the
Association for Computing Machinery, Vol. 18, No. 4, pp. 515-532.
[11] Graham, R., and Yao, F. (1983), Finding the Convex Hull of a Simple Polygon, Journal of
Algorithms, Vol. 4, pp. 324-331.
[12] Guibas, L., Ramshaw, L., and Stolfi, J. (1983), A Kinetic Framework for Computational
Geometry, Proceedings of the 24th Annual Symposium on Foundations of Computer Science,
pp. 100-111.
[13] Johnstone, J., and Bajaj, C. (1990), The Sorting of Points along an Algebraic Curve, SIAM
Journal on Computing, to appear.
[-14] Lee, D. T. (1983), On Finding the Convex Hull of a Simple Polygon, International Journal of
Computer and Information Sciences, Vol. 12, No. 2, pp. 87-98.
[15] Lee, D. T., and Preparata, F. P. (1984), Computational Geometry--A Survey, IEEE Transac-
tions on Computers, Vol. 33, No. 12, December 1984, pp. 872-1101.
Convex Hulls of Objects Bounded by Algebraic Curves 553

[16] Macaulay, F. (1902), Some Formulae in Elimination, Proceedings of the London Mathematical
Society, Vol. 35, No. 1, pp. 3-27.
[17] McCallum, D., and Avis, D. (1979), A Linear Algorithm for Finding the Convex Hull of a Simple
Polygon, Information Processing Letters, Vol. 9, No. 5, pp. 201-206.
[18] Preparata, F. P., and Shamos, M. I. (1985), Computational Geometry: An Introduction, Springer-
Verlag, New York
[19] Requicha, A. (1980), Representations of Rigid Solid Objects, in Computer-Aided Design, Lecture
Notes in Computer Science, No. 89, Springer-Verlag, Berlin, pp. 2 78.
[20] Sch/iffer, A., and Van Wyk C. (1987), Convex Hulls of Piecewise-Smooth Jordan Curves, Journal
of Algorithms, Vol. 8, No. 1, pp. 66-94.
[21] Schwartz, J. T. and Sharir, M. (1983), On the Piano Movers Problem: II, General Techniques for
Computing Topological Properties of Real Algebraic Manifolds, Advances in Applied Mathema-
tics, Vol. 4, pp. 298 351.
[22] Shin, S., and Woo, T. (1986), Finding the Convex Hull of Simple Polygon in Linear Time, Pattern
Recognition, Vol. 19, No. 6, pp. 453-458.
[23] Souvaine, D. L. (1986), Computational Geometry in a Curved World, Ph.D Thesis, Computer
Science Technical Report CS-TR-094-87, Princeton University.
[24] van der Waerden, B. (1950), Modern Algebra, Vol. II, Ungar, New York.
[25] Walker, R., (1978), Algebraic Curves, Springer-Verlag, New York.

You might also like