Перейти до основного вмісту

raygeo.geo.algo.nest2d.ifp

Inner-Fit Polygon (IFP) calculation for nesting algorithms.

Provides functions for computing Inner-Fit Polygons, which define the valid placement region for a part inside a bin.

Functions

build_no_go_zones()

build_no_go_zones(
bin: Sequence[types.Point],
part_neg: Sequence[types.Point],
) -> list[types.Polygon]

Build the no-go zones for a bin-part pair.

ParameterTypeDescription
binSequence[types.Point]Bin polygon as (x, y) points.
part_negSequence[types.Point]Orbiting polygon negated as (x, y) points.
Returnslist[types.Polygon]List of no-go zone polygons.
ComplexityO(n * m) where n, m = vertex counts.

inner_fit_polygon()

inner_fit_polygon(
bin: Sequence[types.Point],
part: Sequence[types.Point],
) -> list[types.Polygon]

Compute the Inner-Fit Polygon (IFP) for a part inside a bin.

ParameterTypeDescription
binSequence[types.Point]Bin polygon as (x, y) points.
partSequence[types.Point]Part polygon as (x, y) points.
Returnslist[types.Polygon]List of IFP polygons.
ComplexityO(n * m) where n, m = vertex counts of bin and part.

Inner Fit Polygon showing valid placement region

Inner Fit Polygon showing valid placement region

sweep_hull_for_edge()

sweep_hull_for_edge(
p1: types.Point,
p2: types.Point,
part_neg: Sequence[types.Point],
) -> types.Polygon

Compute the convex hull sweep of part_neg along the edge p1->p2.

ParameterTypeDescription
p1types.PointFirst edge endpoint.
p2types.PointSecond edge endpoint.
part_negSequence[types.Point]Orbiting polygon negated as (x, y) points.
Returnstypes.PolygonConvex hull polygon.
ComplexityO(n log n) for convex hull computation.