Back to FabImage Library website
You are here: Start » Function Reference » Geometry 2D » Geometry 2D Fitting » FitSegmentToPoints
FitSegmentToPoints
| Header: | FIL.h |
|---|---|
| Namespace: | fil |
| 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.
Syntax
C++
C#
void fil::FitSegmentToPoints ( const ftl::Array<fil::Point2D>& inPoints, ftl::Optional<const fil::Range&> inRange, ftl::Optional<fil::MEstimator::Type> inOutlierSuppression, fil::Segment2D& outSegment, ftl::Optional<ftl::Array<fil::Point2D>&> outInliers = ftl::NIL )
Parameters
| Name | Type | Default | Description | |
|---|---|---|---|---|
![]() |
inPoints | const Array<Point2D>& | ||
![]() |
inRange | Optional<const Range&> | NIL | Determines which array points take part in fitting process |
![]() |
inOutlierSuppression | Optional<MEstimator::Type> | NIL | |
![]() |
outSegment | Segment2D& | ||
![]() |
outInliers | Optional<Array<Point2D>&> | NIL |
Optional Outputs
The computation of following outputs can be switched off by passing value ftl::NIL to these parameters: outInliers.
Read more about Optional Outputs.
Description
The orientation of the resulting outSegment is always between 0 and 180 degrees.
Examples
![]() |
The resulting outSegment drawn with the input points, inOutlierSuppression = Auto.



