Algorithm Search⌘K

Definitioncore

No-fit polygon

Also called NFP.

For two polygons, the locus of a reference point of one as it slides around the other while touching, so a placement overlaps exactly when that point is inside.

The no-fit polygon (NFP) of two polygons AA and BB tells, for each translation of BB, whether BB overlaps AA. Fix AA and a reference point on BB. Slide BB around AA so that the two always touch and never overlap: the reference point traces the boundary of the NFP. Placements with the reference point inside the NFP overlap, those outside are apart, and those on the boundary touch. As a set, the NFP is the Minkowski sum A⊕(−B)A \oplus (-B), the same object that motion planning calls the configuration space obstacle of a translating robot. Solvers of the nesting problem compute an NFP for each pair of part shapes and each allowed rotation. After that, the test of a whole placement against a fixed part is a point in polygon test, and rules such as bottom-left fill search for points outside a union of NFPs. The NFP is the main geometric tool of the nesting problem. The text above, like the stub, says that a placement overlaps "exactly when the point is inside". This is true for the open interiors of most pairs, but it fails on the degenerate parts described below.

Definition

Let AA and BB be polygons in the plane, each a compact set equal to the closure of its interior (it may have holes). Write B+t={b+t:b∈B}B + t = \{b + t : b \in B\} for BB translated by t∈R2t \in \mathbb{R}^2, and −B={−b:b∈B}-B = \{-b : b \in B\}. The reference point of BB is the origin of its coordinates, so the reference point of B+tB + t is tt.

No-fit polygon. The no-fit polygon of BB with respect to AA is

NFPAB=A⊕(−B)={a−b:a∈A, b∈B}.\mathrm{NFP}_{AB} = A \oplus (-B) = \{a - b : a \in A,\ b \in B\}.

The three relations. For every tt:

  1. (B+t)∩A≠∅(B + t) \cap A \ne \emptyset if and only if t∈NFPABt \in \mathrm{NFP}_{AB}. Indeed a=b+ta = b + t for some a∈Aa \in A, b∈Bb \in B is the same as t=a−bt = a - b.
  2. The interiors meet, int⁡(B+t)∩int⁡A≠∅\operatorname{int}(B + t) \cap \operatorname{int} A \ne \emptyset, if and only if t∈int⁡A⊕(−int⁡B)t \in \operatorname{int} A \oplus (-\operatorname{int} B), by the same computation with the interiors. This set is open, since it is a union of translates of the open set int⁡A\operatorname{int} A, and its closure is NFPAB\mathrm{NFP}_{AB}.
  3. B+tB + t touches AA, meaning the sets meet but the interiors do not, if and only if tt is in NFPAB\mathrm{NFP}_{AB} but not in int⁡A⊕(−int⁡B)\operatorname{int} A \oplus (-\operatorname{int} B).

A placement of BB is feasible with respect to AA when the interiors do not meet, that is, when BB is apart from AA or touches it. So the feasible translations are the complement of the open set in item 2.

Is "inside" the same as "overlap"? The open set of item 2 is always contained in int⁡NFPAB\operatorname{int} \mathrm{NFP}_{AB}. For two convex polygons the two sets are equal, so "the interiors overlap if and only if tt is strictly inside the NFP" is true. For nonconvex polygons the open set can be smaller. The difference is a set of segments and points inside the NFP where BB fits exactly into a slot or a cavity of AA: there BB touches AA on two opposite sides, every nearby translation overlaps, and so tt is an interior point of the NFP that is still feasible. Codes that test "strictly inside the NFP" lose these exact fits. Codes that test "inside or on the boundary" lose all touching placements. The orbital method of Burke et al. (2007) treats exact fits as a special case of its output.

Inner-fit polygon. For a container CC, such as a sheet or a strip, the inner-fit polygon is

IFPCB={t:B+t⊆C},\mathrm{IFP}_{CB} = \{t : B + t \subseteq C\},

