Pr oceedings of IDETCCIE  ASME  International Design Engineering ec hnical Conf erences Computer and Inf ormation in Engineering Conf erence September   Long Beac h Calif ornia USA DETC POL YGON OFFS

Pr oceedings of IDETCCIE ASME International Design Engineering ec hnical Conf erences Computer and Inf ormation in Engineering Conf erence September Long Beac h Calif ornia USA DETC POL YGON OFFS - Description

ber ele edu ABSTRA CT In this paper we present simple ne algorithm to of f set multiple nono erlapping polygons with arbitrary holes that mak es use of winding numbers Our algorithm constructs an in termediate ra of fset curv e as input to the tessel ID: 22509 Download Pdf

166K - views

Pr oceedings of IDETCCIE ASME International Design Engineering ec hnical Conf erences Computer and Inf ormation in Engineering Conf erence September Long Beac h Calif ornia USA DETC POL YGON OFFS

ber ele edu ABSTRA CT In this paper we present simple ne algorithm to of f set multiple nono erlapping polygons with arbitrary holes that mak es use of winding numbers Our algorithm constructs an in termediate ra of fset curv e as input to the tessel

Similar presentations


Tags : ber ele edu ABSTRA
Download Pdf

Pr oceedings of IDETCCIE ASME International Design Engineering ec hnical Conf erences Computer and Inf ormation in Engineering Conf erence September Long Beac h Calif ornia USA DETC POL YGON OFFS




Download Pdf - The PPT/PDF document "Pr oceedings of IDETCCIE ASME Internat..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.



Presentation on theme: "Pr oceedings of IDETCCIE ASME International Design Engineering ec hnical Conf erences Computer and Inf ormation in Engineering Conf erence September Long Beac h Calif ornia USA DETC POL YGON OFFS"— Presentation transcript:


Page 1
Pr oceedings of IDETC/CIE 2005 ASME 2005 International Design Engineering ec hnical Conf erences Computer and Inf ormation in Engineering Conf erence September 24-28, 2005, Long Beac h, Calif ornia, USA DETC2005-85513 POL YGON OFFSETTING BY COMPUTING WINDING NUMBERS Xiaorui Chen Sara McMains Depar tment of Mechanical Engineer ing Univ ersity of Calif or nia, Ber ele Email: xchen mcmains @me .ber ele .edu ABSTRA CT In this paper we present simple ne algorithm to of f- set multiple, non-o erlapping polygons with arbitrary holes that mak es use of winding numbers. Our algorithm

