Computing planar swept polygons under translation

Report 6 Downloads 83 Views
PII: S0010-4485(97)00030-4

Computer-Aided Design, Vol. 29, No. 12, pp. 825–836, 1997 q 1997 Elsevier Science Ltd. All rights reserved Printed in Great Britain 0010-4485/97/$17.00+0.00

Computing planar swept polygons under translation Kai Tang†, Ming-En Wang‡, Lin-Lin Chen§, Shuo-Yan Chou§, Tony C. Woo*} and Ravi Janardanek

different applications. For example, in geometric modeling, the volume of sweeping a curve is a surface; in robotics, the work envelope; and in machining, the material removed. (2) Inquiry 2: given G and D, describe the ‘‘path’’ traveled by G in the sweep. Given G and D, the ‘‘path’’ completely determines the sweep, i.e. any geometrical and topological inquiry, including finding the ‘‘volume’’, about the sweep can be answered through some operation on G, D and the path. Some examples of the ‘‘path’’ include, in geometric modeling, the ‘‘guide curve’’ of a sweep surface; in robotics, the trajectory of a finger; and in machining, the toolpath.

A translational sweep is the translating of a polygon, called the generatrix G, around another polygon, called the directrix D, under two conditions: (1) G is always in contact with D; and (2) the interiors of G and D do not intersect. Three classes of translational sweep are studied, including the case in which both G and D are convex; the case in which G is convex, D monotone; and the case in which both are monotone. Efficient algorithms for computing the trajectory and the swept area as well as geometric and computational properties are presented for each class. A notion called the inverse generatrix, which reveals a duality between the trajectory and the swept polygon, is introduced to reduce complexity. q 1997 Elsevier Science Ltd. All rights reserved

To be more precise, we now provide definitions for a sweep, and the ‘‘volume’’ and ‘‘path’’ of a sweep. In this paper, we consider sweeps in the plane, in particular, translational sweeps with polygonal generatrix and directrix.

Keywords: translational sweep, monotone polygon, trajectory, swept polygon

Definition 1.1 INTRODUCTION

A translational sweep, or sweep for short, is a pair (G, D), where the generatrix G and the directrix D are both simple polygons. Sweep (G, D) is the sequence of translations that move G around D under the following two conditions:

Moving a rigid body in free space is sometimes called sweeping. The body may be referred to as the generatrix G and the path as the directrix D. Sweeping finds application in various areas such as geometric modeling, computer graphics, robotics, and machining. For example, free-form sweep surfaces, generated by sweeping generatrix curves along directrix curves, are popular constructs in both geometric modeling 5,10,16 and computer graphics 3,7,9. In robotics, sweeps can be used to describe the work envelope of robots 2 or the collision-free zone of an environment 1,4,12,14. In NC machining, the toolpaths for machining a surface using a ball-end cutter is computer by ‘‘rolling’’ a ball along specified paths on the surface 6,19. While sweeps may appear in different forms and applications, they share two crucial inquiries:

(1) G is always in contact with D; and (2) G never overlaps D, i.e. their interiors never intersect.

Definition 1.2 The ‘‘volume’’, or area, swept by G in sweep (G, D) is called the swept polygon and denoted by j(G, D).

Definition 1.3 The ‘‘path’’, or trajectory, of a point g in G in sweep (G, D) is denoted T(G, D). Figure 1a shows a sweep to illustrate these notations. Note that the trajectories of any two points in G are equivalent by a translation due to G’s translational motion. Therefore, T(G, D) and T(g, D) are used interchangeably in the sequel. Different notions of translational sweeps in the plane have been proposed and studied 11,8,15,19. They can be classified according to their sweeping rules, which governs how G moves in the sweep, into two categories. The first category is the Minkowski sum 11,8,15, in which the generatrix G moves by fixing a reference point to D. The second category

(1) Inquiry 1: given G and D, describe the ‘‘volume’’ of the sweep. The ‘‘volume’’ means different things in *Author to whom correspondence should be addressed. Fax: +1 (206) 6853072 e-mail: [email protected] †Applicon Inc., USA ‡The University of Michigan, MI, USA §National Taiwan Institute of Technology, Taiwan }Industrial Engineering, University of Washington, P.O. Box 352650, Seattle, WA 98195-2650, USA kThe University of Minnesota, MN, USA Paper Received: 17 February 1996. Revised: 12 May 1997

825

Computing planar swept polygons: K Tang et al. both are monotone with respect to a common direction. Without loss of generality, let this shared monotone direction by the X axis. The development for each class of sweeps is built upon results from the preceding class(es). In each of the three classes, we establish crucial properties for the sweep and present efficient algorithms to compute the trajectory and the boundary of swept area. A notion called the inverse generatrix is introduced to reduce the complexity. All algorithms are easy to implement, and those for the first two classes are optimal in time and space.

SWEEPS UNDER TRANSLATION We begin with rephrasing the following two inquiries: (1) Inquiry 1: given G and D, compute j(G, D); and (2) Inquiry 2: given G and D, compute trajectory T(G, D). Given that G and D are simple and monotone, sweep (G, D) enjoys some special properties that greatly facilitate answering the two inquiries. Among those properties, the first one is on the trajectory T(G, D). As D is monotone to the X axis, or X-monotone, it can be partitioned at its left and right extreme vertices into two X-monotone chains: the top chain D t and the bottom chain D b (see Figure 2). Similarly, G can also be divided into G t and G b.

Theorem 2.1 Figure 1 A comparison of the translational sweep with the Minkowski sum

