raygeo.geo.algo.fitting
Curve and primitive fitting algorithms.
Provides functions for fitting arcs, lines, circles, and beziers to point sequences. Includes recursive fitting with primitives, polyline linearization, and evaluating fitting quality (line and arc deviation).
Functions
are_points_collinear_3d()
are_points_collinear_3d(
points: Sequence[types.Point3D],
tolerance: float = 1e-06,
) -> bool
Check if three or more points are collinear within tolerance.
| Parameter | Type | Description |
|---|---|---|
points | Sequence[types.Point3D] | Sequence of 3D points. |
tolerance | float = 1e-06 | Collinearity tolerance. |
| Returns | bool | True if points are collinear. |
| Complexity | O(n) time, O(1) space |
fit_circle_to_3_points()
fit_circle_to_3_points(
p1: types.Point2DOr3D,
p2: types.Point2DOr3D,
p3: types.Point2DOr3D,
) -> Optional[tuple[types.Point, float]]
Fit a circle to three points.
| Parameter | Type | Description |
|---|---|---|
p1 | types.Point2DOr3D | First point (x, y) or (x, y, z). |
p2 | types.Point2DOr3D | Second point (x, y) or (x, y, z). |
p3 | types.Point2DOr3D | Third point (x, y) or (x, y, z). |
| Returns | Optional[tuple[types.Point, float]] | Tuple of (center, radius) or None. |
| Complexity | O(1) time, O(1) space |

Circle fitted to three points