constructs an in- termediate “ra of fset curv e as input to the tessellator routines in the OpenGL Utility library (GLU), which calculates the wind- ing number for each connected re gion. By construction, the in- alid loops of our ra of fset curv bound areas with non-positi winding numbers and thus can be remo ed by using the positi winding rule implemented in the GLU tessellator The proposed algorithm tak es (( log time and space, where is the number of ertices in the input polygon and is the number of self-intersections in the ra of fset curv e. The implementation is xtremely simple and

reliably produces correct and logically consistent results. KEYW ORDS Polygon Of fsetting, inding Number OpenGL, CAD/CAM Intr oduction Of fsetting is fundamental problem in CAD/CAM. Be yond the use of of fsets as design primiti es, for manuf acturing the are critical tool for analysis and process planning. In order to generate tool paths for pock et machining, for xample, the boundary of each pock et must first be of fset inw ard by distance equal to the radius of the cutting tool to oid gouging [1 5]. or direction parallel tool path generation (see Figure 1(a)), the tool path includes

the line se gments inside the pock et generated by intersecting the of fset boundaries with equidistant parallel lines; for contour -parallel tool path generation (see Figure 1(b)), the original boundaries are of fset successi ely and the of fset curv es are chained together into the tool path [2, 3, 6]. (a) Direction parallel one- ay cutting (b) Contour parallel spiral Figure 1. ool path ener ation in poc et mac hining can also use of fsetting to find the accessible area for gi en tool radius [7], substep in finding an optimal set of cutter radii for pock et machining [8]. The

boundary of the pock et is first of fset inw ard by the tool radius to get the tool path boundary then of fset the result outw ard by the same of fset distance to find the accessible area and subtract the result from the original boundary of the pock et using Boolean dif ference. If the area Cop yright 2005 by ASME
Page 2
of the dif ference is zero, we don need smaller tool to remo the xcess material. Otherwise, smaller tool is necessary to clean up the corners. An xample is sho wn in Figure 2. The shaded area is the inaccessible area for tool of radius equal to the of

fset distance. Figure 2. Dif fer ence between the original polygon and the poly- gon after of fsetting bac Rough machining of molds or dies also uses of fsetting. The die/mold ca vity can be sliced into set of 2D contours by set of parallel planes perpendicular to the dra direction (see Figure 3). Then we can of fset these contours inw ard by distance slightly lar ger than the radius of the end mill to accommodate the uncut- allo ance. The unw anted material in the interior of the of fset polygon is remo ed by machining each layer from top to bottom [9]. (a) Die/Mold (b) Slice by plane Figure

3. Rough mac hining of dies/molds Of fsetting is also used in rapid prototyping. or generat- ing deposition-nozzle or laser scanning paths, tessellated STL model is first sliced to get the xternal contours. or each layer the contours are of fset to construct tool paths similar to those used in pock et machining. 2D of fsets of the layers, in combina- tion with Boolean constructi solid geometry (CSG) operations, can also be used to approximate 3D of fsets that hollo out ob- jects in order to sa uild time and material consumption [10]. Robot motion planning is yet another area that uses of

fset- ting [11]. or an autonomous robot mo ving on the ground, its ork space can be modeled as 2D polygon with arbitrary holes, where the outer polygon boundary represents the xtent of the floor plan and the holes represent the obstacles to be oided. Of fsetting this general polygon inw ard by the dimension of the robot gi es the boundary of the space in which the robot can mo freely Our algorithm is related to the con entional of fsetting ap- proaches that of fset each edge se gment of the polygon and insert circular arcs to close the gaps between the of fset se gments (see Figure 4).

The resulting curv is called aw of fset curve ra of fset curv usually contains in valid loops which must be remo ed to produce the of fset polygon [2, 12 15]. Figure 4. Con ventional pair -wise of fset appr oac In this paper we present simple ne algorithm to of fset multiple, non-o erlapping polygons with arbitrary holes using ariation of the traditional ra of fset curv and calculating the winding numbers of its connected re gions. Our algorithm con- structs ra of fset curv as input to the tessellator routines in the OpenGL Utility library (GLU), which calculates the wind- ing number for each

connected re gion. By construction, the in- alid loops of our ra of fset curv bound areas with non-positi winding numbers and thus can be remo ed by using the positi winding rule implemented in the GLU tessellator The output is the contour(s) of the of fset polygon. Using GLU tessellator implementation that emplo ys sweep line algorithm, our algo- rithm tak es (( log time and space, where is the number of ertices in the input polygon and is the number of self-intersections in the ra of fset curv e. The implementa- tion is xtremely simple and reliably produces correct and logi- cally consistent

results, unlik the of fset routine in the commer cial CIS geometry ernel. ne xt re vie related ork, then present assumptions and preliminary definitions, describe the algorithm, and pro its cor rectness. discussion of the implementation and performance follo ws. Cop yright 2005 by ASME
Page 3
Related ork One of fsetting approach is to use oronoi diagrams. Persson as the first to apply oronoi diagrams to generating cutter paths for machining arbitrarily shaped pock ets [1]. Chou and Cohen use oronoi diagrams to create contour -parallel paths [16]. Kim gi es simple ut ef

ficient oronoi diagram based algorithm to compute trimmed of fset of single simple polygon consisting of line se gments and arcs [17]. The computation of the oronoi diagram is subject to nu- merical rob ustness issues, result of generating intermediate ge- ometric entities during its construction. Smith describes di- vide and conquer algorithm, similar to that used by Held [3], to uild the oronoi diagram. Smith, ho we er minimizes the floating point round-of error and uses adapti e-precision arith- metic to address numerical rob ustness issues [18]. Though of f- setting algorithms

based on oronoi diagrams are ast, creating the oronoi diagram itself can be slo and rob ust implemen- tation is xtremely comple to implement. Another of fsetting method is pairwise intersection. Rossignac and Requicha describe CSG-based algorithm in which the pock et boundaries are first of fset and then the interfering sections are identified by calculating the distance between the of fset se gments and the pre-of fset boundary [19]. Hansen and Arbab use interference indices to detect and delete the “gouging sections of the of fset boundaries [2]. ang and Huang de elop tw criteria

for loop alidation by xamining the geometry among the of fset se gments [13]. Barton calculates the inflation/deflation of 2D polygon by using bounding box hierarchy [12]. Choi and ark achie ast algorithm by remo ving all local in alid loops before the ra of fset curv is constructed, ut their method is applicable only to polygons without holes [15]. Assumptions and Preliminar Definitions The input to our algorithm is set of non-o erlapping 2D polygons, each bounded by oriented straight line edges. Each polygon consists of one peripheral contour and zero or more inner

contours, which form holes or “islands in the polygon. preprocess the input to assure that each polygon is non-self- intersecting (in other ords, no edge contains point in the in- terior of another). The polygons can be non-manifold in the sense that more than tw edges can touch each other at some endpoint(s). will use the right-hand rule con ention that the edges of each contour are directed such that the interior of the polygon lies to the left. That is, the peripheral contour is ori- ented counterclockwise (CCW) and each inner contour is ori- ented clockwise (CW). The normal of each edge is

perpendic- ular to the edge and points to the right, i.e., the xterior of the polygon. In our algorithm, which we will describe in Section 4.1 in detail, we treat the ertices dif ferently depending on whether the erte is con or conca e. Definition 1. verte is con if left turn is made at this verte while mar hing along the contour verte is conca if right turn is made at this verte while mar hing along the contour (see igur 5). Figure 5. Con ve and concave vertices in polygon with hole Another important concept we will use is the winding num- ber While there are dif ferent approaches to

defining the term [20 24], the winding numbers calculated using an of these def- initions are identical. In this paper we use the follo wing defini- tion: Definition 2. Let be set of oriented polygons consisting of one or mor contour s, be any point of P, wher is the 2D Euclidean space and be any ay fr om to infinity that inter sects no verte of P. The winding number of with espect to is: wher for eac edg the inde is defined as follows: if does not inter sect if cr osses in CCW dir ection as vie wed fr om if cr osses in CW dir ection as vie wed fr om From

Definition 2, we ha the follo wing properties. First, tak es the same alue for all rays with the same start point pro vided that does not intersect an erte of Sec- ond, the winding number for point denoted by has the same alue for all points in single connected re gion (a con- nected set of points bounded by the contours of the polygons, not including its boundary). Third, the winding numbers of adja- cent re gions separated by single edge will al ays dif fer by one. ourth, the indi vidual winding numbers with respect to each con- tour can be summed to get the winding number with respect

to Cop yright 2005 by ASME
Page 4
the polygon when there are multiple contours defining the poly- gon. An xample of calculating the winding number for point using tw dif ferent choices of is sho wn in Figure 6. Note that winding numbers can be defined for erlapping and/or self- intersecting polygons, ut only for closed contours. Figure 6. winding number at point q, is equal to with espect to any ay fr om q. or the ays shown, the incr emental dif fer ence (+ to the winding number as it cr osses eac polygon edg is indicated. The winding rule defines cate gory such as

odd, nonzero, positi e, ne gati e, or “absolute alue greater than or equal to 2”, to classify re gion as inside or outside. If the calculated winding number of re gion alls into the chosen cate gory it is classified as inside. Other winding rules could also be defined, ut these are the only ones implemented in OpenGL, with the names GLU TESS WINDING ODD, GLU TESS WINDING NONZER O, GLU TESS WINDING POSITIVE, GLU TESS WINDING NEGA TIVE, and GLU TESS WINDING ABS GEQ TW O, respecti ely (see Figure 7). inding rules GLU TESS WINDING ODD and GLU TESS WINDING NONZER are commonly used in

polygon fill procedures (only re gions classified as inside are filled). inding rules can be used to implement CSG Boolean operations such as union, dif ference and intersec- tion of contours. or xample, we can use the winding rule GLU TESS WINDING ABS GEQ TW to get the intersection of tw contours [20]. In this paper we use the positi winding rule: only re gions with positi winding numbers are classified as in the interior of the polygon. first use the positi winding rule to clean up an erlapping and/or self-intersecting polygons in prepro- cessing step (see

Figure 8). later use the same winding rule to xtract the of fset from our ra of fset curv e, as we will describe in Section 4.1. The inner of fset and the outer of fset of polygon are defined as follo ws. (a) Preprocessing erlapping polygons (b) Preprocessing self-intersecting polygons Figure 8. Pr epr ocessing; the winding number of eac connected gion ar shown on the left and the interior of the polygon, by the positive winding rule is shown on the right. Definition 3. The inner of fset of the polygon is the gular ized [25] boundary of the set of points eac of whic lies in the

interior of and has Euclidean distance gr eater than the of fset distance fr om the boundary of P. Definition 4. The outer of fset of the polygon is the gular ized boundary of the set of points eac of whic lies xterior to and has Euclidean distance gr eater than the of fset distance fr om the boundary of P. Note that the distance of point from the boundary of polygon is the distance between and the closest point on the boundary and that there may be multiple points on the boundary that are closest to the gi en point. or instance, in Figure 9, the distance from interior point (respecti

ely xterior point to the polygon is the distance from point to point (respecti ely from point to point ). The distance of point from the polygon is the distance from point to either point or point Winding Number Offset Algorithms Con entional pair -wise of fsetting approaches of fset each edge and insert counterclockwise (respecti ely clockwise) cir cular arcs at con (respecti ely conca e) ertices between the nontangent of fset se gments to get the ra self-intersecting of fset curv (see Figure 4). The then calculate the self-intersections in the ra of fset curv and identify and remo both local

and global in alid loops [2, 12, 13, 15]. Identifying the in alid loops, Cop yright 2005 by ASME
Page 5
(a) Contours and winding numbers for each re gion (b) Odd (c) Nonzero (d) Positi (e) Ne gati (f) Abs. al. Figure 7. inding Rules Figure 9. Distance between point and polygon particularly those caused by global interactions, while retaining alid loops that are part of the of fset boundary lies at the heart of these algorithms. Calculating the winding numbers of the ra of fset curv ob- tained by the con entional pair -wise of fset approaches initially appears to be alid method for

dif ferentiating in alid loops. simple xample is sho wn in Figure 10. or relati ely small of fset distance such as sho wn in Figure 10(a) and (b), the bound- ary of the area with positi winding number is the inner of fset polygon. Ho we er for lar ge of fset distance such as the one in Figure 10(c), the result is incorrect: the resulting inner of f- set polygon should be empty ut the area with positi winding number is nonempty Therefore, we instead construct ariation on the traditional ra of fset curv that allo ws us to use winding numbers to ef ficiently determine the of fset polygons.

4.1 Our Algorithm construct our ra of fset curv for the inner of fset poly- gon, we first of fset each edge opposite to its normal direction (i.e., to the left of the edge) by the of fset distance (Fig- ure 11(a)). The of fset se gments ha the same orientation as the original edges. If the erte is conca erte x, we con- nect the endpoints of the of fset edges whose original edges share this erte by clockwise oriented arc centered on this shared erte x. These se gments and arcs are identical to those typically used in other approaches that construct ra of fset curv e. If the erte is con

erte x, ho we er we connect it with the endpoints of the of fset se gments whose original edges share this con erte with straight line se gments rather than inserting an arc (Figure 11(b)). The inserted edges are oriented such that the connecti vity is maintained when you go around the ra of fset curv e. Then we consider the winding numbers of each re gion with respect to the ra of fset curv e. Re gions with positi wind- ing numbers are in the interior of the inner of fset polygon (Fig- ure 11(c)). The boundary of their union is the inner of fset poly- gon (Figure 11(d)). (a) Of fset each edge

(b) Connect of fset edges (c) Calculate the winding number of each re gion (d) Get the boundary of areas with positi wind- ing numbers Figure 11. Constructing the inner of fset polygon (original poly- gon dashed) construct our ra of fset curv for the outer of fset poly- gon, we follo the same steps as for an inner of fset polygon with Cop yright 2005 by ASME
Page 6
Figure 10. inding number calculation using con ventional pair -wise inner of fset aw of fset curve; the shaded ar ea in eac figur has positive winding number and the original polygon is dashed. minor

modifications. In the first step, we of fset each edge along its normal direction (i.e., to the right of the edge) by the of fset distance. In the second step, for con erte x, we connect the endpoints of the of fset se gments whose original edges share this erte by counter cloc kwise oriented arc centered on this shared erte x; for conca erte x, we connect it to the endpoints of the of fset edges whose original edges share this conca erte x. An xample of constructing the outer of fset polygon is sho wn in Figure 12. (a) Of fset each edge (b) Connect of fset edges (c) Calculate the

winding number of each re gion (d) Get the boundary of areas with positi wind- ing numbers Figure 12. Constructing the outer of fset polygon (original poly- gon dashed) 4.2 Correctness of the algorithm In this section, we first sho that the of fset polygons can be constructed by Boolean operations, which can in turn be imple- mented using winding numbers. After pro ving the correctness of this method, we then sho that our method is equi alent ut tak es less time and space. Definition 5. The rectangular area of an edg se gment is the ar ea swept out when sweeping the edg se gment

along or oppo- site to its normal dir ection until eac hing its of fset se gment. (The sweep dir ection is along the normal for an outer of fset, opposite to the normal for an inner of fset.) Definition 6. The an-shaped area of verte is the fan-shaped ar ea formed by the verte and the inserted ar center ed at the verte and connecting its two of fset points. The fan-shaped ar ea is only defined on concave vertices for an inner of fset and on con ve vertices for an outer of fset. illustrate Definition and Definition with the xamples sho wn in Figure 13. Figure 13.

Definitions of ectangular ar eas and fan-shaped ar eas 4.2.1 Inner Offset construct the inner of fset poly- gon by Boolean subtraction, we need to subtract all points within Cop yright 2005 by ASME
Page 7
distance of the boundary that are also inside the boundary from the original polygon. This is accomplished by subtracting the rectangular area for each edge se gment and the an-shaped area for each conca erte x. orient the boundary clockwise for each contour we wish to subtract. Combining these contours with the contours defining the original oriented polygon and using

the positi winding rule to aluate the resulting polygon set corresponds to Boolean subtraction [20]. The boundary of the resulting set of re gions with positi winding numbers is the inner of fset polygon of see why this gi es the inner of fset, consider calculating the winding numbers first with respect to each contour of Since the original polygon is not self-intersecting, the winding number is in its interior and in its xterior The points in- side each subtracted rectangular or an-shaped clockwise contour ha winding number of relati to that contour since the boundary of an rectangular

or an-shaped area will not be self- intersecting. The points outside each subtracted contour ha winding number of relati to that contour No we calculate the winding numbers with respect to Since the winding number of point with respect to equals the sum of the winding numbers of this point with respect to each contour of we kno point outside the original polygon will ha winding number of at most with respect to The winding number with respect to of equals when does not lie in an of the rectangular or an-shaped area; the winding number with respect to of is less than if lies in one or more of

the rectangular or an-shaped areas. In either case will be classified as outside the aluated polygon using the positi winding rule. or point that lies in at least one rectangular or an-shaped area, it will ha winding number of at most (+ (when the point lies both in one of the rectangular or an-shaped area and in the interior of the polygon ). So these points will also be classified as outside the aluated polygon using the positi winding rule. No we can xpress the process as subtraction, from the interior of the original polygon of the union of all the rectangular areas and

an-shaped areas. The result is the set of points that lie in the interior of and ha distance of at least the of fset distance from The boundary of this re gion is thus the inner of fset polygon. 4.2.2 Outer Offset The construction of the outer of f- set polygon by Boolean union (addition) and its proof are similar to that for the inner of fset polygon. construct the outer of f- set polygon, we first construct the rectangular area for each edge se gment and the an-shaped area for each con ve erte x. Then we orient the boundary counter cloc kwise for each rectangular or an- shaped area.

Combining these contours with those defining the original polygon and again using the positi winding rule to aluate the ne polygon corresponds to Boolean union (be- cause this time the boundaries are counterclockwise) [20]. Since the winding number of point in the interior (respecti ely xte- rior) of the original polygon is (respecti ely 0) with respect to and the winding number of point inside (respecti ely out- side) rectangular or an-shaped area is (respecti ely 0) with respect to that rectangular or an-shaped area, the winding num- ber of point is at least with respect to the polygon

after the winding numbers with respect to each contour are summed if and only if the point lies in the interior of the original poly- gon and/or in one or more rectangular or an-shaped areas. Therefore, the point is in the interior of the ne polygon using positi winding rule if and only if it is in the interior of the orig- inal polygon and/or in one or more rectangular or an-shaped areas. This process is equi alent to adding the rectangular areas and an-shaped areas to the interior of the original polygon The boundary of the resulting set of re gions with positi wind- ing numbers is thus the

outer of fset polygon. 4.2.3 Simplifying the Ra Offset Cur ve Using straight Boolean operations to obtain the of fset polygons as de- tailed in Section 4.2.1 and Section 4.2.2, we need to construct ne contour with four edges for each edge in the original poly- gon, as well as ne contour with tw straight edges and one curv ed edge for each conca or con erte x. can reduce the number of contours and edges, lea ving only those used in our algorithm ra of fset curv e, by eliminating the edges with the same geometry ut opposite directions by applying the follo wing theorem: Theorem 1. If ther ar two

edg es in polygon having the same eometry and opposite dir ections, the winding number of any point is in variant after we emo ve these two edg es. Pr oof Suppose there are tw edges and in polygon with the abo properties (see Figure 14). After remo ving the tw edges from the polygon we get ne polygon The polygons and ha the same ertices. or an ray with an endpoint that contains no erte of and hence contains no erte of either it crosses both edges and or it crosses neither If it does not cross either edge, the winding number of point is equal with respect to the polygon or the polygon since the

edges that contrib ute to the winding number of point are the same for both the polygons and If the ray crosses both and in the polygon their contrib utions to the wind- ing number of point are (or 1) and (or 1) respec- Cop yright 2005 by ASME
Page 8
ti ely or an ray from we ha nf nf nf Therefore, the winding number for an point is in ariant after and are remo ed. Figure 14. inding number in variance Edg es and ar co- incident ut we mo ve them little apart fr om eac other for vi- sualization purposes. The reduction from the contours used for the full Boolean al- gorithm to the

contours used for our ra of fset curv is sho wn in Figure 15. Both the orientation of each rectangular or an-shaped contour and the winding numbers of each single connected re- gion are sho wn in the figure. do not use the contour defining the original polygon in our ra of fset curv so it is sho wn us- ing dashed lines. Using our algorithm, the number of contours in the ra of fset curv is equal to the number in the original polygon. That is, for each contour in the original polygon we construct only one contour in the ra of fset curv e. The total number of the edges in for our

algorithm is between 28% and 75% of the number of the edges using the full Boolean subtrac- tion/addition algorithm (both the greatest and least sa vings are for con polygon the greatest sa vings for an outer of fset, the least sa vings for an inner of fset). Thus, our ne algorithm tak es less time and less space, with results equi alent to the full Boolean algorithm. (a) Inner Of fset Polygon (b) Outer Of fset Polygon Figure 15. Reducing the Boolean subtr action/addition algorithm to our winding number algorithm Implementation, Anal ysis and Results Our program uses GLU 1.3 implemented by

SGI, free xtension to OpenGL. The GLU tessellator tak es as input the ertices of each contour defining the input polygon. Af- ter the GLU TESS WINDING POSITIVE winding rule and the plane normal are set, it tessellates the polygon and cal- culates the winding numbers of each connected re gion. set the GLU BOUND AR ONL property to GL TR UE in order to xtract the contours that separate the interior and the xterior of the resulting output polygon. The call- back functions GLU TESS COMBINE, GLU TESS VER TEX, GLU TESS BEGIN and GLU TESS END are predefined and called during the

tessellation. The GLU TESS COMBINE callback creates ne ertices at self-intersections. The GLU TESS VER TEX callback allo ws us to xtract the ordered ertices from the output polygons (the of fsets). When the tes- sellator be gins or ends loop in their contour outlines, the GLU TESS BEGIN and GLU TESS END callback functions are called, telling us when to start ne loop or end an xist- ing one in our data structure for the of fset polygon. assure rob ustness, we preprocess the input to clean up an erlapping and/or self-intersecting polygons by running the winding number calculation once using the

positi winding rule (see Figure 8). This clean up step is necessary with ma- chine generated input because the round of errors that arise due Cop yright 2005 by ASME
Page 9
to limited numerical precision often generate microscopic self- intersections. 5.1 Space Comple xity and Time Comple xity There are tw main steps in our algorithm: the construction of the ra of fset curv and the calculation of the winding num- bers. Since each erte in the ra of fset curv is inserted only once, the first part tak es time and space, where is the number of line se gments and arc se gments in

the ra of fset curv e. The second part depends on the GLU tessellator The GLU tessellator only tak es polygons with straight line edges as input. Therefore, we must approximate each arc in the ra of fset curv with short line se gments, increasing the number of ertices passed to the GLU tessellator to some number set the approximation error (the maximum distance between an approximating line se gment and the original arc) to be 1% of the of fset distance for the results reported here. Since the dif- ference is bounded by the constant approximation percentage, and the asymptotic comple xity in

terms of or is the same. In our analysis, we will use that is, the number of ertices in the ra of fset curv e, instead of The source code for the GLU tessellator from the SGI Sam- ple Implementation [26] re eals that the use sweep line algo- rithm to subdi vide the polygon into monotone re gions at intersec- tion points and classify each re gion as inside or outside accord- ing to the winding rule used. sweep line intersection algorithm that stores intersections has (( log time comple xity and space comple xity where is the number of ertices in the input, the ra of fset curv in this instance,

and is the num- ber of self-intersections; thus we assume that the GLU tessellator we are using also runs in (( log time and uses space. ha xperimently confirmed our implementation space and time comple xity for se eral xamples, sho wn in Fig- ure 16. Their curv ed surf aces were approximated to se eral dif- ferent le els of precision for comparison. ran the tests on dual-boot PC with an AMD Athlon(tm) XP 2500+ 1.8GHz pro- cessor under Linux using single user mode for repeatability xperimently confirmed the space comple xity by plot- ting the memory usage of the program ersus (see

Fig- ure 17). can see that the space usage is linear in which is consistent with the space comple xity of the sweep line algo- rithm used in the GLU tessellator Running times, tak en as the erage of 100 runs, are plotted ersus log in Figure 18. These plots are consistent with the theoretical asymptotic time comple xity of (( log 5.2 Comparison with CIS 5.2.1 Running Time compared the running time of our of fsetting algorithm to the running time of the of fset rou- tine pro vided in the CIS ernel, the geometric ernel used by (a) Fish (272 186 bounding box) (b) BigS (117 134 bounding box) (c)

BigQ (116 130 bounding box) Figure 16. Examples, with the original polygons in (dark er) blue and the of fset polygons in (lighter) ed; the dimensions of the axis aligned bounding box for eac xample ar indicated in par en- theses. Figure 17. Space usa vs. man commercial CAD package such as AutoCAD, 3D Studio, Autodesk In entor IronCAD, and CADk ran the tests on the same dual-boot 1.8GHz PC under indo ws 2000 (see Fig- ure 19). Our algorithm is 30 to 150 times aster than the CIS of fsetting package on these xamples. 5.2.2 Rob ustness One of our moti ations for starting this ork as an observ ed

lack of rob ustness in the CIS routine for input polygons with features of size xactly equal to twice the inner of fset distance. Therefore we also compared the rob ustness of the CIS of fsetting routine and our algorithm. While CIS gi es qualitati ely incorrect results in some cases, our algorithm al ays ga correct results for the hundreds of cases we tested. typical xample is sho wn in Figure 20, in which the of fset polygon should consist of tw contours that touch each other at point on the symmetric centerline. CIS gi es only one of Cop yright 2005 by ASME
Page 10
Figure 18.

Running time vs. log Figure 19. Running time comparisons these contours, while the other contour is missing entirely Our algorithm gi es both contours correctly also found out that the CIS of fsetting routine gi es in- consistent results corresponding to dif ferent mathematical defi- nitions of the of fset polygon, depending on the input. The is- sue arises when tw of fset se gments coincide with each other (an xample is sho wn in Figure 21). CIS gi es tw dif ferent, mathematically inconsistent results for the of fsets of these tw polygons, one containing the coincident of fset se gments

and the other omitting them. Our algorithm does not display the coinci- dent of fset se gments at an time, consistent with our definition of of fset as the boundary of re gularized set (r -set) [25]. Ha ving an of fset algorithm that implements consistent mathematical defi- nition of of fsetting is essential if we are to use it as subroutine for well-defined, pro ably correct geometric algorithms. (a) CIS result (b) Our result Figure 20. Rob ustness comparison: CIS inner of fset and our algorithm inner of fset (a) Polygon by CIS (b) Polygon by CIS (c) Polygon by our algorithm

(d) Polygon by our algorithm Figure 21. Consistency of the definition of the of fset polygon Conc lusion Our algorithm for calculating of fset polygons using winding numbers is ast, accurate, and xtremely easy to implement. The simple-to-construct ra of fset curv is processed by the uilt- in winding number capabilities of the rob ust, widely ailable and free GLU tessellator The algorithm scalability is xcel- lent, with space comple xity of and running time of (( log where is the number of input ertices and is the number of self-intersections in the ra of fset curv e. The algorithm gi es

mathematically well-defined and internally con- sistent results, en for input that contains multiple, erlapping 10 Cop yright 2005 by ASME
Page 11
and/or self-intersecting polygons with arbitrary holes. CKNO WLEDGMENTS The authors were supported in part by Junior aculty Re- search Grant and MICR grant 04-079. REFERENCES [1] Persson, H., 1978. “NC machining of arbitrarily shaped pock ets”. Computer -Aided Design, 10 (3), pp. 169–174. [2] Hansen, A., and Arbab, ., 1992. “An algorithm for generating NC tool paths for arbitrarily shaped pock ets with islands”. CM ans. Gr aph., 11

(2), pp. 152–182. [3] Held, M., 1991. On the Computational Geometry of oc et Milling Lec- tures Notes in Computer Science. Springer -V erlag, Berlin. [4] Manuel, D., Liang, M., and olahan, ., 1996. “A dynamic of fsetting ap- proach to tool path generation for machining con pock ets”. Computer Industrial Engineering 31 (1-2), October pp. 135–138. [5] Choi, B. K., and Kim, B. H., 1997. “Die-ca vity pock eting via cutting sim- ulation”. Computer -Aided Design, 29 (12), pp. 837–846. [6] ark, S. C., 2004. “Sculptured surf ace machining using triangular mesh slicing”. Computer -Aided Design, 36 (3),

pp. 279–288. [7] D’Souza, R., Wright, ., and equin, C., 2002. “Handling tool holder colli- sion in optimal tool sequence selection for 2.5-D pock et machining”. our nal of Computing and Information Science in Engineering (4), pp. 345 349. [8] Nadjak a, I., and McMains, S., 2004. “Finding an Optimal Set of Cutter Radii for 2.5D Pock et Machining”. In ASME International Mechanical Engineering Congress and Exposition. [9] Choi, B. K., and Jerard, R. B., 1998. Sculptur ed surface mac hining: theory and applications Kluwer Academic Publishers. [10] McMains, S., Smith, J., and Sequin, C., 2003.

“Thin-w all calculation for layered manuf acturing”. ournal of Computing and Information Science in Engineering (3), September pp. 210–218. [11] de Ber g, M., an Kre eld, M., Ov ermars, M., and Schw arzk opf, O., 2000. Computational Geometry: Algorithms and Applications second ed. Springer -V erlag. [12] Barton, E. E., and Buchanan, I., 1980. “The polygon package”. Computer Aided Design, 12 (1), pp. 3–11. [13] ang, S.-N., and Huang, M.-L., 1993. “A Ne Of fsetting Algorithm Based On racing echnique”. In Proceedings of the 2nd Symposium on Solid Modeling and Applications, CM Press, pp. 201–210.

[14] Kalmano vich, G., and Nisne vich, G., 1998. “Swift and stable polygon gro wth and brok en line of fset”. Computer -Aided Design, 30 (11), pp. 847 852. [15] Choi, B., and ark, S., 1999. “A pair -wise of fset algorithm for 2D point- sequence curv e”. Computer -Aided Design, 31 (12), pp. 735–745. [16] Chou, J. J., and Cohen, E., 1989. Computing of fsets and tool paths with oronoi diagrams. ech. rep., echnical Report UUCS-89-017, Department of Computer Science, Uni ersity of Utah, Salt Lak City UT 84112 USA. [17] Kim, D.-S., 1998. “Polygon of fsetting using oronoi diagram and tw stacks”.

Computer -Aided Design, 30 (14), pp. 1069–1076. [18] Smith, J., 2004. “Rob ust geometric methods for surf ace design and manu- acturing”. Phd dissertation, UC Berk ele Department of Electrical Engi- neering and Computer Science, May [19] Rossignac, J. R., and Requicha, A. A. G., 1986. “Of fsetting operations in solid modelling”. Computer Aided Geometric Design, (2), pp. 129–148. [20] oo, M., Neider J., Da vis, ., and Shreiner D., 1999. OpenGL Pr gr am- ming Guide third ed. Addison-W esle [21] Grunbaum, B., and Shephard, G. C., 1990. “Rotation and inding Num- bers for Planar Polygons and Curv

es”. ansaction of the American Math- ematical Society 322 (1), pp. 169–187. [22] Hormann, K., and Agathos, A., 2001. “The point in polygon problem for arbitrary polygon”. Computational Geometry: Theory and Applications, 20 pp. 131–144. [23] Sunday D., 2001. ast winding number test for point inclusion in poly- gon. http://softsurfer .com/algori th ms.htm. [24] Ismailescu, D., 2003. “Slicing the Pie”. Discr ete and Computational Ge- ometry 30 (2), pp. 263–276. [25] Requicha, A. G., 1980. “Representations for Rigid Solids: Theory Meth- ods, and Systems”. CM Computing Surve ys (CSUR), 12 (4), pp.

437–464. [26] SGI Sample Implementation. http://www .mesa3d.or g. 11 Cop yright 2005 by ASME