raygeo.geo.shape.polygon3d
Functions
flip_polygon_3d()
flip_polygon_3d(
polygon: Sequence[types.Point3D],
flip_h: bool = False,
flip_v: bool = False,
flip_z: bool = False,
) -> types.Polygon3D
Flip a 3D polygon horizontally, vertically, and/or along Z.
| Parameter | Type | Description |
|---|---|---|
polygon | Sequence[types.Point3D] | Polygon as (x, y, z) points. |
flip_h | bool = False | Whether to flip horizontally (negate X). |
flip_v | bool = False | Whether to flip vertically (negate Y). |
flip_z | bool = False | Whether to flip along Z (negate Z). |
| Returns | types.Polygon3D | Flipped polygon. |
| Complexity | O(n) |

3D polygon flipped horizontally and along Z
flip_polygons_3d()
flip_polygons_3d(
polygons: Any,
flip_h: bool = False,
flip_v: bool = False,
flip_z: bool = False,
) -> list[types.Polygon3D]
Flip multiple 3D polygons.
| Parameter | Type | Description |
|---|---|---|
polygons | Any | List of 3D polygons. |
flip_h | bool = False | Whether to flip horizontally (negate X). |
flip_v | bool = False | Whether to flip vertically (negate Y). |
flip_z | bool = False | Whether to flip along Z (negate Z). |
| Returns | list[types.Polygon3D] | Flipped polygons. |
| Complexity | O(n * m) |
get_polygon_bounds_3d()
get_polygon_bounds_3d(polygon: Sequence[types.Point3D]) -> types.Rect3D
Get the 3D bounding box of a polygon.
| Parameter | Type | Description |
|---|---|---|
polygon | Sequence[types.Point3D] | Polygon as (x, y, z) points. |
| Returns | types.Rect3D | Bounding box as (x_min, y_min, x_max, y_max, z_min, z_max). |
| Complexity | O(n) |

3D bounding box (Rect3D)
get_polygon_centroid_3d()
get_polygon_centroid_3d(polygon: Sequence[types.Point3D]) -> types.Point3D
Get the centroid of a 3D polygon.
XY centroid from shoelace formula, Z from average.
| Parameter | Type | Description |
|---|---|---|
polygon | Sequence[types.Point3D] | Polygon as (x, y, z) points. |
| Returns | types.Point3D | Centroid point (x, y, z). |
| Complexity | O(n) |

3D centroid – XY via shoelace, Z as average
get_polygon_convex_hull_3d()
get_polygon_convex_hull_3d(polygon: Sequence[types.Point3D]) -> types.Polygon3D
Get the convex hull of a 3D polygon (XY-plane, Z from first vertex).
| Parameter | Type | Description |
|---|---|---|
polygon | Sequence[types.Point3D] | Polygon as (x, y, z) points. |
| Returns | types.Polygon3D | Convex hull as list of (x, y, z) points. |
| Complexity | O(n log n) |

3D convex hull (XY-plane, Z from first hull vertex)
get_polygon_edges_3d()
get_polygon_edges_3d(
polygon: Sequence[types.Point3D],
) -> list[tuple[types.Point3D, types.Point3D]]
Get the edges of a 3D polygon.
| Parameter | Type | Description |
|---|---|---|
polygon | Sequence[types.Point3D] | Polygon as (x, y, z) points. |
| Returns | list[tuple[types.Point3D, types.Point3D]] | List of ((x1, y1, z1), (x2, y2, z2)) edges. |
| Complexity | O(n) |

3D polygon edges as (start, end) pairs
get_polygon_group_bounds_3d()
get_polygon_group_bounds_3d(polygons: Any) -> types.Rect3D
Get the 3D bounding box of a group of polygons.
| Parameter | Type | Description |
|---|---|---|
polygons | Any | List of 3D polygons. |
| Returns | types.Rect3D | Bounding box as (x_min, y_min, x_max, y_max, z_min, z_max). |
| Complexity | O(n * m) |
get_polygon_perimeter_3d()
get_polygon_perimeter_3d(polygon: Sequence[types.Point3D]) -> float
Get the perimeter of a 3D polygon using full 3D edge lengths.
| Parameter | Type | Description |
|---|---|---|
polygon | Sequence[types.Point3D] | Polygon as (x, y, z) points. |
| Returns | float | Perimeter length. |
| Complexity | O(n) |

3D polygon perimeter using full 3D edge lengths