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

import collections.abc
from raygeo.geo import types
__all__ = [
    "get_polyline_bounds",
    "get_polyline_closest_point",
    "resample_polyline",
    "split_polyline_at_v_junctions",
    "trim_polyline_angular_ends",
    "trim_polyline_at",
]

def get_polyline_bounds(polyline: collections.abc.Sequence[types.Point]) -> types.Rect:
    r"""
    Get the bounding rectangle of an open polyline.
    
    :param polyline: Polyline as (x, y) points.
    :returns: Bounding rectangle as (x_min, y_min, x_max, y_max).
    :complexity: O(n)
    """

def get_polyline_closest_point(polyline: collections.abc.Sequence[tuple[float, float]], point: tuple[float, float]) -> tuple[int, float] | None:
    r"""
    Find the closest edge and parametric position on an open polyline.
    
    Each edge of the polyline is tested, and the closest one is
    returned as ``(edge_index, t)`` where ``t`` in [0, 1] is the
    parametric position along that edge.
    
    :param polyline: Open polyline as (x, y) points.
    :param point: Query point (x, y).
    :returns: ``(edge_index, t)`` or None if the polyline has fewer
              than 2 points.
    """

def resample_polyline(polyline: collections.abc.Sequence[tuple[float, float]], max_len: float) -> list[tuple[float, float]]:
    r"""
    Resample an open 2D polyline so consecutive points are at most
    *max_len* apart.
    
    New points are linearly interpolated along each segment that
    exceeds the threshold.  The first and last points are always
    preserved.
    
    :param polyline: Open polyline as (x, y) points.
    :param max_len: Maximum allowed segment length.
    :returns: Resampled polyline.
    :complexity: O(n * m)
    """

def split_polyline_at_v_junctions(polyline: collections.abc.Sequence[tuple[float, float]], angle_threshold: float) -> list[list[tuple[float, float]]]:
    r"""
    Split a polyline at V-junction vertices where the interior
    angle is much sharper than both neighbours.
    
    Each resulting sub-polyline is trimmed with
    ``trim_polyline_angular_ends``.
    
    :param polyline: Sequence of (x, y) points.
    :param angle_threshold: Angle threshold in radians.
    :returns: List of sub-polylines.
    :complexity: O(n) time, O(n) space
    """

def trim_polyline_angular_ends(polygon: collections.abc.Sequence[tuple[float, float]], start: int, length: int, angle_threshold_rad: float) -> tuple[int, int]:
    r"""
    Trim vertices from both ends of a contiguous subsequence where the
    interior angle jumps sharply.
    
    Detects "transition" vertices at the boundary between two differently-
    curved regions of a closed polygon.  The function iteratively trims
    such vertices from the start and end of the subsequence until no more
    trimming occurs or the sequence is too short.
    
    :param polygon: Closed polygon as (x, y) points.
    :param start: Start index of the subsequence.
    :param length: Length of the subsequence.
    :param angle_threshold_rad: Angle threshold in radians.
    :returns: ``(new_start, new_length)`` within the original polygon.
    """

def trim_polyline_at(polyline: collections.abc.Sequence[tuple[float, float]], a: tuple[float, float], b: tuple[float, float]) -> list[tuple[float, float]]:
    r"""
    Trim a polyline to the portion between two points.
    
    Each point is projected onto the nearest edge of the polyline.
    The returned polyline goes from the projection of *a* to the
    projection of *b*, preserving intermediate vertices.
    
    :param polyline: Open polyline as (x, y) points.
    :param a: Start point to trim at.
    :param b: End point to trim at.
    :returns: Trimmed polyline.
    """

