public boolean svd ( List < Point3D_F64 > points , Point3D_F64 outputCenter , Vector3D_F64 outputNormal ) { final int N = points . size ( ) ; // find the centroid outputCenter . set ( 0 , 0 , 0 ) ; for ( int i = 0 ; i < N ; i ++ ) { Point3D_F64 p = points . get ( i ) ; outputCenter . x += p . x ; outputCenter . y += p . y ; outputCenter . z += p . z ; } outputCenter . x /= N ; outputCenter . y /= N ; outputCenter . z /= N ; return solvePoint ( points , outputCenter , outputNormal ) ; }
SVD based method for fitting a plane to a set of points . The plane s equation is returned as a point on the plane and the normal vector .