Back to Adaptive Vision Library website

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

FitLineToPoints


Header:AVL.h
Namespace:avl

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
inPoints const Array<Point2D>&
inRange Optional<const Range&> NIL Determines which array points take part in fitting process
outLine Line2D&
outError Optional<float&> NIL

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 point array in FitLineToPoints.