the Minkowski difference of CC and BB, which is the erosion of mathematical morphology. For a rectangular sheet [0,W]×[0,L][0, W] \times [0, L] and a part whose bounding box is [0,w]×[0,h][0, w] \times [0, h] in its own coordinates, IFP=[0,W−w]×[0,L−h]\mathrm{IFP} = [0, W - w] \times [0, L - h], empty if the part is too large.

Feasible region. With parts A1,…,AkA_1, \dots, A_k already placed (each as a fixed polygon), the feasible reference points of BB form

IFPCB∖⋃i=1k(int⁡Ai⊕(−int⁡B)).\mathrm{IFP}_{CB} \setminus \bigcup_{i=1}^{k} \left( \operatorname{int} A_i \oplus (-\operatorname{int} B) \right).

This is the set that placement rules search, for example for its lowest, then leftmost point in bottom-left fill.

Rotations. The NFP is defined for translations only. A part that may turn through a finite set of angles, often 00, 9090, 180180 and 270270 degrees, gets one NFP per pair of orientations. Free rotation makes the set of placements three-dimensional, and the NFP does not apply directly.

Convex parts. If AA and BB are convex with nn and mm edges, the NFP is a convex polygon with at most n+mn + m edges. Its edges are the edges of AA and of −B-B sorted by direction, so it is computed by one merge in O(n+m)O(n + m) time, see Minkowski sum of convex polygons. For nonconvex parts the NFP can have holes, many more edges, and the degenerate parts above. The Minkowski sum page gives the size bounds. Three ways to compute it are in use, all described in the tutorial of Bennell and Oliveira (2008):

  • Orbital. Slide BB along AA and trace the reference point. Each step finds the touching pair of edges, the direction of sliding, and how far BB can go before it hits another edge. The holes need extra start points. Burke et al. (2007) treat the holes, the exact fits and the narrow channels.
  • Decomposition. Cut AA and BB into convex pieces (see convex decomposition), take the NFP of each pair of pieces by the convex merge, and take the union. Agarwal, Flato and Halperin (2002) compare decompositions for this use.
  • Edge sequences. Bennell, Dowsland and Dowsland (2001) sort the edges of AA and −B-B by direction as in the convex case, and repair the result where the polygons are not convex, without a decomposition.

All three make sign decisions on the orientation of edge pairs, so rounding errors can break them. Exact rational coordinates avoid this.

Examples and non-examples

The examples were checked by an exact rational test of the three relations on a grid of translations (spacing 1/31/3 and 1/41/4), with the overlap of convex pieces decided by separating axes.

  • A square and a triangle. A=[0,4]2A = [0, 4]^2, and BB is the triangle with vertices (0,0)(0, 0), (2,0)(2, 0) and (0,2)(0, 2), with the reference point at its right angle. Then −B-B has vertices (0,0)(0, 0), (−2,0)(-2, 0) and (0,−2)(0, -2), and
NFPAB=the pentagon (−2,0),(0,−2),(4,−2),(4,4),(−2,4),\mathrm{NFP}_{AB} = \text{the pentagon } (-2, 0), (0, -2), (4, -2), (4, 4), (-2, 4),