is the translational sweep defined in this paper, in which G moves around and not along D. A comparison of these two categories of sweeps is shown in Figure 1, in which Figure 1b is the Minkowski sum of G along the boundary of D. As can be seen from the figure, the major difference between the two is that the Minkowski sum does not always satisfy the ‘‘non-overlapping’’ property. In the Minkowski sum, the trajectory of G is D by definition, whereas in the translational sweep, the trajectory T(G, D) is not trivial. In fact, an alternative representation of sweep (G, D) is the Minkowski sum that has G as the generatrix and T(G, D) the directrix. This seems to suggest that we only need to answer Inquiry 2 by developing algorithms to compute the trajectory T(G, D), and then one of the known Minkowski sum algorithms 11,8,15, can be used to answer Inquiry 1. However, this proves not to be the case. While the algorithms in References 11,8,15 may be efficient for G and D of arbitrary shapes, the geometry of T(G, D) depends greatly on that of G. Hence, directly applying the Minkowski sum algorithm to answer Inquiry 1 is not efficient. Therefore, the translational sweep deserves special attention apart from the Minkowski sum. To be sure, there have been several efforts made to compute translational sweeps with simple generatrices. For example, scallop hulls 19 are sweeps with circular generatrices. The presentation is organized in four major parts: we start with presenting the basic properties of the translational sweep in Section 2, then answering the two inquiries for a simple class of sweeps in Section 3 in which both the generatrix and directrix are convex, for a broader class in Section 4 in which the generatrix is convex and the directrix monotone, and finally, in Section 5, for the class in which 826

In sweeping G along D, G t never comes in contact with D t, and G b never with D b (endpoints excluded).

Proof If G b (resp. G t) comes in contact with D b (resp. D t), then the interiors of D and G would intersect. From Theorem 2.1, the complete trajectory T(G, D) is obtained by combining the trajectory of G t along D b and that of G b along D t. As the sweep of G t along D b and that of G b along D t are computationally similar, by studying one, the other is also understood. Therefore, the definition of sweep needs to be extended to cover the case where the generatrix and the directrix are respectively chains from G and D. With this, we say that the trajectory T(G, D) can be obtained by connecting trajectories T(G t, D b) and T(G b, D t) at their two ends. In fact, T(G, D) is a simple polygon monotone to the X axis (see Lemma 5.2) with T(G t, D b) being its bottom chain and T(G b, D t) the top chain. Another property of sweep (G, D) resulting from the

Figure 2 Monotone chains

Computing planar swept polygons: K Tang et al. Table 1 Four types of contact events

G

Figure 3

Outer and inner boundaries of sweep (G, D b)

simplicity of G and D is on the topology of the swept polygon j(G, D).

Theorem 2.2 Given D and G both simply connected, the swept polygon j(G, D) is connected and is bounded by an inner loop and an outer loop, i.e. it is homeomorphic to an annulus.

Proof Since G and D are simply connected and j(G, D) is the envelope of the moving G around D, j(G, D) has to be connected and be bounded by at least two disjoint loops: an inner loop contacting D and an outer loop enclosing the entire swept area. Furthermore, since G is connected, there cannot be any void in j(G, D) besides the inner loop, hence the proof. According to Theorem 2.2, the swept polygon is completely described by the inner loop, which is denoted j i(G, D), and the outer loop, denoted j o(G, D). Examples of the inner and the outer loops can be found in Figure 1. As can be seen, the inner loop does not always equal the boundary of the directrix, and the areas sandwiched in between are called undercuts. Given that G and D are X-monotone, j i(G, D) and j o(G, D) are also X-monotone. But before presenting this as a theorem, we must first define the inner and outer boundaries of sweeps (G t, D b) and (G b, D t).

Definition 2.1 In sweep (G t, D b), the outer boundary j o(G t, D b) and the inner boundary j i(G t, D b) are respectively the bottom chain and part of the top chain of j(G, D b) that lies between the two X-extreme vertices of D b. Figure 3 illustrates the definition of the inner and the outer boundaries, which are drawn in bold, of sweep (G, D b). By observing symmetry, the outer boundary j o(G b, D t) and the inner boundary j i(G b, D t) of sweep (G b, D t) are similarly defined. Based on the above discussions, we will concentrate on the lower sweep (G t, D b) for the rest of this paper, knowing that (G b, D t) is symmetric with respect to the line of monotonicity and that the complete sweep (G, D) is a combination of the two, lower and upper sweeps. In particular, we consider translating G t from left to right along D b. This sweep starts with the right end of G t coinciding with the left end of D b and stops when the other two ends meet (see Figure 3).

Vertex Edge

D Vertex

Edge

VV EV

VE EE

The total horizontal distance traveled by G t equals the sum of the horizontal lengths of G and D. It is useful to classify contacts made between the generatrix and the directrix during the sweep. As no overlap is allowed, the contacts between G and D must always occur at vertices and/or on edges. Table 1 shows the four types of possible contact events. The VV event is ignored, since it is incidental to other types of events. And, it is helpful to think of trajectory T(G, D) as a sequence of contact events taking place in the sweep. The rest of the paper deals with the case in which both the generatrix and the directrix are convex, the case with convex generatrix and monotone directrix, and finally the monotone–monotone combination. Each is built upon the results from the preceding. In each, lemmas on the properties of the trajectory and the swept polygon are first established, and algorithms for answering the two queries then presented.

CONVEX GENERATRIX AND DIRECTRIX We consider the CC sweep in which both the generatrix and the directrix are convex. As the focus is now on the subsweep (G t, D b), there is a need for the definition of convexity of chains. A chain of edges is said to be ‘‘convex’’, if connecting the two end points with a straight edge produces a convex polygon. We assume that both D and G are directed counterclockwise and define a reverse operator on directed edges.

