MeshCore::QuadraticFit Class Reference

Approximation of a quadratic surface into a given set of points. More...

#include <Approximation.h>

Public Member Functions

void CalcEigenValues (double &dLambda1, double &dLambda2, double &dLambda3, Base::Vector3f &clEV1, Base::Vector3f &clEV2, Base::Vector3f &clEV3) const
 Compute form matrix A and calculate Eigenvalues. More...
 
void CalcZValues (double x, double y, double &dZ1, double &dZ2) const
 
float Fit ()
 Invocation of fitting algorithm. More...
 
double GetCoeff (std::size_t ulIndex) const
 Get the quadric coefficients. More...
 
const double & GetCoeffArray () const
 Get the quadric coefficients as reference to the internal array. More...
 
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)
 Calculate the curvatures of the quadric at a given point. More...
 
 QuadraticFit ()
 Construction. More...
 
virtual ~QuadraticFit ()
 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...
 

Additional Inherited Members

- 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

Approximation of a quadratic surface into a given set of points.

The implicit form of the surface is defined by F(x,y,z) = a * x^2 + b * y^2 + c * z^2 + 2d * x * y + 2e * x * z + 2f * y * z + g * x + h * y + * i * z + k = 0 Depending on the parameters (a,..,k) this surface defines a sphere, ellipsoid, cylinder, cone and so on.

Constructor & Destructor Documentation

◆ QuadraticFit()

MeshCore::QuadraticFit::QuadraticFit ( )

Construction.

◆ ~QuadraticFit()

virtual MeshCore::QuadraticFit::~QuadraticFit ( )
virtual

Destruction.

Member Function Documentation

◆ CalcEigenValues()

void QuadraticFit::CalcEigenValues ( double &  dLambda1,
double &  dLambda2,
double &  dLambda3,
Base::Vector3f clEV1,
Base::Vector3f clEV2,
Base::Vector3f clEV3 
) const

Compute form matrix A and calculate Eigenvalues.

Parameters
dLambda1Eigenvalue 1
dLambda2Eigenvalue 2
dLambda3Eigenvalue 3
clEV1Eigenvector 1
clEV2Eigenvector 2
clEV3Eigenvector 3

◆ CalcZValues()

void QuadraticFit::CalcZValues ( double  x,
double  y,
double &  dZ1,
double &  dZ2 
) const

◆ Fit()

float QuadraticFit::Fit ( )
virtual

Invocation of fitting algorithm.

Returns
float Quality of fit.

Implements MeshCore::Approximation.

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

◆ GetCoeff()

double QuadraticFit::GetCoeff ( std::size_t  ulIndex) const

Get the quadric coefficients.

Parameters
ulIndexNumber of coefficient (0..9)
Returns
double value of coefficient

◆ GetCoeffArray()

const double & QuadraticFit::GetCoeffArray ( ) const

Get the quadric coefficients as reference to the internal array.

Returns
const double& Reference to the double array

◆ GetCurvatureInfo() [1/2]

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

◆ GetCurvatureInfo() [2/2]

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

Calculate the curvatures of the quadric at a given point.

Parameters
xX-coordinate
yY-coordinate
zZ-coordinate
rfCurv01. principal curvature
rfCurv12. principal curvature
rkDir0Direction of 1. principal curvature
rkDir1Direction of 2. principal curvature
dDistance
Returns
bool Success = true, otherwise false

References MeshCore::FunctionContainer::CurvatureInfo(), MeshCore::FunctionContainer::GetGradient(), and Base::Vector3< _Precision >::Length().


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