of area 3434. It has 55 edges, not 4+3=74 + 3 = 7, because the two short edges of −B-B are parallel to edges of the square and merge with them. At t=(−1,−1)t = (-1, -1), on the slanted edge, the hypotenuse of B+tB + t touches the corner (0,0)(0, 0) of AA. At t=(3,3)t = (3, 3), inside, the parts overlap. At t=(5,0)t = (5, 0), outside, they are apart.

  • A hole in the NFP. Let AA be the square [0,6]2[0, 6]^2 with a square cavity (1,5)2(1, 5)^2 cut out of it and a slot of width 11, (3,4)×(5,6](3, 4) \times (5, 6], that joins the cavity to the top. Let BB be a 2×22 \times 2 square with the reference point at its lower left corner. Then NFPAB=[−2,6]2\mathrm{NFP}_{AB} = [-2, 6]^2 with the open square (1,3)2(1, 3)^2 removed. The hole is the set of positions where BB sits inside the cavity without touching it. BB is too wide to pass through the slot, so the hole cannot be reached from outside by sliding, and an orbital method that starts from the outside never finds it. The hole is where solvers of the nesting problem put small parts inside the cut-outs of large ones.
  • An exact fit. Make the cavity of the previous example (1,3)×(1,5)(1, 3) \times (1, 5), which is exactly as wide as BB, and close the slot. The positions t=(1,y)t = (1, y) for 1≤y≤31 \le y \le 3 put BB in the cavity, touching both side walls. They are feasible. But moving tt by ±1/100\pm 1/100 in xx makes BB overlap a wall, so the segment lies in the interior of the NFP. The NFP has no hole here, only a slit of feasible points inside it. This is the non-example to "overlap if and only if strictly inside".
  • Inner fit. A 2×12 \times 1 rectangle on a sheet [0,10]×[0,4][0, 10] \times [0, 4] has IFP=[0,8]×[0,3]\mathrm{IFP} = [0, 8] \times [0, 3]. The point (8,3)(8, 3) puts the rectangle in the upper right corner.
  • Not symmetric. NFPBA=B⊕(−A)=−NFPAB\mathrm{NFP}_{BA} = B \oplus (-A) = -\mathrm{NFP}_{AB}. In the first example, NFPBA\mathrm{NFP}_{BA} is the pentagon reflected through the origin, not the same pentagon. The reference points also matter: moving the reference point of BB by vv translates NFPAB\mathrm{NFP}_{AB} by −v-v.
  • Minkowski sum. The NFP is A⊕(−B)A \oplus (-B). The Minkowski sum page gives the algorithms and the size bounds, and this page adds the reference point, the touching case and the inner-fit polygon.
  • Configuration space. In motion planning, the obstacle AA for a robot BB that only translates is the same set A⊕(−B)A \oplus (-B). Motion planning asks for a path through the free space. The nesting problem asks for a good point in it.
  • Mathematical morphology. The inner-fit polygon is an erosion of the container by BB, and the NFP is a dilation of AA by −B-B.
  • Nesting problem. The problem that the NFP serves. Its feasibility constraints are "the reference point of each part is in its IFP and outside the open NFP of every other part".
  • Bottom-left fill. Places each part at the lowest, then leftmost, feasible point of the region above.
  • Polygon with holes. NFPs of nonconvex parts can have holes, so a code needs this representation for its output.

References

  1. Julia A. Bennell and José F. Oliveira, The geometry of nesting problems, a tutorial, European Journal of Operational Research 184(2), 2008, 397 to 415, the section on the no-fit polygon (definition, the orbital, decomposition and Minkowski sum ways to compute it, and its degenerate cases) and the inner-fit polygon
  2. Julia A. Bennell, Kathryn A. Dowsland and William B. Dowsland, The irregular cutting-stock problem, a new procedure for deriving the no-fit polygon, Computers and Operations Research 28(3), 2001, 271 to 287, the no-fit polygon of nonconvex polygons from Minkowski sums of edge sequences, without a decomposition into convex pieces
  3. Edmund K. Burke, Robert S. R. Hellier, Graham Kendall and Glenn Whitwell, Complete and robust no-fit polygon generation for the irregular stock cutting problem, European Journal of Operational Research 179(1), 2007, the orbital method, with the cases of holes, of exact fits and of sliding into a narrow channel
  4. Kathryn A. Dowsland, Subodh Vaid and William B. Dowsland, An algorithm for polygon placement using a bottom-left strategy, European Journal of Operational Research 141(2), 2002, 371 to 381, feasible positions as points outside every no-fit polygon and inside the inner-fit polygon, holes included
  5. Pankaj K. Agarwal, Eyal Flato and Dan Halperin, Polygon decomposition for efficient construction of Minkowski sums, Computational Geometry 21(1-2), 2002, 39 to 61, Minkowski sums of nonconvex polygons by convex decomposition, pairwise convex sums and their union, with an experimental comparison of decompositions

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/V3W9FP/text.yaml