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

AVL.FitLineToPoints

Approximates points with a line using the Least Squares method.

Namespace:AvlNet
Assembly:AVL.NET.dll

Syntax

C++
C#
 
public static void FitLineToPoints
(
	IList<AvlNet.Point2D> inPoints,
	AvlNet.Range? inRange,
	out AvlNet.Line2D outLine,
	NullableValue<float> outError
)

Parameters

Name Type Range Default Description
inPointsSystem.Collections.Generic.IList<AvlNet.Point2D>
inRangeAvlNet.Range?Determines which array points take part in fitting process. Default value: atl::NIL.
outLineAvlNet.Line2D
outErrorAvlNet.NullableValue<float>Sum of the point distances from the output line. Can be null to skip this parameter calculation.

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.

Function Overrides

See also