raygeo.geo.algo.smooth
Polyline smoothing using Gaussian kernels.
Provides Gaussian kernel computation and circular/linear polyline smoothing with configurable corner angle thresholds to preserve sharp features.
Functions
compute_gaussian_kernel()
compute_gaussian_kernel(amount: int) -> tuple[list[float], float]
Compute a Gaussian kernel of the given size.
Returns: Tuple of (kernel_values, sigma).
| Parameter | Type | Description |
|---|---|---|
amount | int | Kernel size. |
| Returns | tuple[list[float], float] |
resample_polyline()
resample_polyline(points: Sequence[Point3D], max_segment_length: float, is_closed: bool) -> list[Point3D]
Resample a polyline with a maximum segment length.
Returns: Resampled points.
| Parameter | Type | Description |
|---|---|---|
points | Sequence[Point3D] | Sequence of 3D points. |
max_segment_length | float | Maximum allowed segment length. |
is_closed | bool | Whether the polyline is closed. |
| Returns | list[Point3D] |
smooth_circularly()
smooth_circularly(points: Sequence[Point3D], kernel: Sequence[float]) -> list[Point3D]
Smooth a closed polyline circularly.
Returns: Smoothed points.
| Parameter | Type | Description |
|---|---|---|
points | Sequence[Point3D] | Sequence of 3D points to smooth. |
kernel | Sequence[float] | Gaussian kernel values. |
| Returns | list[Point3D] |
smooth_polyline()
smooth_polyline(points: Sequence[Point3D], amount: int, corner_angle_threshold: float, is_closed: Optional[bool] = None) -> list[Point3D]
Smooth a polyline using Gaussian smoothing.
Returns: Smoothed points.
| Parameter | Type | Description |
|---|---|---|
points | Sequence[Point3D] | Sequence of 3D points to smooth. |
amount | int | Smoothing amount (kernel size). |
corner_angle_threshold | float | Angle threshold for preserving corners. |
is_closed | Optional[bool] = None | Whether the polyline is closed. |
| Returns | list[Point3D] |
smooth_sub_segment()
smooth_sub_segment(points: Sequence[Point3D], kernel: Sequence[float]) -> list[Point3D]
Smooth a sub-segment of a polyline.
Returns: Smoothed points.
| Parameter | Type | Description |
|---|---|---|
points | Sequence[Point3D] | Sequence of 3D points to smooth. |
kernel | Sequence[float] | Gaussian kernel values. |
| Returns | list[Point3D] |