HDK

Go to the source code of this file.
Classes  
class  GfPlane 
Functions  
GF_API bool  GfFitPlaneToPoints (const std::vector< GfVec3d > &points, GfPlane *fitPlane) 
GF_API std::ostream &  operator<< (std::ostream &, const GfPlane &) 
Fits a plane to the given points
. There must be at least three points in order to fit the plane; if the size of points
is less than three, this issues a coding error.
If the points
are all collinear, then no plane can be determined, and this function returns false
. Otherwise, if the fitting is successful, it returns true
and sets *fitPlane
to the fitted plane. If points
contains exactly three points, then the resulting plane is the exact plane defined by the three points. If points
contains more than three points, then this function determines the bestfitting plane for the given points. The orientation of the plane normal is arbitrary with regards to the plane's positive and negative halfspaces; you can use GfPlane::Reorient() to flip the plane if necessary.
The current implementation uses linear least squares and thus defines "bestfitting" as minimizing the sum of the squares of the vertical distances between points and the plane surface.