Back to FabImage Library website
You are here: Start » Function Reference » Geometry 2D Fitting » FitLineToPoints
FitLineToPoints
| Header: | FIL.h |
|---|---|
| Namespace: | fil |
Approximates points with a line using the Least Squares method.
Syntax
C++
C#
void fil::FitLineToPoints ( const ftl::Array<fil::Point2D>& inPoints, fil::Line2D& outLine, ftl::Optional<float&> outError = ftl::NIL )
Parameters
| Name | Type | Default | Description | |
|---|---|---|---|---|
![]() |
inPoints | const Array<Point2D>& | ||
![]() |
outLine | Line2D& | ||
![]() |
outError | Optional<float&> | NIL |
Optional Outputs
The computation of following outputs can be switched off by passing value ftl::NIL to these parameters: outLine, outError.
Read more about Optional Outputs.
Examples
![]() |
The resulting outLine drawn with the input points.
Errors
List of possible exceptions:
| Error type | Description |
|---|---|
| DomainError | Empty point array in FitLineToPoints. |



