The main class for the best_fit routine. More...
#include <best_fit.h>
Public Member Functions | |
double | ANN () |
Determines two corresponding point-sets for the ICP-Method using the Nearest-Neighbour-Algorithm. | |
best_fit () | |
bool | Coarse_correction () |
Check and corrects mesh-position by rotating around all coordinate-axes with 180 degree. | |
double | CompTotalError (MeshCore::MeshKernel &mesh) |
Computes error between mesh and the input-shape through intersection along the normal-directions and returns an average-error-value. | |
double | CompTotalError () |
Computes error between the input-shapes through intersection along the normal-directions and returns an average-error-value. | |
bool | Initialize_Mesh_Geometrie_1 () |
bool | Initialize_Mesh_Geometrie_2 () |
void | Load (const MeshCore::MeshKernel &InputMesh, const TopoDS_Shape &CAD_Shape) |
Load the input-shapes. Must be called before running the main program. | |
bool | MeshFit_Coarse () |
Determines the local-coordinate-systems of the input-shapes and apply a coordinate transformation to the mesh. | |
bool | output_best_fit_mesh () |
bool | Perform () |
Main function of the best-fit-algorithm. | |
bool | Perform_PointCloud () |
Main function of the best-fit-algorithm only on point clouds. | |
bool | PointCloud_Coarse () |
Determines the center of mass of the point-cloud and translates the shape to the global origin. | |
bool | ShapeFit_Coarse () |
Determines the center of mass of the input-shape and translates the shape to the global origin. | |
~best_fit () | |
Static Public Member Functions | |
static std::vector < Base::Vector3f > | Comp_Normals (MeshCore::MeshKernel &Mesh) |
Returns a normal-vector of Mesh at the knots with uniform weighting. | |
static bool | Tesselate_Face (const TopoDS_Face &aface, MeshCore::MeshKernel &mesh, float deflection) |
Computes a triangulation on aface. | |
static bool | Tesselate_Shape (const TopoDS_Shape &shape, MeshCore::MeshKernel &mesh, float deflection) |
Computes a triangulation on shape. | |
Public Attributes | |
TopoDS_Shape | m_Cad |
Input-shape from the function Load. | |
gp_Vec | m_cad2orig |
Translation-vector from the function ShapeFit_Coarse(). | |
MeshCore::MeshKernel | m_CadMesh |
Triangulated input-shape m_Cad. | |
std::vector< double > | m_error |
Stores the error-values of m_CadMesh in relative order. | |
std::vector< TopoDS_Face > | m_LowFaces |
Vector of the preselected-faces for the weighting. | |
std::vector< std::vector < Base::Vector3f > > | m_LSPnts |
Stores the point-sets computed with the function ANN(). | |
MeshCore::MeshKernel | m_Mesh |
Input-mesh from the function Load. | |
MeshCore::MeshKernel | m_MeshWork |
A copy of m_Mesh. | |
std::vector< Base::Vector3f > | m_normals |
Stores the normals of m_CadMesh in relative order. | |
std::vector< Base::Vector3f > | m_pntCloud_1 |
std::vector< Base::Vector3f > | m_pntCloud_2 |
std::vector< Base::Vector3f > | m_pnts |
Stores the knots of m_CadMesh in relative order. | |
std::vector< double > | m_weights |
Stores the weights computed with the function Comp_Weights(). | |
std::vector< double > | m_weights_loc |
A working-copy of m_weights. |
The main class for the best_fit routine.
It takes a mesh and a Topo_Shape as it's input parameter.
As output, it gives a transformed mesh (rotation + translation) based on a weighted ICP-Algorithm (ICP: Iterative Closed Point) wich fits the Topo_Shape
Definition at line 53 of file best_fit.h.
best_fit::best_fit | ( | ) |
Definition at line 65 of file best_fit.cpp.
References m_LSPnts.
best_fit::~best_fit | ( | ) |
Definition at line 70 of file best_fit.cpp.
double best_fit::ANN | ( | ) |
Determines two corresponding point-sets for the ICP-Method using the Nearest-Neighbour-Algorithm.
Definition at line 83 of file best_fit.cpp.
References Base::Builder3D::addSingleLine(), annAllocPt(), annAllocPts(), annClose(), ANNkd_tree::annkSearch(), draftlibs::dxfReader::error(), Py::int, m_LSPnts, m_pntCloud_1, m_pntCloud_2, m_weights, m_weights_loc, and Base::Builder3D::saveToFile().
Referenced by Coarse_correction(), and Perform().
bool best_fit::Coarse_correction | ( | ) |
Check and corrects mesh-position by rotating around all coordinate-axes with 180 degree.
Definition at line 396 of file best_fit.cpp.
References ANN(), draftlibs::dxfReader::error(), m_MeshWork, m_pntCloud_2, Base::Matrix4D::setToUnity(), and MeshCore::MeshKernel::Transform().
Referenced by Perform(), and Perform_PointCloud().
std::vector< Base::Vector3f > best_fit::Comp_Normals | ( | MeshCore::MeshKernel & | Mesh | ) | [static] |
Returns a normal-vector of Mesh at the knots with uniform weighting.
Mesh | Input-Mesh |
Definition at line 1500 of file best_fit.cpp.
References Base::Builder3D::addSingleArrow(), MeshCore::MeshGeomFacet::Area(), MeshCore::MeshKernel::CountPoints(), MeshCore::MeshKernel::GetFacet(), MeshCore::MeshGeomFacet::GetNormal(), MeshCore::MeshKernel::GetPoint(), Base::Vector3< _Precision >::Normalize(), Base::Builder3D::saveToFile(), Base::Vector3< _Precision >::Set(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
Referenced by UniGridApprox::CompMeshError(), and UniGridApprox::MeshOffset().
double best_fit::CompTotalError | ( | MeshCore::MeshKernel & | mesh | ) |
Computes error between mesh and the input-shape through intersection along the normal-directions and returns an average-error-value.
Definition at line 1879 of file best_fit.cpp.
References MeshCore::MeshPointIterator::Begin(), MeshCore::MeshKernel::CountPoints(), draftlibs::dxfReader::error(), MeshCore::MeshKernel::GetPoints(), m_CadMesh, m_error, m_normals, MeshCore::MeshPointIterator::More(), MeshCore::MeshAlgorithm::NearestFacetOnRay(), MeshCore::MeshPointIterator::Next(), KDL::sqrt(), and Base::Vector3< _Precision >::z.
double best_fit::CompTotalError | ( | ) |
Computes error between the input-shapes through intersection along the normal-directions and returns an average-error-value.
Definition at line 1718 of file best_fit.cpp.
References Base::Builder3D::addSingleArrow(), MeshCore::MeshPointIterator::Begin(), MeshCore::MeshKernel::CountPoints(), MeshCore::MeshKernel::GetPoints(), m_CadMesh, m_error, m_LSPnts, m_Mesh, m_normals, MeshCore::MeshPointIterator::More(), MeshCore::MeshAlgorithm::NearestFacetOnRay(), MeshCore::MeshPointIterator::Next(), Base::Builder3D::saveToFile(), KDL::sqrt(), and Base::Vector3< _Precision >::z.
Referenced by SpringbackCorrection::Perform(), Perform(), and Perform_PointCloud().
bool best_fit::Initialize_Mesh_Geometrie_1 | ( | ) |
Definition at line 946 of file best_fit.cpp.
References m_pntCloud_1, and Base::Vector3< _Precision >::Set().
Referenced by CamGui::Cutting::on_BestFitButton_clicked().
bool best_fit::Initialize_Mesh_Geometrie_2 | ( | ) |
Definition at line 970 of file best_fit.cpp.
References m_pntCloud_2, and Base::Vector3< _Precision >::Set().
Referenced by CamGui::Cutting::on_BestFitButton_clicked().
void best_fit::Load | ( | const MeshCore::MeshKernel & | InputMesh, | |
const TopoDS_Shape & | CAD_Shape | |||
) |
Load the input-shapes. Must be called before running the main program.
InputMesh | Input-mesh | |
CAD_Shape | Input-shape |
Definition at line 74 of file best_fit.cpp.
References m_Cad, m_Mesh, and m_MeshWork.
Referenced by CamGui::Cutting::on_best_fit_go_button_clicked().
bool best_fit::MeshFit_Coarse | ( | ) |
Determines the local-coordinate-systems of the input-shapes and apply a coordinate transformation to the mesh.
Definition at line 1214 of file best_fit.cpp.
References Base::Builder3D::addSingleArrow(), Base::Builder3D::addSinglePoint(), MeshCore::MeshEigensystem::Evaluate(), Base::Matrix4D::inverse(), m_CadMesh, m_MeshWork, Base::Builder3D::saveToFile(), MeshCore::MeshKernel::Transform(), MeshCore::MeshEigensystem::Transform(), draftlibs::fcgeo::v1(), draftlibs::fcgeo::vec(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, MovieTool::y, and Base::Vector3< _Precision >::z.
Referenced by Perform().
bool best_fit::output_best_fit_mesh | ( | ) |
Definition at line 931 of file best_fit.cpp.
References m_pntCloud_2, and MovieTool::y.
Referenced by CamGui::Cutting::on_BestFitButton_clicked().
bool best_fit::Perform | ( | ) |
Main function of the best-fit-algorithm.
Definition at line 167 of file best_fit.cpp.
References ANN(), Coarse_correction(), CompTotalError(), MeshCore::MeshKernel::GetPoints(), m_Cad, m_cad2orig, m_CadMesh, m_Mesh, m_MeshWork, m_pntCloud_1, m_pntCloud_2, MeshFit_Coarse(), Base::Matrix4D::setToUnity(), ShapeFit_Coarse(), Tesselate_Shape(), and MeshCore::MeshKernel::Transform().
Referenced by CamGui::Cutting::on_best_fit_go_button_clicked().
bool best_fit::Perform_PointCloud | ( | ) |
Main function of the best-fit-algorithm only on point clouds.
Definition at line 264 of file best_fit.cpp.
References Coarse_correction(), CompTotalError(), m_cad2orig, m_CadMesh, m_Mesh, m_MeshWork, m_pntCloud_1, m_pntCloud_2, m_weights, PointCloud_Coarse(), Base::Matrix4D::setToUnity(), and MeshCore::MeshKernel::Transform().
Referenced by CamGui::Cutting::on_BestFitButton_clicked().
bool best_fit::PointCloud_Coarse | ( | ) |
Determines the center of mass of the point-cloud and translates the shape to the global origin.
Definition at line 1050 of file best_fit.cpp.
References MeshCore::Approximation::AddPoints(), Base::Builder3D::addSingleArrow(), Base::Builder3D::addSinglePoint(), MeshCore::Approximation::Clear(), MeshCore::PlaneFit::Fit(), MeshCore::PlaneFit::GetDirU(), MeshCore::PlaneFit::GetDirV(), MeshCore::Approximation::GetGravity(), MeshCore::PlaneFit::GetNormal(), Base::Matrix4D::inverse(), m_cad2orig, m_pntCloud_1, m_pntCloud_2, Base::Builder3D::saveToFile(), draftlibs::fcgeo::v1(), draftlibs::fcgeo::vec(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, MovieTool::y, and Base::Vector3< _Precision >::z.
Referenced by Perform_PointCloud().
bool best_fit::ShapeFit_Coarse | ( | ) |
Determines the center of mass of the input-shape and translates the shape to the global origin.
Definition at line 1311 of file best_fit.cpp.
References m_Cad, and m_cad2orig.
Referenced by Perform().
bool best_fit::Tesselate_Face | ( | const TopoDS_Face & | aface, | |
MeshCore::MeshKernel & | mesh, | |||
float | deflection | |||
) | [static] |
Computes a triangulation on aface.
aface | specifies the face to be tesselated | |
mesh | output-mesh to store the computed triangulation | |
deflection | parameter wich determines the accuracy of the triangulation |
Definition at line 1335 of file best_fit.cpp.
References MeshCore::MeshBuilder::AddFacet(), MeshCore::MeshBuilder::Finish(), MeshCore::MeshBuilder::Initialize(), and Base::Vector3< _Precision >::Set().
Referenced by UniGridApprox::CompMeshError().
bool best_fit::Tesselate_Shape | ( | const TopoDS_Shape & | shape, | |
MeshCore::MeshKernel & | mesh, | |||
float | deflection | |||
) | [static] |
Computes a triangulation on shape.
shape | specifies the shape to be tesselated | |
mesh | output-mesh to store the computed triangulation | |
deflection | parameter wich determines the accuracy of the triangulation |
Definition at line 1402 of file best_fit.cpp.
References MeshCore::MeshDefinitions::_fMinPointDistanceD1, MeshCore::MeshBuilder::AddFacet(), MeshCore::MeshBuilder::Finish(), MeshCore::MeshBuilder::Initialize(), and Base::Vector3< _Precision >::Set().
Referenced by Deviation::Compute(), SpringbackCorrection::Init(), SpringbackCorrection::Load(), Perform(), SpringbackCorrection::SpringbackCorrection(), and tess_shape().
TopoDS_Shape best_fit::m_Cad |
Input-shape from the function Load.
Definition at line 145 of file best_fit.h.
Referenced by Load(), Perform(), and ShapeFit_Coarse().
gp_Vec best_fit::m_cad2orig |
Translation-vector from the function ShapeFit_Coarse().
Definition at line 180 of file best_fit.h.
Referenced by Perform(), Perform_PointCloud(), PointCloud_Coarse(), and ShapeFit_Coarse().
Triangulated input-shape m_Cad.
Definition at line 154 of file best_fit.h.
Referenced by CompTotalError(), MeshFit_Coarse(), CamGui::Cutting::on_best_fit_go_button_clicked(), SpringbackCorrection::Perform(), Perform(), and Perform_PointCloud().
std::vector<double> best_fit::m_error |
Stores the error-values of m_CadMesh in relative order.
Definition at line 168 of file best_fit.h.
Referenced by CompTotalError(), and SpringbackCorrection::Perform().
std::vector<TopoDS_Face> best_fit::m_LowFaces |
Vector of the preselected-faces for the weighting.
Definition at line 183 of file best_fit.h.
Referenced by CamGui::Cutting::setFace().
std::vector<std::vector<Base::Vector3f> > best_fit::m_LSPnts |
Stores the point-sets computed with the function ANN().
Definition at line 171 of file best_fit.h.
Referenced by ANN(), best_fit(), and CompTotalError().
Input-mesh from the function Load.
Definition at line 148 of file best_fit.h.
Referenced by CompTotalError(), Load(), Perform(), and Perform_PointCloud().
A copy of m_Mesh.
Definition at line 151 of file best_fit.h.
Referenced by Coarse_correction(), Load(), MeshFit_Coarse(), CamGui::Cutting::on_best_fit_go_button_clicked(), Perform(), and Perform_PointCloud().
std::vector<Base::Vector3f> best_fit::m_normals |
Stores the normals of m_CadMesh in relative order.
Definition at line 165 of file best_fit.h.
Referenced by CompTotalError(), and SpringbackCorrection::Perform().
std::vector<Base::Vector3f> best_fit::m_pntCloud_1 |
Definition at line 157 of file best_fit.h.
Referenced by ANN(), Initialize_Mesh_Geometrie_1(), Perform(), Perform_PointCloud(), and PointCloud_Coarse().
std::vector<Base::Vector3f> best_fit::m_pntCloud_2 |
Definition at line 158 of file best_fit.h.
Referenced by ANN(), Coarse_correction(), Initialize_Mesh_Geometrie_2(), output_best_fit_mesh(), Perform(), Perform_PointCloud(), and PointCloud_Coarse().
std::vector<Base::Vector3f> best_fit::m_pnts |
Stores the knots of m_CadMesh in relative order.
Definition at line 162 of file best_fit.h.
std::vector<double> best_fit::m_weights |
Stores the weights computed with the function Comp_Weights().
Definition at line 174 of file best_fit.h.
Referenced by ANN(), and Perform_PointCloud().
std::vector<double> best_fit::m_weights_loc |