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... | |
![]() | |
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 | |
![]() | |
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()
|
virtual |
Destruction.
Member Function Documentation
◆ Fit()
|
virtual |
Fit a cylinder into the given points.
If the fit fails FLOAT_MAX is returned.
Implements MeshCore::Approximation.
References MeshCore::Approximation::AddPoints(), Base::Console(), MeshCore::Approximation::CountPoints(), MeshCoreFit::CylinderFit::Fit(), MeshCoreFit::CylinderFit::GetAxis(), MeshCoreFit::CylinderFit::GetBase(), MeshCoreFit::CylinderFit::GetNumIterations(), MeshCoreFit::CylinderFit::GetRadius(), MeshCoreFit::CylinderFit::GetStdDeviation(), Base::ConsoleSingleton::Log(), MeshCore::LMCylinderFunctor::m, MeshCore::LMCylinderFunctor::measuredValues, MeshCore::LMCylinderFunctor::n, MeshCoreFit::CylinderFit::SetApproximations(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
Referenced by MeshCore::CylinderSurfaceFit::Fit(), MeshGui::CylinderFitParameter::getParameter(), and ReverseEngineeringGui::SegmentationManual::on_cylinderDetect_clicked().
◆ GetAxis()
Base::Vector3f CylinderFit::GetAxis | ( | ) | const |
Returns the axis of the fitted cylinder.
If Fit() has not been called the null vector is returned.
Referenced by MeshCore::CylinderSurfaceFit::Fit(), MeshGui::CylinderFitParameter::getParameter(), ReverseEngineeringGui::SegmentationManual::on_cylinderDetect_clicked(), MeshCore::CylinderSurfaceFit::Parameters(), and ProjectToCylinder().
◆ GetBase()
Base::Vector3f CylinderFit::GetBase | ( | ) | const |
◆ 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()
Base::Vector3f CylinderFit::GetInitialAxisFromNormals | ( | const std::vector< Base::Vector3f > & | n | ) | const |
Returns an initial axis based on point normals.
References MeshCore::Approximation::AddPoints(), MeshCore::PlaneFit::Fit(), MeshCore::PlaneFit::GetNormal(), Base::Vector3< _Precision >::Normalize(), Base::Vector3< _Precision >::Set(), Base::Vector3< _Precision >::Sqr(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
Referenced by MeshGui::CylinderFitParameter::getParameter(), and ReverseEngineeringGui::SegmentationManual::on_cylinderDetect_clicked().
◆ GetRadius()
float CylinderFit::GetRadius | ( | ) | const |
◆ 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 | ( | ) |
Projects the points onto the fitted cylinder.
References Base::Vector3< _Precision >::DistanceToLine(), GetAxis(), GetBase(), Base::Vector3< _Precision >::Move(), and Base::Vector3< _Precision >::ProjectToPlane().
◆ SetInitialValues()
void CylinderFit::SetInitialValues | ( | const Base::Vector3f & | b, |
const Base::Vector3f & | n | ||
) |
The documentation for this class was generated from the following files:
- src/Mod/Mesh/App/Core/Approximation.h
- src/Mod/Mesh/App/Core/Approximation.cpp