MeshCore::SurfaceFit Class Reference

This is an 2.5D approach which first determines the bestfit plane of the point set (P_i = (x,y,z), i=1,...,n) to get a parametrisation of the points afterwards. More...

#include <Approximation.h>

Public Member Functions

float Fit ()
 Fit a plane into the given points. More...
 
void GetCoefficients (double &a, double &b, double &c, double &d, double &e, double &f) const
 
bool GetCurvatureInfo (double x, double y, double z, double &rfCurv0, double &rfcurv1)
 
bool GetCurvatureInfo (double x, double y, double z, double &rfCurv0, double &rfCurv1, Base::Vector3f &rkDir0, Base::Vector3f &rkDir1, double &dDistance)
 
 SurfaceFit ()
 Construction. More...
 
std::vector< Base::Vector3dtoBezier (double umin=0.0, double umax=1.0, double vmin=0.0, double vmax=1.0) const
 toBezier More...
 
void Transform (std::vector< Base::Vector3d > &) const
 
void Transform (std::vector< Base::Vector3f > &) const
 Transform Transforms points from the local coordinate system to the world coordinate system. More...
 
double Value (double x, double y) const
 
virtual ~SurfaceFit ()
 Destruction. More...
 
- Public Member Functions inherited from MeshCore::PlaneFit
void Dimension (float &length, float &width) const
 Get the dimension of the fitted plane. More...
 
float Fit ()
 Fit a plane into the given points. More...
 
Base::Vector3f GetBase () const
 
Base::BoundBox3f GetBoundings () const
 Returns the local bounding box of the transformed points relative to the coordinate system of the plane. More...
 
Base::Vector3f GetDirU () const
 
Base::Vector3f GetDirV () const
 
float GetDistanceToPlane (const Base::Vector3f &rcPoint) const
 Returns the distance from the point rcPoint to the fitted plane. More...
 
std::vector< Base::Vector3fGetLocalPoints () const
 Returns an array of the transformed points relative to the coordinate system of the plane. More...
 
Base::Vector3f GetNormal () const
 Returns the normal of the fitted plane. More...
 
float GetSignedStdDeviation () const
 Returns the standard deviation from the points to the fitted plane with respect to the orientation of the plane's normal. More...
 
float GetStdDeviation () const
 Returns the standard deviation from the points to the fitted plane. More...
 
 PlaneFit ()
 Construction. More...
 
void ProjectToPlane ()
 Projects the points onto the fitted plane. More...
 
virtual ~PlaneFit ()
 Destruction. More...
 
- Public Member Functions inherited from MeshCore::Approximation
void AddPoint (const Base::Vector3f &rcVector)
 Add point for the fit algorithm. More...
 
void AddPoints (const MeshPointArray &points)
 Add points for the fit algorithm. More...
 
void AddPoints (const std::list< Base::Vector3f > &rsPointList)
 Add points for the fit algorithm. More...
 
void AddPoints (const std::set< Base::Vector3f > &rsPointSet)
 Add points for the fit algorithm. More...
 
void AddPoints (const std::vector< Base::Vector3f > &rvPointVect)
 Add points for the fit algorithm. More...
 
 Approximation ()
 Construction. More...
 
void Clear ()
 Deletes the inserted points and frees any allocated resources. More...
 
std::size_t CountPoints () const
 Determines the number of the current added points. More...
 
bool Done () const
 Returns true if Fit() has been called for the current set of points, false otherwise. More...
 
virtual float Fit ()=0
 Pure virtual function to fit the geometry to the given points. More...
 
Base::Vector3f GetGravity () const
 Returns the center of gravity of the current added points. More...
 
float GetLastResult () const
 Returns the result of the last fit. More...
 
const std::list< Base::Vector3f > & GetPoints () const
 Get all added points. More...
 
virtual ~Approximation ()
 Destroys the object and frees any allocated resources. More...
 

Protected Member Functions

double PolynomFit ()
 
- Protected Member Functions inherited from MeshCore::Approximation
void GetMgcVectorArray (std::vector< Wm4::Vector3< double > > &rcPts) const
 Creates a vector of Wm4::Vector3 elements. More...
 

Detailed Description

This is an 2.5D approach which first determines the bestfit plane of the point set (P_i = (x,y,z), i=1,...,n) to get a parametrisation of the points afterwards.

The coordinates of the points with respect to the local coordinate system of the plane are determined and then a quadratic polynomial function of the form: w = f(u,v) = a*u^2 + b*v^2 + c*u*v + d*u + e*v + f is determined. This approach was developed as an alternative for the 3D approach with quadrics because the latter suffers from strange artifacts in planar areas.

Constructor & Destructor Documentation

◆ SurfaceFit()

SurfaceFit::SurfaceFit ( )

Construction.

◆ ~SurfaceFit()

virtual MeshCore::SurfaceFit::~SurfaceFit ( )
virtual

Destruction.

Member Function Documentation

◆ Fit()

float SurfaceFit::Fit ( )
virtual

Fit a plane into the given points.

We must have at least three non-collinear points to succeed. If the fit fails FLOAT_MAX is returned.

Reimplemented from MeshCore::PlaneFit.

References MeshCore::Approximation::CountPoints(), and PolynomFit().

Referenced by MeshCore::FacetCurvature::Compute().

◆ GetCoefficients()

void SurfaceFit::GetCoefficients ( double &  a,
double &  b,
double &  c,
double &  d,
double &  e,
double &  f 
) const

◆ GetCurvatureInfo() [1/2]

bool SurfaceFit::GetCurvatureInfo ( double  x,
double  y,
double  z,
double &  rfCurv0,
double &  rfcurv1 
)

◆ GetCurvatureInfo() [2/2]

bool SurfaceFit::GetCurvatureInfo ( double  x,
double  y,
double  z,
double &  rfCurv0,
double &  rfCurv1,
Base::Vector3f rkDir0,
Base::Vector3f rkDir1,
double &  dDistance 
)

◆ PolynomFit()

◆ toBezier()

std::vector< Base::Vector3d > SurfaceFit::toBezier ( double  umin = 0.0,
double  umax = 1.0,
double  vmin = 0.0,
double  vmax = 1.0 
) const

toBezier

SurfaceFit::toBezier This function computes the Bezier representation of the polynomial surface of the form f(x,y) = a*x*x + b*y*y + c*x*y + d*y + e*f + f by getting the 3x3 control points.

Parameters
uminParameter range
umaxParameter range
vminParameter range
vmaxParameter range
Returns
control points of the Bezier surface

References Value().

◆ Transform() [1/2]

void SurfaceFit::Transform ( std::vector< Base::Vector3d > &  pts) const

◆ Transform() [2/2]

void SurfaceFit::Transform ( std::vector< Base::Vector3f > &  pts) const

Transform Transforms points from the local coordinate system to the world coordinate system.

References Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.

◆ Value()

double SurfaceFit::Value ( double  x,
double  y 
) const

References MeshCore::FunctionContainer::F().

Referenced by toBezier().


The documentation for this class was generated from the following files: