Back to Aurora Vision Library website

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

FitLineToPoints


Header: AVL.h
Namespace: avl
Module: FoundationBasic

Approximates points with a line using the Least Squares method.

Syntax

C++
C#
 
void avl::FitLineToPoints
(
	const atl::Array<avl::Point2D>& inPoints,
	atl::Optional<const avl::Range&> inRange,
	avl::Line2D& outLine,
	atl::Optional<float&> outError = atl::NIL
)

Parameters

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
Output value outLine Line2D&
Output value outError Optional<float&> NIL Sum of the point distances from the output line

Optional Outputs

The computation of following outputs can be switched off by passing value atl::NIL to these parameters: 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 array of points in FitLineToPoints.
DomainError Range exceeds the input point array in FitLineToPoints.