# linear_least_squares_fitting_3() gives bad fitting quality for input of only 3 points

4 messages
Open this post in threaded view
|

## linear_least_squares_fitting_3() gives bad fitting quality for input of only 3 points

 Hi all, I am using CGAL::linear_least_squares_fitting_3() to fit planes from point set. It works pretty well for data set with more than 3 points. But I was surprised that this function behaved when fitting a plane form 3 points. The function returned 0.495031, which meant the variance orthogonally to the fitting plane was quite big. Acutally 1.0 is expected because 3 points are exactlly in the same plane. Can someone explain? Here is the code I call the fitting function:                 Plane3f plane;                 double q = CGAL::linear_least_squares_fitting_3(                         pts.begin(),                         pts.end(),                         plane,                         CGAL::Dimension_tag<0>()                         ); And the input(only 3 points):         ==================================                 86.1817 3075.31 1031.53                 164.575 3075.31 913.936                 754.546 0 28.9401         ================================== -- Leon http://web.siat.ac.cn/~liangliang/-- You are currently subscribed to cgal-discuss. To unsubscribe or access the archives, go to https://lists-sop.inria.fr/wws/info/cgal-discuss
Open this post in threaded view
|

## Re: linear_least_squares_fitting_3() gives bad fitting quality for input of only 3 points

 dear Leon, thank you for discussing this bug. I think the problem comes from the eigenvalue computation. we will dig this out. in the meantime I invite you to replace the code which computes the eigenvalues/vectors by calls to the eigen library, and report whay you get here in this list. thank you, Pierre Le 21/09/2011 08:13, Leon Nan a écrit : > Hi all, > > I am using CGAL::linear_least_squares_fitting_3() to fit planes from point set. It works pretty well for data set with more than 3 points. But I was surprised that this function behaved when fitting a plane form 3 points. The function returned 0.495031, which meant the variance orthogonally to the fitting plane was quite big. Acutally 1.0 is expected because 3 points are exactlly in the same plane. Can someone explain? > > Here is the code I call the fitting function: >                 Plane3f plane; > double q = CGAL::linear_least_squares_fitting_3( > pts.begin(), > pts.end(), > plane, > CGAL::Dimension_tag<0>() > ); > > > And the input(only 3 points): > ================================== > 86.1817 3075.31 1031.53 > 164.575 3075.31 913.936 > 754.546 0 28.9401 > ================================== > > -- > Leon > http://web.siat.ac.cn/~liangliang/> > -- You are currently subscribed to cgal-discuss. To unsubscribe or access the archives, go to https://lists-sop.inria.fr/wws/info/cgal-discuss