Approximation of a plane into a given set of points. More...
#include <Approximation.h>
Public Member Functions | |
void | Dimension (float &length, float &width) const |
Get the dimension of the fitted plane. More... | |
float | Fit () |
Fit a plane into the given points. More... | |
Base::Vector3f | GetBase () const |
Base::BoundBox3f | GetBoundings () const |
Returns the local bounding box of the transformed points relative to the coordinate system of the plane. More... | |
Base::Vector3f | GetDirU () const |
Base::Vector3f | GetDirV () const |
float | GetDistanceToPlane (const Base::Vector3f &rcPoint) const |
Returns the distance from the point rcPoint to the fitted plane. More... | |
std::vector< Base::Vector3f > | GetLocalPoints () const |
Returns an array of the transformed points relative to the coordinate system of the plane. More... | |
Base::Vector3f | GetNormal () const |
Returns the normal of the fitted plane. More... | |
float | GetSignedStdDeviation () const |
Returns the standard deviation from the points to the fitted plane with respect to the orientation of the plane's normal. More... | |
float | GetStdDeviation () const |
Returns the standard deviation from the points to the fitted plane. More... | |
PlaneFit () | |
Construction. More... | |
void | ProjectToPlane () |
Projects the points onto the fitted plane. More... | |
virtual | ~PlaneFit () |
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 plane into a given set of points.
PlaneFit::PlaneFit | ( | ) |
Construction.
|
virtual |
Destruction.
void PlaneFit::Dimension | ( | float & | length, |
float & | width | ||
) | const |
Get the dimension of the fitted plane.
References Base::BoundBox3< _Precision >::Add(), Base::BoundBox3< _Precision >::MaxX, Base::BoundBox3< _Precision >::MaxY, Base::BoundBox3< _Precision >::MinX, Base::BoundBox3< _Precision >::MinY, and Base::Vector3< _Precision >::TransformToCoordinateSystem().
|
virtual |
Fit a plane into the given points.
We must have at least three non-collinear points to succeed. If the fit fails FLOAT_MAX is returned.
Implements MeshCore::Approximation.
Reimplemented in MeshCore::SurfaceFit.
References MeshCore::Approximation::CountPoints().
Referenced by ReverseEngineeringGui::Segmentation::accept(), MeshCore::MeshPlaneVisitor::AllowVisit(), Reen::ParameterCorrection::CalcEigenvectors(), MeshCore::MeshEigensystem::CalculateLocalSystem(), MeshCore::PlaneSurfaceFit::Fit(), MeshCore::CylinderFit::GetInitialAxisFromNormals(), MeshCore::MeshRefPointToPoints::GetNormal(), MeshGui::PlaneFitParameter::getParameter(), MeshCore::AbstractPolygonTriangulator::GetTransformToFitPlane(), MeshCore::PlaneSurfaceFit::Initialize(), ReverseEngineeringGui::SegmentationManual::on_planeDetect_clicked(), MeshCore::SurfaceFit::PolynomFit(), MeshCore::PlaneFitSmoothing::Smooth(), MeshCore::PlaneFitSmoothing::SmoothPoints(), and MeshCore::MeshDistancePlanarSegment::TestFacet().
Base::Vector3f PlaneFit::GetBase | ( | ) | const |
Referenced by ReverseEngineeringGui::Segmentation::accept(), MeshCore::MeshEigensystem::CalculateLocalSystem(), MeshGui::PlaneFitParameter::getParameter(), MeshCore::AbstractPolygonTriangulator::GetTransformToFitPlane(), ReverseEngineeringGui::SegmentationManual::on_planeDetect_clicked(), and MeshCore::PlaneSurfaceFit::Parameters().
Base::BoundBox3f PlaneFit::GetBoundings | ( | ) | const |
Returns the local bounding box of the transformed points relative to the coordinate system of the plane.
If this method is called before the plane is computed an invalid bounding box is returned.
References Base::BoundBox3< _Precision >::Add(), and GetLocalPoints().
Base::Vector3f PlaneFit::GetDirU | ( | ) | const |
Base::Vector3f PlaneFit::GetDirV | ( | ) | const |
float PlaneFit::GetDistanceToPlane | ( | const Base::Vector3f & | rcPoint | ) | const |
Returns the distance from the point rcPoint to the fitted plane.
If Fit() has not been called FLOAT_MAX is returned.
Referenced by MeshCore::MeshPlaneVisitor::AllowVisit(), MeshCore::PlaneSurfaceFit::GetDistanceToSurface(), GetSignedStdDeviation(), GetStdDeviation(), and MeshCore::MeshDistancePlanarSegment::TestFacet().
std::vector< Base::Vector3f > PlaneFit::GetLocalPoints | ( | ) | const |
Returns an array of the transformed points relative to the coordinate system of the plane.
If this method is called before the plane is computed an empty array is returned.
References Base::Vector3< _Precision >::TransformToCoordinateSystem(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
Referenced by GetBoundings().
Base::Vector3f PlaneFit::GetNormal | ( | ) | const |
Returns the normal of the fitted plane.
If Fit() has not been called the null vector is returned.
Referenced by ReverseEngineeringGui::Segmentation::accept(), Reen::ParameterCorrection::CalcEigenvectors(), MeshCore::MeshEigensystem::CalculateLocalSystem(), MeshCore::FacetCurvature::Compute(), MeshCore::CylinderFit::GetInitialAxisFromNormals(), MeshCore::MeshRefPointToPoints::GetNormal(), MeshGui::PlaneFitParameter::getParameter(), GetSignedStdDeviation(), MeshCore::AbstractPolygonTriangulator::GetTransformToFitPlane(), ReverseEngineeringGui::SegmentationManual::on_planeDetect_clicked(), MeshCore::PlaneSurfaceFit::Parameters(), ProjectToPlane(), MeshCore::PlaneFitSmoothing::Smooth(), and MeshCore::PlaneFitSmoothing::SmoothPoints().
float PlaneFit::GetSignedStdDeviation | ( | ) | const |
Returns the standard deviation from the points to the fitted plane with respect to the orientation of the plane's normal.
If Fit() has not been called FLOAT_MAX is returned.
References MeshCore::Approximation::CountPoints(), GetDistanceToPlane(), and GetNormal().
float PlaneFit::GetStdDeviation | ( | ) | const |
Returns the standard deviation from the points to the fitted plane.
If Fit() has not been called FLOAT_MAX is returned.
References MeshCore::Approximation::CountPoints(), and GetDistanceToPlane().
void PlaneFit::ProjectToPlane | ( | ) |
Projects the points onto the fitted plane.
References MeshCore::Approximation::GetGravity(), and GetNormal().