Definition 3.1 If e ¼ (v 1, v 2) is a directed edge from vertex v 1 to v 2, then ve ¼ (v 2, v 1) is the same edge with the opposite direction. The reverse operator can also be applied to directed chains. For example, if C is a chain of directed edges e 1, e2 ; …, e k, then vC is the chain of reversed edges ve1 , ve 2,…, ve k. Note that applying the reverse operator to a chain does not change the order of the edges. With definitions now adequate, the results on the CC sweep are presented.

Lemma 3.1 For the CC sweep, the trajectory T(G t, D b) is a chain of the edges in vG t and D b ordered by the slope*.

Proof Due to convexity, edges in vG t as well as edges in D b are arranged in ascending order of the slope. Furthermore, all the edges in vG t and D b have slopes in the open interval * The slope of a directed edge (p, q) is the tangent tan(v), where v is the polar angle of the vector from p to q measured clockwise from the positive X direction.

827

Computing planar swept polygons: K Tang et al. convex and X-monotone; and (ii) for G with n edges and D with m edges, the sizes of TðG; DÞ, ji ðG; DÞ, and j o(G, D) are no greater than, respectively, (m þ n), m and (m þ 2n). Three procedures are in order for computing T(G t, D b) and j(G tD b). Procedure Trajectory_CC Input: Convex generatrix G t and convex directrix D b Output: Trajectory T(G, D) begin Merge the lists of edges vG t and D b, which are already sorted by slopes, into a single sorted list; Return the sorted list of edges; end

Figure 4

Ordering of edges by slope

(¹`, `) due to their X-monotonicity. Consider the first contact event of the sweep, in which the VV event is instantaneous. As the event proceeds to VE or EV, the generatrix moves along one of the two edges, one from G and the other from D, whichever has a smaller slope. For example, the edge in bold in Figure 4a belonging to D has a smaller slope than that of G; G slides along it. On the other hand, in Figure 4c, the edge from G has a smaller slope. At the end of the move, when two vertices meet forming a VV event, the next event is a translation of G along one of the two upcoming edges that has a smaller slope (see Figure 4b,d). Hence the proof.

Lemma 3.2 For the CC sweep, (i) the inner boundary j i(G t, D b) is D b; and (ii) the outer boundary j o(G t, D b) is a chain of all edges in vG t, G b and D b arranged in ascending order of the slope.

Procedure SweepI_CC Input: Convex generatrix G t and convex directrix D b Output: Inner chain j i(G t, D b) begin Return edges of D b in a list; end Procedure SweepO_CC Input: Convex generatrix G t and convex directrix D b Output: Outer chain j o(G t, D b) begin G Dl Initialize a starting point vlD þ (vG l ¹ vr ), where v G and vl are the leftmost vertices of D and G, and vG r the rightmost of G; Merge the lists of edges of vG t, G b and D b, which are already sorted by slopes, into a single sorted list; Return the sorted list of edges; end The three procedures Trajectory_CC, SweepI_CC and SweepO_CC are clearly all linear time and linear space algorithms.

Corollary 3.4 For the CC sweep, both the trajectory and the swept polygon can be obtained in O(m þ n) time and O(m þ n) space, which are optimal.

Proof The proof for (i) follows immediately from convexity of G and D. To prove (ii), first note that as G is convex, the edges in G b can ‘‘impart’’ themselves to the outer boundary only when G ‘‘makes turns’’ in the sweep by sliding along different VE or EV events. And the turns of G are marked by the vertices of trajectory T(G t, D b). As can be seen from Figure 5, when turning from edge t i to edge t iþ1 in T(G t, D b), the edges of G b whose slopes fall between the slopes of t i and t iþ1 impart themselves to the outer boundary. This means that the outer boundary is a chain of edges in G b and T(G t, D b) ordered by the slope. A result similar to Lemma 3.1 is mentioned without proof in Reference 11 (p. 105, Section 4.4) for the Minkowski sum of two ‘‘similarly oriented’’ convex polygons. Based on Lemmas 3.1 and 3.2, important properties of the trajectory and the swept polygon can be established.

Corollary 3.3 For the CC sweep, (i) TðG; DÞ, j i(G, D) and j o(G, D) are all 828

Figure 5 Ordering of edges in the outer boundary of the sweep

Computing planar swept polygons: K Tang et al. endpoint, two successive subtractories must intersect, making the lower envelope a single chain. To show that the lower envelope is the trajectory, we take a vertical section of the subtrajectories at an arbitrary horizontal position, which is a set of vertically aligned points. Clearly the generatrix G must be positioned at the lowest point in the section, otherwise G would overlap D. As can be seen from Figure 6c, the overall trajectory and the outer boundary, both in bold, are the lower envelopes of the subtrajectories and the sub-outer chains.

Lemma 4.2 For the CM sweep, both the trajectory T(G t, D b) and the outer boundary j o(G t, D b) are X-monotone.

Proof

Figure 6

Computing trajectory and outer loop for the CM sweep

The X-monotonicity follows from the definition of lower envelope. By Corollary 3.3, the total size of the subtrajectories and that of the sub-outer chains are both O(m bn t), thus posing an upper bound for the trajectory and the outer loop.

Corollary 4.3 CONVEX GENERATRIX AND MONOTONE DIRECTRIX

For the CM sweep, the trajectory and the outer loop of the swept polygon are both of size O(mn).

With results of the CC sweep as basis, we now consider the CM sweep in which the generatrix is convex and the directrix X-monotone. We first describe the computation for the trajectory and the outer boundary, and then for the inner boundary.

Computing inner loop

