590 likes | 973 Views
Offset Curve. Find an inward and outward offset of a polygon Sistemi di elaborazione dell’informazione A.A. 2011/12 Russo Davide - Mat . 209653 Docente: Clementini Eliseo. Index. Definition Outward offset Minkowski sum: definition & examples Theorem Applications
E N D
Offset Curve Findaninward and outward offset of a polygon Sistemi di elaborazione dell’informazione A.A. 2011/12 Russo Davide - Mat. 209653 Docente: Clementini Eliseo
Index • Definition • Outward offset • Minkowski sum: definition & examples • Theorem • Applications • Computing Minkowski sum: algorithm & examples • Non-convexpolygons • Resume • Inward offset • Medialaxis • Applications
Offset curveDefinition Given a smooth curve C, the offset curve is: (Definition) The locus of points offset by a constant distance r along the curve normal; this new curve is offset orthogonal to the original curve C at every point. (Alt. Definition) The envelope (the outer boundary of the union) of a family of disks of radius r whose centers lie on C. [1]
Outward OffsetMinkowski sum The definition of an offset curve is a special case of a more general concept: Minkowski sum. (Definition) The Minkowski sum : A,B = sets of points in the plane (x,y), counter-clockwise ordered. A ⊕ B ={a + b | a ∈ A, b ∈ B} a + b = ( ax + bx ; ay + by )
Outward Offset Minkowski sum: Example A y AB B x
Outward OffsetConvexPolygonAlghoritm Consider the Minkowski sum of a set A and a point b: A ⊕ b = {a + b | a ∈ A} y b x A A b
Outward OffsetConvexPolygonAlghoritm Thus A ⊕ B can be seen as the union of copies of A, one for each vertex bi in B. A ⊕ B = ( A ⊕ bi ) y B x A
Outward OffsetConvexPolygonAlghoritm Thus A ⊕ B can be seen as the union of copies of A, one for each vertex bi in B. A ⊕ B = ( A ⊕ bi ) y B The union is computed by the Convex-hull of the points A ⊕ B x A A B
Outward OffsetNon-convexPolygon Method1:Decomposition • decompose in convex polygons • compute the sum of each couple • the final sum is the union of each sub-sum
Outward OffsetNon-convex Polygon Method1:Decomposition • P R = (P1 + P2) R = (P1 R) U (P2 R) • P R = pi R R p2 p1 P P R
Outward OffsetNon-convex Polygon • O(n+m) if both polygons are convex. • O(nm) if only one of the polygons is convex. • O(n2 m2) if both polygons are non-convex. Method1:Decomposition
Outward OffsetNon-convex Polygon Method1:Decomposition
Outward OffsetNon-convex Polygon Method 2 : Convolution • Given two planar smooth curves C1 and C2 , theirconvolution curve C is defined by applying the vector sums only to the pairs of curve points that have the same curve tangentvalue: • C1 * C2 = {a + b | a ∈ C1 , b ∈ C2 , T1 = T2 } • where Ti is the curve tangent of Ci(i =1, 2).
P dir(p) Q p Outward OffsetNon-convex Polygon • Method 2 : Convolution of polygons • A polygonal tracing P consists of moves (going along an edge in a fixed direction), and turns (rotating at a vertex). • For a vertex p of P, dir(p) is a continuous range of directions. The convolution P Q therefore contains the sum of each edge of the polygonal tracing Q, whose direction is in dir(p), with p.
Outward OffsetNon-convex Polygon Method 2 : Convolution of polygons P * R C1 C2
Outward OffsetNon-convex Polygon Method 2 : Convolution winding numbers: • The winding number(p) of a curve C in a point “p”, is equal to the total number of counterclockwise turns that the vector makes around p, where q ∈ C. Windingnumberexample… (p) = 2
Outward OffsetNon-convex Polygon Method 2 : Convolution winding numbers:
Outward OffsetNon-convex Polygon Method 2 : Convolution • The Minkowski sum of two planar polygons A and B is • the set of points in the plane with positive winding number with respect to the convolution of ∂A with ∂B.
Outward OffsetNon-convex Polygon Method 2 : Convolution steps 1. ComputeA * B. 2. Identify its “convolution cycles”. 3. Retain cycles that have a positive winding number. 4. Merge these to construct ∂(A ⊕ B).
Outward OffsetNon-convex Polygon Method 2 : Convolution
Outward OffsetResume A,B are Convexpolygons: A or B isNon-convexpolygon: Decomposition Convolution
Outward Offset Theorem R(x,y) intersect P (x,y)P(-R(0,0)) y P R(0,0) x –R(0,0)
Outward Offset Theorem R(x,y) intersect P (x,y)P(-R(0,0)) y P(-R(0,0)) P R(0,0) x –R(0,0)
Outward Offset Theorem R(x,y) intersect P (x,y)P(-R(0,0)) y R (x1,y1) y1 P R (x3,y3) y3 R (x2,y2) R(0,0) y2 x x1 x2 x3
Outward Offset Applications • Robot motion planning:
Inward OffsetDefinition An inward offset curve for a polygon consists of straight segments parallel to each edge and circular arcs centered on each reflex vertex
Inward OffsetMedialaxis The traces of the joins between pairs of straight segments, and between straight segments and circular arcs, form a superset of the medial axis. The traces incident to reflex vertices are not present in the medial axis.
Inward OffsetStraightskeleton If the circular arcs are replaced by miter joins, we have instead the straight skeleton, as shown in figure.
Inward OffsetMinkowski sum A ⊕ B ={a + b | a ∈ A, b ∈ B} A clockwise, B counter-clockwise. Where: 0 -1 B 0 1 -1 0 -2 -1 A
Inward OffsetApplications • Pocket machining.
Minkowski sum: Algorithm example [i,j] = (1,1) 1) 2) 3) 4) w4 Add v1+w1 w3 angle(v1v2) > angle(w1w2) j=2 w2 w1,w5 v3 v2 v1 ,v4
Minkowski sum: Algorithm example [i,j] = (1,2) 1) 2) 3) 4) w4 Add v1+w2 w3 angle(v1v2) < angle(w2w3) i=2 w2 w1,w5 v3 v2 v1 ,v4
Minkowski sum: Algorithm example [i,j] = (2,2) 1) 2) 3) 4) w4 Add v2+w2 w3 angle(v2v3) > angle(w2w3) j=3 w2 w1,w5 v3 v2 v1 ,v4
Minkowski sum: Algorithm example [i,j] = (2,3) 1) 2) 3) 4) w4 Add v2+w3 w3 angle(v2v3) < angle(w3w4) i=3 w2 w1,w5 v3 v2 v1 ,v4
Minkowski sum: Algorithm example [i,j] = (3,3) 1) 2) 3) 4) w4 Add v3+w3 w3 angle(v3v4) > angle(w3w4) j=4 w2 w1,w5 v3 v2 v1 ,v4
Minkowski sum: Algorithm example [i,j] = (3,4) 1) 2) 3) 4) w4 Add v3+w4 w3 angle(v3v4) < angle(w4w5) i=4 w2 w1,w5 v3 v2 v1 ,v4
Minkowski sum: Algorithm example [i,j] = (4,4) 1) 2) 3) 4) w4 Add v4+w4 w3 angle(v4v5) >angle(w4w5) j=5 end LOOP!! w2 w1,w5 v3 v2 v1 ,v4
Minkowski sum: Algorithm example w4 w3 w2 w1,w5 v3 v2 v1 ,v4