# This file is automatically generated by pyo3_stub_gen
# ruff: noqa: E501, F401, F403, F405

import collections.abc
from raygeo.geo import types
import typing
__all__ = [
    "deduplicate_polyline_3d",
    "fillet_polyline_3d",
    "flip_polygon_3d",
    "flip_polygons_3d",
    "get_polygon_area_3d",
    "get_polygon_bounds_3d",
    "get_polygon_centroid_3d",
    "get_polygon_convex_hull_3d",
    "get_polygon_edges_3d",
    "get_polygon_group_bounds_3d",
    "get_polygon_perimeter_3d",
    "get_polygon_signed_area_3d",
    "get_polygons_closest_point_3d",
    "get_polygons_difference_3d",
    "get_polygons_group_difference_3d",
    "get_polygons_group_intersection_3d",
    "get_polygons_intersection_3d",
    "get_polygons_union_3d",
    "get_polyline_end_tangent_3d",
    "offset_polygon_3d",
    "offset_polyline_3d",
    "resample_polyline_3d",
    "rotate_polygon_3d",
    "rotate_polygons_3d",
    "scale_polygon_3d",
    "translate_polygon_3d",
    "translate_polygons_3d",
    "walk_along_polygon_3d",
    "walk_along_polyline_3d",
]

def deduplicate_polyline_3d(polyline: collections.abc.Sequence[types.Point3D]) -> types.Polygon3D:
    r"""
    Remove consecutive near-identical points from a 3D polyline.
    
    Points whose squared distance is less than 1e-12 are collapsed.
    
    :param polyline: Polyline as (x, y, z) points.
    :returns: Deduplicated polyline.
    :complexity: O(n)
    """

def fillet_polyline_3d(polyline: collections.abc.Sequence[types.Point3D], radius: float) -> types.Polygon3D:
    r"""
    Fillet corners of a 3D polyline with circular arcs.
    
    Each internal vertex with enough room on both adjacent edges is
    replaced by a circular arc of the given radius tangent to both
    edges.
    
    :param polyline: Input polyline as (x, y, z) points.
    :param radius: Fillet radius (must be > 0).
    :returns: Filleted polyline (first and last points preserved).
    :complexity: O(n)
    """

def flip_polygon_3d(polygon: collections.abc.Sequence[types.Point3D], flip_h: bool = False, flip_v: bool = False, flip_z: bool = False) -> types.Polygon3D:
    r"""
    Flip a 3D polygon horizontally, vertically, and/or along Z.
    
    :param polygon: Polygon as (x, y, z) points.
    :param flip_h: Whether to flip horizontally (negate X).
    :param flip_v: Whether to flip vertically (negate Y).
    :param flip_z: Whether to flip along Z (negate Z).
    :returns: Flipped polygon.
    :complexity: O(n)
    """

def flip_polygons_3d(polygons: collections.abc.Sequence[types.Polygon3D], flip_h: bool = False, flip_v: bool = False, flip_z: bool = False) -> list[types.Polygon3D]:
    r"""
    Flip multiple 3D polygons.
    
    :param polygons: List of 3D polygons.
    :param flip_h: Whether to flip horizontally (negate X).
    :param flip_v: Whether to flip vertically (negate Y).
    :param flip_z: Whether to flip along Z (negate Z).
    :returns: Flipped polygons.
    :complexity: O(n * m)
    """

def get_polygon_area_3d(polygon: collections.abc.Sequence[types.Point3D]) -> float:
    r"""
    XY-projected area of a 3D polygon (absolute shoelace area).
    
    :param polygon: Polygon as (x, y, z) points.
    :returns: XY-projected area.
    :complexity: O(n)
    """

def get_polygon_bounds_3d(polygon: collections.abc.Sequence[types.Point3D]) -> types.Rect3D:
    r"""
    Get the 3D bounding box of a polygon.
    
    :param polygon: Polygon as (x, y, z) points.
    :returns: Bounding box as (x_min, y_min, x_max, y_max, z_min, z_max).
    :complexity: O(n)
    """

def get_polygon_centroid_3d(polygon: collections.abc.Sequence[types.Point3D]) -> types.Point3D:
    r"""
    Get the centroid of a 3D polygon.
    
    XY centroid from shoelace formula, Z from average.
    
    :param polygon: Polygon as (x, y, z) points.
    :returns: Centroid point (x, y, z).
    :complexity: O(n)
    """

def get_polygon_convex_hull_3d(polygon: collections.abc.Sequence[types.Point3D]) -> types.Polygon3D:
    r"""
    Get the convex hull of a 3D polygon (XY-plane, Z from first vertex).
    
    :param polygon: Polygon as (x, y, z) points.
    :returns: Convex hull as list of (x, y, z) points.
    :complexity: O(n log n)
    """