Computer trajectory and outer loop As illustrated in Figure 6, our strategy to compute the trajectory and the outer boundary of a CM sweep is: first partition the directrix into convex chains; solve the CC problems for each convex chain by applying results for the CC sweep; and then merge the CC solutions to obtain a CM solution. By breaking D b at the reflex vertices, we obtain some convex chains D 1, D 2,…, D k with each chain D i having a size m i. I we use m b and n t to denote respectively the sizes of D b and G t, by construction, jm i ¼ m b. By applying procedure Trajectory_CC, the subtrajectory T(G t, D i) for each D i is then computed. After properly positioning the subtrajectories relative to each other, the overall trajectory T(G t, D b) is then obtained by taking the lower envelope. Computation of the outer boundary j o(G t, D b) is similar.

Lemma 4.1 For a CM sweep, the trajectory T(G t, D b) (resp. the outer loop j o(G t, D b)) is the lower envelope of the subtrajectories T(G t, D i), i ¼ 1, 2,…, k (resp. the sub-outer chains jo (Gt , D i), i ¼ 1, 2,…, k).

In computing the inner loop, the focus is on the undercuts. As defined earlier, undercuts are the areas sandwiched between the directrix and the inner loop (see Figure 1). For a CC sweep, every edge of the directrix appears in the trajectory, which implies that the entire directrix is ‘‘touched’’ by the generatrix during the sweeping, and thus the inner loop is the directrix itself. This is still true when considering each subsweep (G t, D i3) individually. However, as we assemble the convex chains D i’s back together to compute the overall trajectory, some parts of the subtrajectories are trimmed off, indicating that certain portions of D b are not touched in the overall sweep and thus the existence of undercuts (see Figure 6c). In a CM sweep, each undercut is bounded from above by a chain of edges in D b untouched by G and from below by a chain of edges in G t. Therefore, the inner boundary j i(G t, D b) can be obtained by substituting the untouched chain with the bottom chain for each undercut. Based on the above discussions, each intersection of the subtrajectories left in T(G t, D b) implies the possible existence of an undercut. According to Lemma A.3 in Appendix A, there are at most m b such intersections, and each undercut adds at most n t edges to the inner boundary.

Corollary 4.4 For a CM sweep, the size of the inner loop is O(mn). Finally we claim without proof that the inner boundary j i(G t, D b) is X-monotone.

Proof Algorithm and complexity analysis We give a proof for the trajectory. The proof for the outer loop is similar. Since two adjacent convex chains share an

Based on above discussions, three procedures to compute 829

Computing planar swept polygons: K Tang et al. the trajectory and the inner and outer loops are now in order, followed by analyses of complexities. Procedure Trajector_CM Input: Convex generatrix G t and X-monotone directrix Db Output: Trajectory T(G t, D b) begin Step 1 Partition D b into X-monotone convex chains D 1, D 2,…, D k. Step 2 Compute the subtrajectories and their lower envelope. t 0 ← an empty chain for i ¼ 1,2,…, k do TðGt ; Di Þ ← Trajectory_CC(G t, D i) t i ← LowerEnvelope_CM(ti ¹ 1 , T(G t, D i)) / *LowerEnvelope_CM is detailed in the complexity analysis below. */ Step 3 Return the lower envelope t k. end Procedure SweepI_CM Input: Convex generatrix G t and X-monotone directrix Db Output: Inner boundary j i(G t, D b) begin Step 1 Initialize a list L representing chain D b. Step 2 Compute T(G t, D b) by calling procedure Trajectory_CM. Step 3 For each intersection of the subtrajectories left in T(G t, D b), if a corresponding undercut exists, replace the top chain of the undercut in L with the bottom chain. Step 4 Return L. end Procedure Sweep O_CM Input: Convex generatrix G t and X-monotone directrix Db Output: Outer chain j o(G t, D b) begin Step 1 Partition D b into X-monotone convex chains D 1, D 2,…, D k. Step 2 Compute the sub-outer chains. S 0 ← an empty chain for i ¼ 1, 2,…, k do jo ðGt ; Di Þ ← SweepO_CC(G t, D i) Si ←LowerEnvelope_CM(S i¹1, j o(G t, D i)) Step 3 Return the lower envelope S k. end We now consider the time and space complexities of procedure Trajectory_CM. As the convex partition is obtained by segmenting D b at its reflex vertices, the first step clearly takes O(m b) space and time, and the number of convex chains thus obtained, k, is O(m b). In each iteration of step 2, two calls are made, one to procedure Tractory_CC and the other to LowerEnvelope_CM. According to Corollary 4.3, all calls to procedure Trajectory_CC in step 2 take a combined O(m bn t) time and space. As to the calls to procedure LowerEnvelope_CM, for which a detailed analysis is presented in Appendix A, the total time is linear to the total size of the subtrajectories, which is O(m bn t), plus the total number of edges trimmed off, which is also O(m bn t). Therefore, the overall time and space required by step 2 are both O(m bn t). As the construction of the outer loop is similar to 830

Figure 7 Determining bottom chain of an undercut

that of the trajectory, the analysis of procedure SweepO_CM is similar to the above.

Corollary 4.5 The trajectory T(G, D) and the outer loop j o(G, D) can be obtained in O(mn) time and (mn) space, both of which are optimal, by using procedures Trajectory_CM and SweepO_CM, respectively. Next we consider procedure SweepI_CM. Step 1 can be completed in O(m b) time, and step 2 in O(m bn t) time (Corollary 4.5). In step 3, we examine each intersection in T(G t, D b) for possible undercuts. By properly labeling the events in T(G t, D b), positions of the two X-extreme points of an undercut in both G t and D b can be determined from the labels in constant time. With these, the chain L is then updated by replacing the top chain of the undercut, which is a segment of D b, with the bottom chain, which may come in two forms. For a point intersection, the bottom chain of undercut is the segment of G t between the X-extreme points. Figure 7a shows an example, where the undercut is the shaded area under D b, the X-extreme points marked with dots, and the bottom chain in bold. As when the intersection is a line segment of an edge l, the bottom chain is a line segment parallel to l connecting the X-extreme points. An example for this case is shown in Figure 7b, where the bottom chain is again in bold, and the two ends of the intersection marked by empty dots. By representing chain L as a list, handling each undercut takes a time proportional to the total number of edges removed and edges added to L. With events in T(G t, D b) labeled, step 2 takes O(m bn t) time and space.

