Back to Aurora Vision Library website

You are here: Start » Function Reference » Geometry 2D » Geometry 2D Fitting » FitSegmentToPoints


Header: AVL.h
Namespace: avl
Module: FoundationBasic

Approximates points with a segment using selected outliers suppression method.

Applications: Finding a locally optimal segment. Good enough when the number of outliers is small.


void avl::FitSegmentToPoints
	const atl::Array<avl::Point2D>& inPoints,
	atl::Optional<const avl::Range&> inRange,
	atl::Optional<avl::MEstimator::Type> inOutlierSuppression,
	avl::Segment2D& outSegment,
	atl::Optional<atl::Array<avl::Point2D>&> outInliers = atl::NIL


Name Type Default Description
Input value
inPoints const Array<Point2D>&
Input value
inRange Optional<const Range&> NIL Determines which array points take part in fitting process
Input value
inOutlierSuppression Optional<MEstimator::Type> NIL
Output value
outSegment Segment2D&
Output value
outInliers Optional<Array<Point2D>&> NIL

Optional Outputs

The computation of following outputs can be switched off by passing value atl::NIL to these parameters: outInliers.

Read more about Optional Outputs.


The orientation of the resulting outSegment is always between 0 and 180 degrees.


The resulting outSegment drawn with the input points, inOutlierSuppression = Auto.


List of possible exceptions:

Error type Description
DomainError Empty array of points in FitSegmentToPoints.
DomainError Range exceeds the input point array in FitSegmentToPoints.