FitSegmentToPoints_TheilSen


Approximates points with a segment using TheilSen algorithm, optionally with Siegel's improvement.

Applications:Finds a well matching segment, ignoring up to 29.3% (TheilSen) or 50.0% (Siegel) outliers. Outliers do have some influence on accuracy.

Syntax

C++
C#
Python
 
def FitSegmentToPoints_TheilSen(
	inPoints: list[Point2D],
	/,
	*,
	inRange: Range | None = None,
	inVariant: TheilSenVariant = TheilSenVariant.TheilSen,
	inSampleLimit: int | None = None,
	inOutlierRatio: float | None = None
)
-> (
	outSegment: Segment2D,
	diagOrientations: list[float]
)

Parameters

Name Type Range Default Description
Input value inPoints list[Point2D] Input points
Input value inRange Range | None None Determines which array points take part in fitting process
Input value inVariant TheilSenVariant TheilSenVariant.TheilSen Switches between Theil-Sen and Siegel methods
Input value inSampleLimit int | None 5 - None How many pairs of points are used to estimate orientation
Input value inOutlierRatio float | None 0.0 - 0.99 None
Output value outSegment Segment2D Fitted segment
Diagnostic input diagOrientations list[float] Sample orientations used to determine the output line orientation