Corollary 4.6 The inner loop j i(G, D) can be obtained in the optimal O(mn) time and O(mn) space by using procedure SweepI_CM.

Computing planar swept polygons: K Tang et al.

MONOTONE GENERATRIX AND DIRECTRIX We now consider the MM sweep in which both the generatrix G and the directrix D are X-monotone. Again we start by concentrating on computing the trajectory. Our strategy here is to divide a MM problem into several CM problems. We partition the generatrix G t into convex chains G 1, G 2,…, G 1 (of sizes n 1, n 2,…, n l, respectively), and then apply algorithm Trajectory_CM to compute the subtractories T(G i, D b) for all i. By choosing a reference point in G, the subtrajectories are then positioned in proper relative positions. The trajectory T(G t, D b) is the lower envelope of the subtrajectories.

Lemma 5.1 Trajectory T(G t, D b) is the lower envelope of the subtrajectories T(G i, D b), i ¼ 1,2,…, l.

Proof The proof is similar to that of Lemma 4.1. Since each subtrajectory T(G i, D b) is X-monotone by Lemma 4.2 and has O(m bn i) size, a lemma on the monotonicity and the size of T(G, D) is in order.

Lemma 5.2 For a MM sweep, the trajectory T(G, D) is X-monotone and is of size O(mn).

Proof It follows from Lemmas 5.1, 4.2, and Corollary 4.3. Due to non-convexity of the generatrix, the computation of the inner and outer loops cannot be easily reduced to CC and/or CM problems. However, by introducing an operator called the inverse generatrix† we are able to provide an elegant solution to the MM problem.

Definition 5.1 The inverse generatrix I(G) is the mirror image of G about a point. An interesting inverse relationship between the trajectory and the two loops is revealed via the inverse generatrix. By now, we know that the trajectory T(G, D) is obtained by either sweeping the generatrix outside j i(G, D) or inside j o(G, D). With the inverse generatrix, it is observed that the two loops of j(G, D) can be retraced by sweeping the inverse generatrix along the two sides of T(G, D). Before giving an example, we define a Boolean-complement operator for clarity.

Definition 5.2 The Boolean complement ¹A of a polygon A is the complement of the interior of A. The sweep shown in Figure 1 is used as an example to illustrate the above observation. As can be seen in Figure 8, the trajectory T(G, D) shown in Figure 1 is now used as the † A similar notion called the ‘‘inverse offset method’’ was used to approximate the offset of curved surfaces for collision detection and machining simulation 17,18.

Figure 8 Computing inner and outer loops using inverse generatrix

directrix, and the inverse generatrix I(G) the generatrix. By comparing Figures 8, and 1, we can see that the inner loop j i(G, D) and the outer loop j o(G, D) in Figure 1 are equivalent to trajectories TðIðGÞ, ¹TðG; DÞÞ and TðIðG0, T(G, D)), respectively.

Lemma 5.3 The outer loop j o(G, D) and the inner loop ji ðG; DÞ are equivalent to trajectories TðIðGÞ, T(G, D)) and T(I(G), ¹ T (G, D)), respectively.

Proof Without loss of generality, we present the proof using a fixed point g in G as the reference. Let I(g) be the image of g in the inverse generatrix I(G). To facilitate discussion, we extend the notion of trajectory to discrete points with the sweeping generatrix implied. For example, T(g, D) is the trajectory of point g in sweep ðG; DÞ, and T(I(g), T(g, D)) the trajectory of I(g) in sweep (I(G), T(g, D)). The euivalence is proved in three steps: we first show that both trajectories TðIðgÞ, Tðg; DÞÞ and T(I(g), ¹T(g, D)) are simple without self-intersection, then we show that, during the sweeps ðIðGÞ, Tðg; DÞÞ and (I(G), ¹T(g, D)), the inverse reference I(g) can neither stray outside nor inside the swept polygon j(G, D). Due to the X-monotonicity of D and G, T(G, D) is Xmonotone (by Lemma 5.2), hence simple. Therefore, both 831

Computing planar swept polygons: K Tang et al. A partial swept polygon is shown in Figure 9 as an example, where I(G)9 and I(G)0 are instances of I(G) making contacts at the same point from the two sides of T(g, D). Let d denote the length of G projected onto any line orthogonal to e, and d9 and d0 respectively the orthogonal distances from points I(g)9 and I(g)0 to e. By construction, the sum of d9 and d0 equals d. Now, moving G along e contributes to the boundary of j(G, D) two edges parallel to e, one each to the two loops. Intuitively, the distance between these two parallel edges (or the ‘‘local width’’ of j(G, D)) equals d. Hence, moving either one of I(g)9 or I(g)0 into the interior of j(G, D) forces the other out to the exterior, which is impossible as shown earlier. The X-monotonicities of the inner and the outer loops follow from Lemma 5.2 and Lemma 5.3.

Corollary 5.4

Figure 9

Computing inner and outer loops using inverse generatrix