def get_polygon_edges_3d(polygon: collections.abc.Sequence[types.Point3D]) -> list[tuple[types.Point3D, types.Point3D]]:
    r"""
    Get the edges of a 3D polygon.
    
    :param polygon: Polygon as (x, y, z) points.
    :returns: List of ((x1, y1, z1), (x2, y2, z2)) edges.
    :complexity: O(n)
    """

def get_polygon_group_bounds_3d(polygons: collections.abc.Sequence[types.Polygon3D]) -> types.Rect3D:
    r"""
    Get the 3D bounding box of a group of polygons.
    
    :param polygons: List of 3D polygons.
    :returns: Bounding box as (x_min, y_min, x_max, y_max, z_min, z_max).
    :complexity: O(n * m)
    """

def get_polygon_perimeter_3d(polygon: collections.abc.Sequence[types.Point3D]) -> float:
    r"""
    Get the perimeter of a 3D polygon using full 3D edge lengths.
    
    :param polygon: Polygon as (x, y, z) points.
    :returns: Perimeter length.
    :complexity: O(n)
    """

def get_polygon_signed_area_3d(polygon: collections.abc.Sequence[types.Point3D]) -> float:
    r"""
    Signed XY-projected area of a 3D polygon (shoelace formula).
    
    Positive for CCW winding, negative for CW.
    
    :param polygon: Polygon as (x, y, z) points.
    :returns: Signed XY-projected area.
    :complexity: O(n)
    """

def get_polygons_closest_point_3d(polygons: collections.abc.Sequence[types.Polygon3D], x: float, y: float, z: float) -> tuple[int, float, tuple[float, float, float], float] | None:
    r"""
    Find the closest point on any 3D polygon in a list to (x, y, z).
    
    :param polygons: List of 3D polygons as (x, y, z) points.
    :param x: X coordinate.
    :param y: Y coordinate.
    :param z: Z coordinate.
    :returns: (polygon_index, t, (cx, cy, cz), distance_squared) or None.
    """

def get_polygons_difference_3d(poly1: collections.abc.Sequence[types.Point3D], poly2: collections.abc.Sequence[types.Point3D]) -> list[types.Polygon3D]:
    r"""
    Compute the difference of two 3D polygons (poly1 - poly2).
    
    :param poly1: Subject 3D polygon.
    :param poly2: Clip 3D polygon.
    :returns: Difference result with Z from first polygon.
    """

def get_polygons_group_difference_3d(subject: collections.abc.Sequence[types.Polygon3D], clip: collections.abc.Sequence[types.Polygon3D]) -> list[types.Polygon3D]:
    r"""
    Group difference of 3D polygons (subject - clip).
    
    :param subject: Subject group of 3D polygons.
    :param clip: Clip group of 3D polygons.
    :returns: Difference result with Z from first subject polygon.
    """

def get_polygons_group_intersection_3d(subject: collections.abc.Sequence[types.Polygon3D], clip: collections.abc.Sequence[types.Polygon3D]) -> list[types.Polygon3D]:
    r"""
    Group intersection of 3D polygons (subject ∩ clip).
    
    :param subject: Subject group of 3D polygons.
    :param clip: Clip group of 3D polygons.
    :returns: Intersection result with Z from first subject polygon.
    """

def get_polygons_intersection_3d(poly1: collections.abc.Sequence[types.Point3D], poly2: collections.abc.Sequence[types.Point3D]) -> list[types.Polygon3D]:
    r"""
    Compute the intersection of two 3D polygons (XY-plane, Z preserved).
    
    :param poly1: First 3D polygon.
    :param poly2: Second 3D polygon.
    :returns: Intersection result with Z from first polygon.
    """

def get_polygons_union_3d(polygons: collections.abc.Sequence[types.Polygon3D]) -> list[types.Polygon3D]:
    r"""
    Compute the union of 3D polygons (XY-plane, Z preserved).
    
    :param polygons: List of 3D polygons.
    :returns: Union result with Z from first polygon.
    """

def get_polyline_end_tangent_3d(polyline: collections.abc.Sequence[types.Point3D]) -> types.Point:
    r"""
    Normalised tangent direction at the last point of a 3D polyline.
    
    Returns the normalised XY direction from the second-to-last point to
    the last point.  Falls back to ``(1.0, 0.0)`` when the polyline has
    fewer than 2 points or the last edge has zero length.
    
    :param polyline: Polyline as (x, y, z) points.
    :returns: Normalised (dx, dy) tangent direction.
    :complexity: O(1)
    """

def offset_polygon_3d(polygon: collections.abc.Sequence[types.Point3D], offset: float) -> list[types.Polygon3D]:
    r"""
    Offset (inflate/deflate) a closed 3D polygon.
    
    :param polygon: Input 3D polygon.
    :param offset: Offset distance (positive = grow, negative = shrink).
    :returns: Offset polygons with Z from input.
    """

