Zum Hauptinhalt springen

raygeo.geo.algo.minkowski

Minkowski sum operations for 2D polygon toolpath generation.

Provides convolution of point sequences and segments, Minkowski sums for convex polygons, and no-fit polygon / inner fit polygon calculations used in nesting and packing algorithms.

Functions

calculate_input_scale()

calculate_input_scale(polygons: Sequence[Sequence[Point]], max_int: int = 2147483647) -> float

Calculate the optimal input scale for clipper operations.

Returns: Optimal scale factor.

ParameterTypeDescription
polygonsSequence[Sequence[Point]]List of polygons to scale.
max_intint = 2147483647Maximum integer value for Clipper.
Returnsfloat

convolve_point_sequences()

convolve_point_sequences(seq_a: Sequence[tuple[int, int]], seq_b: Sequence[tuple[int, int]]) -> list[list[tuple[int, int]]]

Convolve two sequences of points.

Returns: Convolved point sequences.

ParameterTypeDescription
seq_aSequence[tuple[int, int]]First sequence of integer points.
seq_bSequence[tuple[int, int]]Second sequence of integer points.
Returnslist[list[tuple[int, int]]]

convolve_two_segments()

convolve_two_segments(a1: tuple[int, int], a2: tuple[int, int], b1: tuple[int, int], b2: tuple[int, int]) -> list[tuple[int, int]]

Convolve two line segments.

Returns: Convolved point sequence.

ParameterTypeDescription
a1tuple[int, int]Start point of segment A.
a2tuple[int, int]End point of segment A.
b1tuple[int, int]Start point of segment B.
b2tuple[int, int]End point of segment B.
Returnslist[tuple[int, int]]

get_inner_fit_polygon()

get_inner_fit_polygon(outer: Sequence[Point], inner: Sequence[Point]) -> list[Polygon]

Compute the inner fit polygon (no-fit polygon for nesting).

Returns: Inner fit polygon.

ParameterTypeDescription
outerSequence[Point]Outer polygon as (x, y) points.
innerSequence[Point]Inner polygon as (x, y) points.
Returnslist[Polygon]

get_no_fit_polygon()

get_no_fit_polygon(subject: Sequence[Point], tool: Sequence[Point]) -> list[Polygon]

Compute the no-fit polygon for two 2D polygons.

Returns: No-fit polygon.

ParameterTypeDescription
subjectSequence[Point]Subject polygon as (x, y) points.
toolSequence[Point]Tool polygon as (x, y) points.
Returnslist[Polygon]

get_polygon_minkowski_sum_convex()

get_polygon_minkowski_sum_convex(poly_a: Sequence[tuple[int, int]], poly_b: Sequence[tuple[int, int]]) -> list[list[tuple[int, int]]]

Compute the Minkowski sum of two convex polygons.

Returns: Minkowski sum as list of polygons.

ParameterTypeDescription
poly_aSequence[tuple[int, int]]First convex polygon as integer points.
poly_bSequence[tuple[int, int]]Second convex polygon as integer points.
Returnslist[list[tuple[int, int]]]