trajectories TðIðgÞ, Tðg; DÞÞ and TðIðgÞ, ¹T(g, D)) are Xmonotone (again by Lemma 5.2), hence simple. During the sweeps ðIðGÞ, Tðg; dÞÞ and (I(G), ¹T(g, D)), IðGÞ keeps constant contact with the trajectory of point g in sweep (G, D). By symmetry, for every instance of I(G) in sweep ðIðGÞ, Tðg; DÞÞ or sweep (I(G), ¹T(g, D)), there exists an instance of G in sweep (G, D) that ‘‘touches’’ point I(g). As a result, the inverse reference I(g) cannot stray outside j(G, D), which is the envelope of the moving G. We now show that I(g) cannot move into the interior of jðG; DÞ in the sweeps ðIðGÞ, Tðg; DÞÞ and (I(G), ¹T(g, D)). Consider a particular moment in sweep (I(G), T(g, D)) or ðIðGÞ, ¹ Tðg; DÞÞ, when IðGÞ contacts an edge e in T(g, D).

For the MM sweep, both the inner loop j i(G, D) and the outer loop j o(G, D) are X-monotone. For completeness, upper bounds on the sizes of the inner loop and the outer loop are also provided.

Lemma 5.5 For the MM sweep, the size of the inner loop is O(mn).

Proof Similar to the CM sweep, there can be at most O(m) disjoint undercuts, and each undercut may contribute up to O(n) edges to the inner loop. While the O(mn) bound for the inner loop is expected, the size of outer loop is surprisingly O(mn 2) due to the multiplicative effect of the sizes of D, G t and G b.

Lemma 5.6 For the MM sweep, the size of the outer loop is O(mn 2).

Proof Consider the lower sweep (G t, D b). According to Lemma 5.2, the trajectory T(G t, D b) is X-monotone and is of size O(m bn t). Then, Lemma 5.3 implies that the outer boundary jo ðGt ; Db Þ is equivalent to the trajectory T(G b, T(G t, D b)). Combining the two, we see that j o(G t, D b) is of size Oðmb nt nb Þ, which gives an O(mn 2) bound for the size of j o(G, D). By using an example, we show that this upper bound is tight. As can be seen from Figure 10, the outer boundary j o(G t, D b) has m n mb þ nt þ b t (nb ¹ 2) þ 2 ¼ 2 þ 4 þ (1)(2)(4) þ 2 ¼ 16 2 2

Figure 10 An MM sweep with v(mn 2) outer boundary

832

edges. If we increase the sizes of G and D shown in Figure 10 ‘‘horizontally’’ by duplicating the ‘‘bumps’’ under proper conditions, it is easily seen that the resulting outer loop is of size v(mn 2). According to Lemma 5.3, the boundary of swept polygon j(G, D) can be obtained by simply applying the algorithm Trajectory_MM repeatedly: once for T(G, D), and then

Computing planar swept polygons: K Tang et al. twice for TðIðGÞ, TðG; DÞÞ and TðIðGÞ, ¹T(G, D)). Procedure Trajectory_MM Input: X-monotone generatrix G t and directrix D b Output: Trajectory T(G t, D b) begin Step 1 Partition G t into convex chains G 1, G 2,…, G l. Step 2 Compute subtrajectories T(G i, D b) for all i. for i ¼ 1,2, …, l do T(G i, D b) ← Trajectory_CM(G i, D b) Step 3 Via divide and conquer, compute lower envelope of the subtrajectories by calling procedure LowerEnvelope_MM, which is outlined in Section 5.1. Step 4 Return the lower envelope T(G t, D b). end Procedure Sweep_MM Input: X-monotone generatrix G t and directrix D b Output: Inner loop j i(G, D) and outer loop j o(G, D) begin Step 1 Compute trajectory T(G, D) by calling procedure Trajectory_MM. Step 2 Compute the inner loop and the outer loop by calling procedure Trajectory_MM. ji (G, D) ← T(I(G), ¹ T(G, D)) jo (G, D) ← T(I(G), T(G, D)) Step 3 Return the inner loop and the outer loop. end

algorithm is possible. However, procedure Sweep_MM is much simpler to implement.

CONCLUSION In this paper, we study three kinds of translational sweeps: the CC sweep, the CM sweep, and the MM sweep. For each, efficient algorithms are developed, and crucial properties established on the geometry and the sizes of the sweep trajectory and the swept polygon. The results are structured in a hierarchical manner with the more complex ones built upon the simpler ones. The dependencies among the algorithms presented are shown in Figure 11, in which an arrow from procedure A to procedure B indicates that B is a subroutine of A. The six algorithms developed for the CC and the CM sweep are optimal in both space and time. Due to the inherent hierarchy, algorithms presented in this paper are codeefficient and simple to implement. A notion called the inverse generatrix, which reveals an interesting duality between the trajectory and the swept polygon, is used to reduce the complexity of computation.

APPENDIX COMPUTING LOWER ENVELOPES FOR CM SWEEPS This appendix contains discussions on how to efficiently compute lower envelopes for CM sweeps. Some lemmas are first presented, followed by a description of the procedure LowerEnvelope_CM.

Time and space complexities

Lemma A.1

Consider procedure Trajectory_MM first. Step 1 takes O(n t) time, and step 2 O(m bn t) time and space. In step 3, we compute the lower envelope of the subtrajectories via divide and conquer, in which a rudimentary routine is required to compute the lower envelope of two monotone chains. The lower envelope of two monotone chains clearly can be determined in a time linear to their combined sizes by traversing the two in vertical sync. As a result, each level in the divide and conquer requires time and space proportional to the total size of the subtrajectories, which is O(m bn t), and, in turn, step 3 takes Oðmb nt log n t) time and O(m bn t) space.

If there exist simultaneous contact events at a given point in the sweep (G, D), then the events are either EV and/or EE, and all involve the same edge in G.

