The function linear_least_squares_fitting_2 computes the best fitting 2D line of a 2D point set. The best fit line minimizes the sum of squared distances from the points to their projections onto the line.
#include <CGAL/linear_least_squares_fitting_2.h>
| ||||
|
| |||
computes the best fitting 2D line of a 2D point set in the range [first,beyond). The value returned is a fitting quality between and , where means that the variance is the same along any line (a horizontal line going through the centroid is output by default), and means that the variance is null orthogonally to the best fitting line. |
The class K is the kernel in which the type InputIterator::value_type is defined. It can be omitted and deduced automatically from the value type.