MeshCore::CylinderFit Class Reference

Approximation of a cylinder into a given set of points. More...

#include <Approximation.h>

Public Member Functions

 CylinderFit ()
 Construction. More...
 
float Fit ()
 Fit a cylinder into the given points. More...
 
Base::Vector3f GetAxis () const
 Returns the axis of the fitted cylinder. More...
 
Base::Vector3f GetBase () const
 
void GetBounding (Base::Vector3f &bottom, Base::Vector3f &top) const
 Get the bottom and top points of the cylinder. More...
 
float GetDistanceToCylinder (const Base::Vector3f &rcPoint) const
 Returns the distance from the point rcPoint to the fitted cylinder. More...
 
Base::Vector3f GetInitialAxisFromNormals (const std::vector< Base::Vector3f > &n) const
 Returns an initial axis based on point normals. More...
 
float GetRadius () const
 
float GetStdDeviation () const
 Returns the standard deviation from the points to the fitted cylinder. More...
 
void ProjectToCylinder ()
 Projects the points onto the fitted cylinder. More...
 
void SetInitialValues (const Base::Vector3f &, const Base::Vector3f &)
 
virtual ~CylinderFit ()
 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...
 
unsigned long 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...
 
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 cylinder into a given set of points.

Constructor & Destructor Documentation

◆ CylinderFit()

CylinderFit::CylinderFit ( )

Construction.

◆ ~CylinderFit()

CylinderFit::~CylinderFit ( )
virtual

Destruction.

Member Function Documentation

◆ Fit()

◆ GetAxis()

Base::Vector3f CylinderFit::GetAxis ( ) const

◆ GetBase()

◆ GetBounding()

void CylinderFit::GetBounding ( Base::Vector3f bottom,
Base::Vector3f top 
) const

Get the bottom and top points of the cylinder.

The distance of these points gives the height of the cylinder.

References DraftVecUtils::dist().

Referenced by MeshGui::CylinderFitParameter::getParameter().

◆ GetDistanceToCylinder()

float CylinderFit::GetDistanceToCylinder ( const Base::Vector3f rcPoint) const

Returns the distance from the point rcPoint to the fitted cylinder.

If Fit() has not been called FLOAT_MAX is returned.

References Base::Vector3< _Precision >::DistanceToLine().

Referenced by GetStdDeviation().

◆ GetInitialAxisFromNormals()

◆ GetRadius()

◆ GetStdDeviation()

float CylinderFit::GetStdDeviation ( ) const

Returns the standard deviation from the points to the fitted cylinder.

If Fit() has not been called FLOAT_MAX is returned.

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

◆ ProjectToCylinder()

void CylinderFit::ProjectToCylinder ( )

◆ SetInitialValues()


The documentation for this class was generated from the following files:
  • Sources/FreeCAD/src/Mod/Mesh/App/Core/Approximation.h
  • Sources/FreeCAD/src/Mod/Mesh/App/Core/Approximation.cpp