Corollary 5.7 For the MM sweep, the trajectory T(G, D) can be obtained in O(mn log n) time and O(mn) space by using procedure Trajectory_MM. Next we consider procedure Sweep_MM. Based on the preceding discussions, step 1 takes O(mn log n) time and O(mn) space (Corollary 5.7), and step 2 takes O(mn 2 log n) time and O(mn 2) space (Lemma 5.2 and Corollary 5.7).

Corollary 5.8 For the MM sweep, the inner loop j i(G, D) and the outer loop j o(G, D) can both be obtained in O(mn 2 log n) time and O(mn 2) space by using procedure Sweep_MM. For the outer loop, the space is optimal according to Lemma 5.6, and the time is only a small factor, log n, away from the optimal. As for the inner loop, a more efficient

Proof Recall that the VV events are ignored, because they are incidental. Only VE, EV and EE events which contribute to the motion of G are considered. Since G is convex, when G moves on a VE event, there cannot be any other simultaneous event (see Figure 12). As a result, simultaneous events are either EV or EE. Moreover, no two edges in G are parallel due to its convexity, thus simultaneous events can only involve one edge in G.

Lemma A.2 During the sweep ðGt ; Db Þ, let p l and p r in D b be, respectively, the leftmost and the rightmost points of the moving contact G t ∩ Db . (1) Both p l and p r move monotonically to the right in D b. (2) A point p in D b could only enter into the contact when p r passes by it horizontally, and if so, p leaves the contact when p l passes by; otherwise p never enters the contact.

Proof To prove that p l moves monotonically to the right, we freeze the generatrix at a certain point in the sweep and divide the 833

Computing planar swept polygons: K Tang et al.

Figure 11 Procedure dependencies

plane into two half planes by building a boundary that includes a semi-infinite ray shooting upward from p l, the partial chain in G t from p l to the left extreme vertex v l, and a semi-infinite ray shooting downward from v l, all of which are marked by dark lines in the example shown in Figure 13. The point p l partitions D b into a left chain D b l and a right chain D b r. As can be seen from Figure 13, D b l lies completely in the left half plane, and D b r in the right half plane. Due to the X-monotonicity of D b and convexity of G, when G moves further along in the sweep, it travels farther into the right half plane and never returns to the left half plane again, which implies that G will not touch D b l in the rest of the sweep. Therefore the left end of the contact p l moves monotonically to the right in D b. By reversing the horizontal direction of the sweep (G t, D b), the monotonical motion of p r can be similarly proven.

Based on (i), statement (ii) is clearly true at times when there is only a single contact event, be it EV, VE, or EE. As to times when simultaneous contact events occur, according to Lemma A.1, all the events occur on the same edge in G i, and (ii) is seen to be true. As multiple intersections are possible, finding the lower envelope of two arbitrary chains generally requires a time proportional to the combined size. An optimal O(n log n) algorithm is known 13 for computing the upper envelope of n line segments. Therefore, at first glance, the lower envelope computation of the subtrajectories as outlined in the procedures Trajectory_CM and SweepO_CM could take O(m 2n log mn) time. However, observations to be presented below would reduce our computation of the lower envelope to O(mn) time. Let T i, called the partial trajectory, denote the lower envelope to T(G t, D j), j ¼ 1,…, i.

Lemma A.3 The intersection between the partial trajectory T i¹1 and subtrajectory T(G t, D b) is either a point or a line segment.

Proof

Figure 12 Singular VE event

When appending D i to the partial chain D 1 D 2…D i¹1, Lemma A.2 implies that there is a unique transition in T i from the partial trajectory T i¹1 to the subtrajectory T(G t, D i). As T i is the lower envelope of T i¹1 and T(G t, D i), the intersection between the two trajectories is a connected chain of edges. Furthermore, according to Lemma A.1, the intersection is either a point when the transition involves a single EV or VE event, or a line segment otherwise. A similar relationship between the partial outer boundary S i¹1 and the sub-outer chain j o(G t, D i) follows directly from Lemma A.3, where S i is the lower envelope of j o(G t, D j), j ¼ 1,…, i.

Corollary A.4

Figure 13 Monotonical motion of contact

834

The intersection between the partial trajectory S i¹1 and the sub-outer chain j o(G t, D i) is either a point or a line segment. By exploiting Lemma A.3 and Corollary A.4, the procedure LowerEnvelope_CM is specially designed to reduce the time complexity. Not to confuse the reader with notations,

Computing planar swept polygons: K Tang et al. we describe procedure Lower Envelope_CM using the partial trajectory T i¹1 and the subtrajectory T(G t, D i), but the procedure is applicable to S i¹1 and j o(G t, D i) as well. To compute the lower envelope, T i¹1 and T(G t, D i) are first put in proper relative positions‡. We then traverse the subtrajectory from right to left. In the beginning, T i¹1 appears above T(G t, D i), and then the intersection is detected by a switch in this vertical relationship. After determining the location of the intersection, the lower envelope is then obtained by merging two lower chains, the chain in T(G t, D i) to the right of the intersection and the chain in T i¹1 to the left of the intersection. The time complexity of LowerEnvelope_CM is linear to the size of T(G t, D i) plus the number of edges in T i¹1 that do not appear in the lower envelope.

