Skip to content

Skip the elements on the boundary of the NFP when computing its feasible elements and points - #155

Merged
fontanf merged 1 commit into
mainfrom
nfp-skip-elements-on-boundary
Nov 8, 2026
Merged

fontanf merged 1 commit into
mainfrom
nfp-skip-elements-on-boundary

Conversation

@fontanf

@fontanf fontanf commented Nov 8, 2026

Copy link
Copy Markdown
Owner

compute_feasible_elements_and_points computes the intersections of the elements of the convex NFPs which are not strictly inside the union of the other convex NFPs. Many of these elements are on the boundary of the NFP, for example the collinear edges of the convex NFPs of all the parts along a straight side of a shape, and each of them intersects many others.

None of their points is strictly inside the NFP, so none of them is feasible. Their intersections with the other elements are not needed either:

  • these intersections are not strictly inside the NFP, so they are not feasible points;
  • the overlapping parts in opposite directions, which give the feasible elements, have convex NFPs on both sides, so they only reach the boundary of the NFP at their ends, which are candidates anyway.

These elements are now removed before computing the intersections: an element is removed if its start and its end are on an element of the same type of the boundary of the NFP containing its middle.

Measurements

On the 62 no-fit polygons computed by the periodic packings of packingsolver on alma_02 (alma2025 dataset), no_fit_polygon goes from 23.6 s to 20.9 s in total, with the same outputs (number of components and of elements of the NFP, number of feasible elements and points). On the self-NFP of a 64-vertex item type, 3,478 of the 10,197 remaining elements are removed, the number of intersecting pairs goes from 856,030 to 155,502, and no_fit_polygon goes from 1.59 s to 0.88 s.

All 714 tests pass.

…ble elements and points

compute_feasible_elements_and_points computes the intersections of the
elements of the convex NFPs which are not strictly inside the union of the
other ones. Many of these elements are on the boundary of the NFP, e.g. the
collinear edges of the convex NFPs of the parts along a straight side of a
shape, and each of them intersects many others.

None of their points is strictly inside the NFP, so none of them is
feasible, and their intersections with the other elements are not needed
either: these intersections are not strictly inside the NFP, and the
overlapping parts in opposite directions have convex NFPs on both sides, so
they only reach the boundary of the NFP at their ends. These elements are
now removed before computing the intersections.
@fontanf
fontanf force-pushed the nfp-skip-elements-on-boundary branch from 01c29b7 to be45478 Compare November 8, 2026 16:50
@fontanf
fontanf merged commit 794473e into main Nov 8, 2026
3 checks passed
@fontanf
fontanf deleted the nfp-skip-elements-on-boundary branch November 8, 2026 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant