Approximation of a sphere into a given set of points. More...
#include <Approximation.h>
Public Member Functions | |
float | Fit () |
Fit a sphere into the given points. More... | |
Base::Vector3f | GetCenter () const |
float | GetDistanceToSphere (const Base::Vector3f &rcPoint) const |
Returns the distance from the point rcPoint to the fitted sphere. More... | |
float | GetRadius () const |
float | GetStdDeviation () const |
Returns the standard deviation from the points to the fitted sphere. More... | |
void | ProjectToSphere () |
Projects the points onto the fitted sphere. More... | |
SphereFit () | |
Construction. More... | |
virtual | ~SphereFit () |
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 sphere into a given set of points.
SphereFit::SphereFit | ( | ) |
Construction.
|
virtual |
Destruction.
|
virtual |
Fit a sphere into the given points.
If the fit fails FLOAT_MAX is returned.
Implements MeshCore::Approximation.
References MeshCore::Approximation::AddPoints(), MeshCoreFit::SphereFit::ComputeApproximations(), Base::Console(), MeshCore::Approximation::CountPoints(), MeshCoreFit::SphereFit::Fit(), MeshCoreFit::SphereFit::GetCenter(), MeshCoreFit::SphereFit::GetNumIterations(), MeshCoreFit::SphereFit::GetRadius(), GetStdDeviation(), MeshCoreFit::SphereFit::GetStdDeviation(), and Base::ConsoleSingleton::Message().
Referenced by MeshCore::SphereSurfaceFit::Fit(), MeshGui::SphereFitParameter::getParameter(), and ReverseEngineeringGui::SegmentationManual::on_sphereDetect_clicked().
Base::Vector3f SphereFit::GetCenter | ( | ) | const |
float SphereFit::GetDistanceToSphere | ( | const Base::Vector3f & | rcPoint | ) | const |
Returns the distance from the point rcPoint to the fitted sphere.
If Fit() has not been called FLOAT_MAX is returned.
References Base::Vector3< _Precision >::Length().
Referenced by GetStdDeviation().
float SphereFit::GetRadius | ( | ) | const |
float SphereFit::GetStdDeviation | ( | ) | const |
Returns the standard deviation from the points to the fitted sphere.
If Fit() has not been called FLOAT_MAX is returned.
References MeshCore::Approximation::CountPoints(), and GetDistanceToSphere().
Referenced by Fit().
void SphereFit::ProjectToSphere | ( | ) |
Projects the points onto the fitted sphere.
References Base::Vector3< _Precision >::z.