Presentation is loading. Please wait.

Presentation is loading. Please wait.

Minkowski Sums and Offset Polygons Ron Wein. Computing Minkowski Sums.

Similar presentations


Presentation on theme: "Minkowski Sums and Offset Polygons Ron Wein. Computing Minkowski Sums."— Presentation transcript:

1 Minkowski Sums and Offset Polygons Ron Wein

2 Computing Minkowski Sums

3 Given two sets A and B in the plane, their Minkowski sum, denoted A  B, is: A  B = {a + b | a  A, b  B} Planar Minkowski Sums  =

4 We are given two polygons P and Q with m and n vertices respectively. If both polygons are convex, the complexity of their sum is m + n, and we can compute it in  (m + n) time using a very simple procedure. The Sum Complexity (I)

5 If only one of the polygons is convex, the complexity of their sum is  (mn). If both polygons are non-convex, the complexity of their sum is  (m 2 n 2 ). The Sum Complexity (II)

6 The prevailing method for computing the sum of two non- convex polygons: Decompose P and Q into convex sub- polygons, compute the pair-wise sums of the sub-polygons and obtain the union of these sums. The Decomposition Method P Q P1P1 P2P2 Q1Q1 Q2Q2 P  QP  Q

7 Convex Decomposition Schemes (I) Naïve triangulation.Optimal max-degree triangulation: minimizing the maximum degree. Optimal sum-degrees triangulation: minimizing the sum of squared vertex degrees.

8 Convex Decomposition Schemes (II) Greedy convex decomposition: add diagonals until eliminating all reflex vertices. Optimal polygon decomposition: minimizing the number of convex sub-polygons. Takes O(r 2 n log n) time. Optimal sum-degrees decomposition: minimizing the sum of squared vertex degrees.

9 Convex Decomposition Schemes (III) (with Steiner Points) Slab decomposition: add vertical segments from each reflex vertex. Angle bisection: add an angle bisector for each reflex vertex. KD-decomposition: adding vertical and horizontal segments.

10 Given a set of polygons S 1, …, S M with counterclockwise (positive) orientation, construct the arrangement of their edges. Set N(f u ) = 0 for the unbounded face f u. Then compute N(f ) for each other face using a simple BFS traversal. All faces with N(f ) > 0 contribute to the union. Computing the Union (0) (1) (2) (0)

11 A planar tracing T comprises a continuous set of points. Each point t  T is associated with a direction dir(t). The convolution of two planar tracings S and T, denoted S  T, comprises the pair-wise sum of all points s  S and t  T such that dir(s) = dir(t). Convolution of Planar Tracings (Guibas, Ramshaw and Stolfi, 1983) S T s t

12 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. Convolution of Polygons (I) p dir(p) P Q

13 At the worst case, the convolution of two polygons P  Q consists of  (mn) line segments. Guibas and Seidel (1987) gave an output-sensitive algorithm for computing the convolution segments in O(m + n + K) time. The convolution segments form closed cycles. The Minkowski sum P  Q contains all points whose winding number with respect to any of the convolution cycles is positive. Convolution of Polygons (II) (0) (1)(2)

14 The Case of a Single Cycle 0 1 2 2 2 0 P Q P  QP  Q

15 We compute the first cycle, starting from the two bottommost vertices in P and Q. If P or Q are convex, we are done. Otherwise, while it is possible to locate two vertices p  P and q  Q that should be in the convolution, construct an additional convolution cycle. The Case of Multiple Cycles

16 The Minkowski-Sum Package of CGAL

17 Supports the construction of maintenance of 2D arrangements – planar subdivisions induced by a set of planes. Handles a variety of curves. Each family of curves (line segments, poly-lines, circular arcs, conic arcs, etc.) is handled by a geometric traits-class. The CGAL Arrangement Package Common intersection points Tangency points Handles degenerate cases robustly and accurately, relying on the exact computation paradigm.

18 The Minkowski-sum package re-implements the robust algorithms for sum-computations using the convex polygon- decomposition method (Agarwal, Flato and Halperin, 2000). The Decomposition Method Available decomposition methods: Optimal. Hertel-Mehlhorn’s approximation scheme. Greene’s approximation scheme. The small-side angle-bisector approximation scheme. Implemented in the Partition_2 package

