best_fit Class Reference

The main class for the best_fit routine. More...

#include <best_fit.h>

List of all members.

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::Vector3fm_normals
 Stores the normals of m_CadMesh in relative order.
std::vector< Base::Vector3fm_pntCloud_1
std::vector< Base::Vector3fm_pntCloud_2
std::vector< Base::Vector3fm_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.

Detailed Description

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.


Constructor & Destructor Documentation

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.


Member Function Documentation

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]
double best_fit::CompTotalError ( MeshCore::MeshKernel mesh  ) 
double best_fit::CompTotalError (  ) 
bool best_fit::Initialize_Mesh_Geometrie_1 (  ) 
bool best_fit::Initialize_Mesh_Geometrie_2 (  ) 
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.

Parameters:
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 (  ) 
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 (  ) 
bool best_fit::Perform_PointCloud (  ) 
bool best_fit::PointCloud_Coarse (  ) 
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.

Parameters:
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.

Parameters:
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().


Member Data Documentation

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().

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().

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().

Stores the normals of m_CadMesh in relative order.

Definition at line 165 of file best_fit.h.

Referenced by CompTotalError(), and SpringbackCorrection::Perform().

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

A working-copy of m_weights.

Definition at line 177 of file best_fit.h.

Referenced by ANN().


The documentation for this class was generated from the following files:

Generated on Wed Nov 23 19:01:31 2011 for FreeCAD by  doxygen 1.6.1