# This file is automatically generated by pyo3_stub_gen
# ruff: noqa: E501, F401, F403, F405
r"""
Segment interpolation utilities for parameter-based point projection,
clipping, and scanline data slicing along 3D line segments.
"""

__all__ = [
    "barycentric_interpolate",
    "compute_segment_delta_3d",
    "compute_t_range",
    "get_barycentric_weights",
    "project_t_along_segment",
    "slice_scanline_data",
    "solve_quadratic",
]

def barycentric_interpolate(p: tuple[float, float], va: tuple[float, float], vb: tuple[float, float], vc: tuple[float, float], ua: float, ub: float, uc: float) -> float:
    r"""
    Interpolate a scalar field at a point inside a triangle.
    
    Given triangle vertices (va, vb, vc) with scalar values
    (ua, ub, uc), returns the linearly interpolated value at point p
    using barycentric coordinates.
    
    :param p: Query point (x, y).
    :param va: First triangle vertex (x, y).
    :param vb: Second triangle vertex (x, y).
    :param vc: Third triangle vertex (x, y).
    :param ua: Scalar value at vertex a.
    :param ub: Scalar value at vertex b.
    :param uc: Scalar value at vertex c.
    :returns: Interpolated scalar value. Outside the triangle, the
        barycentric coordinates are clamped to [0, 1].
    :complexity: O(1) time, O(1) space
    """

def compute_segment_delta_3d(start: tuple[float, float, float], end: tuple[float, float, float]) -> tuple[float, float, float, float]:
    r"""
    Compute delta vector and squared length between two 3D points.
    
    :param start: Starting point (x, y, z).
    :param end: Ending point (x, y, z).
    :returns: (dx, dy, dz, len_sq).
    :complexity: O(1) time, O(1) space
    """

def compute_t_range(origin: tuple[float, float, float], new_start: tuple[float, float, float], new_end: tuple[float, float, float], delta: tuple[float, float, float, float]) -> tuple[float, float]:
    r"""
    Compute parameter range (t_start, t_end) for a clipped sub-segment.
    
    :param origin: Start of original segment (x, y, z).
    :param new_start: Start of clipped sub-segment (x, y, z).
    :param new_end: End of clipped sub-segment (x, y, z).
    :param delta: Segment delta from compute_segment_delta_3d.
    :returns: (t_start, t_end) in [0, 1].
    :complexity: O(1) time, O(1) space
    """

def get_barycentric_weights(p: tuple[float, float], va: tuple[float, float], vb: tuple[float, float], vc: tuple[float, float]) -> tuple[float, float, float]:
    r"""
    Compute raw barycentric coordinates for a point in a triangle.
    
    Returns (r, s, t) where r is the weight for va, s for vb, t for vc.
    Weights are unclamped — the point is strictly inside (or on the
    boundary of) the triangle iff all three are in [0, 1].
    
    :param p: Query point (x, y).
    :param va: First triangle vertex (x, y).
    :param vb: Second triangle vertex (x, y).
    :param vc: Third triangle vertex (x, y).
    :returns: Tuple (r, s, t) of raw barycentric coordinates.
    :complexity: O(1) time, O(1) space
    """

def project_t_along_segment(origin: tuple[float, float, float], point: tuple[float, float, float], delta: tuple[float, float, float, float]) -> float:
    r"""
    Project a point onto a line segment, returning t in [0, 1].
    
    :param origin: Start of segment (x, y, z).
    :param point: Point to project (x, y, z).
    :param delta: Segment delta from compute_segment_delta_3d.
    :returns: Parameter t clamped to [0, 1].
    :complexity: O(1) time, O(1) space
    """

def slice_scanline_data(data: list[int], t_start: float, t_end: float) -> list[int]:
    r"""
    Slice a scanline power array by parameter range [t_start, t_end).
    
    :param data: Full scanline power values.
    :param t_start: Start parameter in [0, 1].
    :param t_end: End parameter in [0, 1].
    :returns: Sliced power values.
    :complexity: O(n) time, O(n) space where n is the length of the data slice
    """

def solve_quadratic(a: float, b: float, c: float) -> tuple[float | None, float | None]:
    r"""
    Solve quadratic equation a x^2 + b x + c = 0.
    
    :param a: Quadratic coefficient.
    :param b: Linear coefficient.
    :param c: Constant term.
    :returns: (root1, root2), each None if no real root.
    :complexity: O(1) time, O(1) space
    """