19 The first software that robustly implements the convolution algorithms for polygons. Uses the same infrastructure for multi-way polygon union, used by the decomposition method. The same algorithm also works for the case of closed convolution cycles. The Convolution Method

20 The Minkowski sum of two polygons may contain low- dimensional features (isolated vertices and antennas). The package can treat them as follows: discard them (output the regularized sum), or give access to them through the underlying arrangement. Low-Dimensional Features

21 Experimental Input Sets (I) chain stars comb fork

22 Experimental Input Sets (II) cavity random knife country

23 Experimental Results: Decomposition Running time (ms.)Arrangement sizeT dec (ms.)Slk Input set SSABGre.HMOpt.|F||F||E||E||V||V| 44457842439063901362772391232520735chain 47786774448812671256241295513244617 stars 371758321007696714650126comb 26012205242876552133776827610481112fork 8678792441671160114cavity 32037634923481031631082091515401020random 2321630370249743115150772191108622knife 18841079833846489772512681344816country

24 Experimental Results: Convolution Running time (ms.)Arrangement sizeT conv (ms.)KNCNC Input set LEDADecomp.Conv.|F||F||E||E||V||V| 4633906979328682077714521chain 33247792225954283225712002stars 9717 2665162776031comb 266260521108622206311203512661fork 21642816113511101cavity 2292346221114698258935801random 17523218446769749507558761knife 27518861112630641940510502country

25 Polygon Offsetting

26 Polygon Offsetting using the Convolution Method P BrBr Computing the convolution cycle … Computing the induced arrangement and the winding numbers … 0 1 2 2 2 0 P  BrP  Br

27 Computing the sum of two polygons (objects of the type Polygon_2 ) is of course performed using the Arr_segment_traits_2 class and using exact rational arithmetic. Related Traits Classes In case of offsetting we should consider the following traits classes: Arr_circle_segment_traits_2 – handles line segments and circular arcs using exact rational arithmetic. Arr_conic_traits_2 – handles bounded conic arcs using exact algebraic numbers (based on CORE).

28 Offsetting a Polygon Edge (I) p 1 = (x 1, y 1 ) p 2 = (x 2, y 2 )  =  - 90º q1q1 q2q2

29 If the line supporting p 1 p 2 is ax + by + c = 0, then the line supporting q 1 q 2 is ax + by + (c + ℓ r) = 0. Offsetting a Polygon Edge (II) Problem: In the general case, offset arcs are not supported by rational lines! Solution no. 1: Represent the offset edge as a segments of a (degenerate) conic curve with rational coefficients:

30 Our Approximation Scheme p1p1 p2p2 1. Find  ’ 1   and  ’ 2   such that sin(  ’ j ), cos(  ’ j ) are rational. ’1’1 ’2’2 3. Compute the intersection q’ of the two tangents at q’ 1 and q’ 2. Use the polyline q’ 1 q’q’ 2 as an approximation. q’q’ q’1q’1 q’2q’2 2. Compute q’ j = (x j + r  cos(  ’ j ), y j + r  sin(  ’ j ) ).

31 Using the half-angle formulae we have: Computing “Rational” Angles (I) Observation: If  is rational, then sin(  ) = 2  / (1+  2 ) and cos(  ) = (1 -  2 ) / (1 +  2 ) are also rational.

32 Computing “Rational” Angles (II) If x 1 > x 2 we take a rational approximation : If x 1 < x 2 we approximate the edge length from above (that is, we take a rational ). We use the good old Babylonian method for approximating square roots ( ).

33 The Approximation Quality Lemma: For any polygon edge connecting (x 1, y 1 ) and (x 2, y 2 ) whose length is ℓ and any  > 0, if we take an approximation of the edge length that satisfies: then the approximation error is bounded by . p1p1 p2p2 q’q’ q’1q’1 q’2q’2

34 Running Times (Pentium IV 3 GHz, in milliseconds) Approximated offsetExact offset SizeInput polygon  = 10 -10 r  = 10 -7 r 54358840 (14)Wheel 7160137864 (40)Knife 68569540 (19)Random 504513853 (24)Comb 134109121082 (37)Chain 826645150 (24)Country ❶ ❺ ❹ ❸ ❷ ❶ ❷ ❸ ❹ ❺

35 Thank you!


Download ppt "Minkowski Sums and Offset Polygons Ron Wein. Computing Minkowski Sums."

Similar presentations


Ads by Google