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... | |
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... | |
Approximation of a cylinder into a given set of points.
CylinderFit::CylinderFit | ( | ) |
Construction.
|
virtual |
Destruction.
|
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().
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().
Base::Vector3f CylinderFit::GetBase | ( | ) | const |
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().
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().
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().
float CylinderFit::GetRadius | ( | ) | const |
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().
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().
void CylinderFit::SetInitialValues | ( | const Base::Vector3f & | b, |
const Base::Vector3f & | n | ||
) |