REFERENCES 1. Bajaj, C. L. and Kim, S., Generation of configuration space obstacles: the case of moving algebraic curves. Algorithmica, 1989, 4, 157–172. 2. Blackmore, D., Leu, M. C. and Wang, W., Classification and analysis of robot swept volumes. In Proc. Japan–USA Sympos. Flexible Automation Part 1 (of 2). San Francisco, CA, 1992. 3. Bronsvoort, W. F., A surface-scanning algorithm for displaying generalized cylinders. Visual Comput., 1992, 8(3), 162–170. 4. Canny, J., The Complexity of Robot Motion Planning. MIT Press, Cambridge, MA, 1988. 5. Choi, B. K., Surface Modeling for CAD/CAM. Elsevier, New York, 1991. 6. Elber, G. and Elaine, C., Toolpath generation for freeform surface models. Computer-Aided Design, 1994, 26(6), 490–496. 7. Evans, R. C., Koppelman, G. and Rajan, V. T., Shaping geometric objects by cumulative translational sweeps. IBM J. Res. Develop., 1987, 31, 343–360. 8. Farouki, R. T. and Kaul, A., Computing Minkowski sums of plane curves. International Journal of Computational Geometry and Applications, 1995, 5(4), 413–432. 9. Foley, J. D., van Dam, A., Feiner, S. K. and Hughes, J. F., Computer Graphics: Principles and Practice. Addison-Wesley, New York, 1990. 10. Ghosh, P. K., A mathematical model for shape description using Minkowski operators. CVGIP, 1988, 44, 239–269. 11. Guibas, L. J., Ramshaw, L. and Stolfi, J., A kinetic framework for computational geometry. Proc. 24th Ann. IEEE Sympos. Found. Comput. Sci., 1983, 100–111. 12. Guibas, L. J., Sharir, M. and Sifrony, S., On the general motionplanning problem with two degrees of freedom. Discrete Comput. Geom., 1989, 4(5), 491–521. 13. Hershberger, J., Finding the upper envelope of n line segments in O(n log n) time. Information Processing Letters, 1989, 33(4), 169–174. 14. Lozano-Perez, T. and Wesley, M., An algorithm for planning collision-free paths among polyhedral obstacles. Comm. ACM, 1979, 22, 560–570. 15. Ramkumar, G. D., An algorithm to compute the Minkowski sum outer-face of two simple polygons. In Proc. Twelfth Annual Symp. on Computational Geometry. FCRC ’96, Philadelphia, PA, 1996, pp. 234–241. 16. Rossignac, J. R. and Requicha, A. G., Offseting operation in solid modelling. Comput. Aided Geom. Design, 1986, 3, 129–148. 17. Suzuki, H., Kuroda, Y., Sakamoto, M., Haramaki, S. and Van Brussel, H., Development of the CAD/CAM system based on parallel processing and the inverse offset method. In Proc. World Transputer User Group (WOTUG) Conf.. Transputing ’91, Sunnyvale, CA, 1991, pp. 184–98. 18. Suzuki, H., Kuroda, Y., Sakamoto, M. and Motomura, N., Real time numerical control system for metal molds and dies machining. III. Real time CAM processing based on the inverse offset method. J. Japan Society of Precision Engineering, 1991, 57(3), 473–478.

‡ To visualize the description, use Figure 6(b,c) as illustrations, in which i ¼ 2 and T i¹1 ¼ T(G, D 1).

19. Woo, T.C. et al., Scallop hull and its offset for a monotone chain in linear time. Computer-Aided Design, 1994, 26, 537–542.

Kai Tang received a PhD in computer science from the University of Michigan, USA, in 1990. He also has a BSE in mechanical engineering. Since 1991, he has been with Applicon (formerly Schlumberger CAD/CAM) as a software specialist. His research interests include geometric algorithms in CAD/CAM, efficient toolpath generation and verification for complex sculptured surfaces in numerical-control machining, domain decomposition and partitioning in solid modelling, and spherical algorithms. His most recent interest is in the efficient computation of swept volumes under various geometric constraints.

Ming-En Wang received his BS in mechanical engineering from National Chiao-Tung University in Taiwan and MS in industrial engineering from Iowa State University, USA, and is presently a candidate for a PhD in industrial & operations engineering from the University of Michigan. He joined Ford Motor Company as an application engineer in 1996, developing software tools for the processing and die-design of carbody stampings. His research interests include geometric problems in design and manufacturing, computational geometry, and computer graphics.

Lin-Lin Chen is an associate professor of engineering and technology. Her research interests are in design for manufacturing, solid modeling, human–computer interface design, and WWW applications. She received her BS in industrial design from National Cheng-Kung University, Taiwan, in 1984, and her PhD in industrial and operations engineering from the University of Michigan, USA, in 1992. She worked as a design engineer at Sampo Corporation, Taiwan, from 1984 to 1986, and as a part-time programmer in the computer-aided engineering department of the Ford Motor Company from 1987 to 1989.

Shuo-Yan Chou is an associate professor of industrial management. His research interests include the application of geometric algorithms in CAD/CAM, data visualization, and product data management. He received his BBA in industrial management from National ChengKung University, Taiwan, in 1983, and his MS and PhD in industrial and operations engineering from the University of Michican, USA, in 1987 and 1992.

835

Computing planar swept polygons: K Tang et al. Tony C Woo is professor of industrial engineering and the John M. Fluke Chair in Manufacturing Engineering at the University of Washington. He joined the University of Washington in 1995 after having been with the University of Michigan for 18 years. His research interest is in computational manufacturing. He has developed two innovations: the Beaconing Bar Code (a system which locates tagged objects indoors without the line of sight) and Virtual Holography (a system for real-time viewing of three-dimensional images constructed from two-dimensional photographs or projections). He is also the recipient of two NSF grants.

836

Ravi Janardan is an associate professor of computer science at the University of Minnesota, Minneapolis, USA. His research interests include computational geometry, algorith and data structure design, computer-aided design and manufacturing, and computer graphics. He received his PhD in computer science from Purdue University in 1987. He also holds a Master’s degree in computer sciene and a Bachelor’s degree in mechanical engineering, both from the Indian Institute of Technology, Madras.