Ir al contenido principal

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).

ParameterTypeDescription
amountintKernel size.
Returnstuple[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.

ParameterTypeDescription
pointsSequence[Point3D]Sequence of 3D points.
max_segment_lengthfloatMaximum allowed segment length.
is_closedboolWhether the polyline is closed.
Returnslist[Point3D]

smooth_circularly()

smooth_circularly(points: Sequence[Point3D], kernel: Sequence[float]) -> list[Point3D]

Smooth a closed polyline circularly.

Returns: Smoothed points.

ParameterTypeDescription
pointsSequence[Point3D]Sequence of 3D points to smooth.
kernelSequence[float]Gaussian kernel values.
Returnslist[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.

ParameterTypeDescription
pointsSequence[Point3D]Sequence of 3D points to smooth.
amountintSmoothing amount (kernel size).
corner_angle_thresholdfloatAngle threshold for preserving corners.
is_closedOptional[bool] = NoneWhether the polyline is closed.
Returnslist[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.

ParameterTypeDescription
pointsSequence[Point3D]Sequence of 3D points to smooth.
kernelSequence[float]Gaussian kernel values.
Returnslist[Point3D]