Back to Adaptive Vision Library website
You are here: Start » Function Reference » Geometry 2D Fitting » FitLineToPoints
FitLineToPoints
Approximates points with a line using the Least Squares method.
Syntax
C++
C#
void avl::FitLineToPoints ( const atl::Array<avl::Point2D>& inPoints, avl::Line2D& outLine, atl::Optional<atl::real&> outError = atl::NIL )
Parameters
| Name | Type | Default | Description | |
|---|---|---|---|---|
![]() |
inPoints | const Array<Point2D>& | ||
![]() |
outLine | Line2D& | ||
![]() |
outError | Optional<real&> | NIL |
Examples
![]() |
The resulting outLine drawn with the input points.
Errors
| Error type | Description |
|---|---|
| DomainError | Empty point array in FitLineToPoints. |