def offset_polyline_3d(polyline: collections.abc.Sequence[types.Point3D], distance: float, closed: bool = False) -> types.Polygon3D:
    r"""
    Offset a 3D polyline in true 3D (edge-plane miter).
    
    Unlike :func:`offset_polygon_3d` (which projects to XY, offsets, then
    lifts back), this function offsets each vertex in the local plane of
    its two adjacent edges.  This gives a *true 3D offset* suitable for
    non-planar polylines.
    
    Positive distance offsets to the *left* of the traversal direction.
    
    :param polyline: Input 3D vertices as ``(x, y, z)`` points.
    :param distance: Offset distance (positive = left, negative = right).
    :param closed: When ``True``, the polyline is treated as a closed
        ring (last vertex connects back to first).  When ``False``
        (default), the first and last vertices are offset perpendicular
        to their single edge.
    :returns: Offset polyline with the same number of vertices.
    :complexity: O(n)
    """

def resample_polyline_3d(points: collections.abc.Sequence[types.Point3D], max_segment_length: float, is_closed: bool) -> list[types.Point3D]:
    r"""
    Resample a 3D polyline with a maximum segment length.
    
    :param points: Sequence of 3D points.
    :param max_segment_length: Maximum allowed segment length.
    :param is_closed: Whether the polyline is closed.
    :returns: Resampled 3D points.
    :complexity: O(n) time, O(n) space
    """

def rotate_polygon_3d(polygon: collections.abc.Sequence[types.Point3D], angle: float) -> types.Polygon3D:
    r"""
    Rotate a 3D polygon around the Z axis (XY rotation, Z preserved).
    
    :param polygon: Polygon as (x, y, z) points.
    :param angle: Rotation angle in degrees.
    :returns: Rotated polygon.
    :complexity: O(n)
    """

def rotate_polygons_3d(polygons: collections.abc.Sequence[types.Polygon3D], angle: float) -> list[types.Polygon3D]:
    r"""
    Rotate multiple 3D polygons around the Z axis.
    
    :param polygons: List of 3D polygons.
    :param angle: Rotation angle in degrees.
    :returns: Rotated polygons.
    :complexity: O(n * m)
    """

def scale_polygon_3d(polygon: collections.abc.Sequence[types.Point3D], scale: float, scale_y: typing.Optional[float] = None, scale_z: typing.Optional[float] = None) -> types.Polygon3D:
    r"""
    Scale a 3D polygon.
    
    :param polygon: Polygon as (x, y, z) points.
    :param scale: X (and Y/Z if scale_y/scale_z are None) scale factor.
    :param scale_y: Y scale factor (optional).
    :param scale_z: Z scale factor (optional).
    :returns: Scaled polygon.
    :complexity: O(n)
    """

def translate_polygon_3d(polygon: collections.abc.Sequence[types.Point3D], dx: float, dy: float, dz: float = 0) -> types.Polygon3D:
    r"""
    Translate a 3D polygon.
    
    :param polygon: Polygon as (x, y, z) points.
    :param dx: X translation.
    :param dy: Y translation.
    :param dz: Z translation.
    :returns: Translated polygon.
    :complexity: O(n)
    """

def translate_polygons_3d(polygons: collections.abc.Sequence[types.Polygon3D], dx: float, dy: float, dz: float = 0) -> list[types.Polygon3D]:
    r"""
    Translate a list of 3D polygons.
    
    :param polygons: List of 3D polygons.
    :param dx: X translation.
    :param dy: Y translation.
    :param dz: Z translation.
    :returns: Translated polygons.
    :complexity: O(n * m)
    """

def walk_along_polygon_3d(polygon: collections.abc.Sequence[types.Point3D], start: tuple[float, float, float], forward: bool, distance: float) -> types.Point3D:
    r"""
    Walk along a closed 3D polygon by a given arc length from a starting point.
    
    Given a closed polygon and a starting point on it, walk along the
    polygon edges and return the point at exactly ``distance`` units
    away.  The walk wraps around the polygon (unlike
    :func:`walk_along_polyline_3d` which clamps at endpoints).
    
    :param polygon: Closed polygon as (x, y, z) points.
    :param start: Starting point on the polygon.
    :param forward: Walk forward (along vertex order) if True, backward if False.
    :param distance: Arc length to walk.
    :returns: Point (x, y, z) at the given distance.
    :complexity: O(n)
    """

def walk_along_polyline_3d(polyline: collections.abc.Sequence[types.Point3D], start: tuple[float, float, float], forward: bool, distance: float) -> types.Point3D:
    r"""
    Walk along an open 3D polyline by a given arc length from a starting point.
    
    Given an open polyline and a starting point on it, walk along the
    polyline segments and return the point at exactly ``distance`` units
    away.  Clamps to the nearest endpoint when the walk would exceed it.
    
    :param polyline: Open polyline as (x, y, z) points.
    :param start: Starting point on the polyline.
    :param forward: Walk forward (along vertex order) if True, backward if False.
    :param distance: Arc length to walk.
    :returns: Point (x, y, z) at the given distance.
    :complexity: O(n)
    """

