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.
| Parameter | Type | Description |
|---|---|---|
polygons | Sequence[Sequence[Point]] | List of polygons to scale. |
max_int | int = 2147483647 | Maximum integer value for Clipper. |
| Returns | float |
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.
| Parameter | Type | Description |
|---|---|---|
seq_a | Sequence[tuple[int, int]] | First sequence of integer points. |
seq_b | Sequence[tuple[int, int]] | Second sequence of integer points. |
| Returns | list[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.
| Parameter | Type | Description |
|---|---|---|
a1 | tuple[int, int] | Start point of segment A. |
a2 | tuple[int, int] | End point of segment A. |
b1 | tuple[int, int] | Start point of segment B. |
b2 | tuple[int, int] | End point of segment B. |
| Returns | list[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.
| Parameter | Type | Description |
|---|---|---|
outer | Sequence[Point] | Outer polygon as (x, y) points. |
inner | Sequence[Point] | Inner polygon as (x, y) points. |
| Returns | list[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.
| Parameter | Type | Description |
|---|---|---|
subject | Sequence[Point] | Subject polygon as (x, y) points. |
tool | Sequence[Point] | Tool polygon as (x, y) points. |
| Returns | list[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.
| Parameter | Type | Description |
|---|---|---|
poly_a | Sequence[tuple[int, int]] | First convex polygon as integer points. |
poly_b | Sequence[tuple[int, int]] | Second convex polygon as integer points. |
| Returns | list[list[tuple[int, int]]] |