Cam: translate doxygen from DE/FR to EN
For the purpose of making the source documentation uniform, source comments in this file were translated to english.
This commit is contained in:
@@ -167,7 +167,7 @@ static PyObject * tesselateShape(PyObject *self, PyObject *args)
|
||||
if (!PyArg_ParseTuple(args, "O!f", &(TopoShapePy::Type), &pcObj, &aDeflection)) // convert args: Python->C
|
||||
return NULL; // NULL triggers exception
|
||||
|
||||
TopoShapePy *pcShape = static_cast<TopoShapePy*>(pcObj); //Surface oder Step-File wird übergeben
|
||||
TopoShapePy *pcShape = static_cast<TopoShapePy*>(pcObj); //Surface or step file is passed
|
||||
|
||||
|
||||
Base::Builder3D aBuild;
|
||||
@@ -251,7 +251,7 @@ static PyObject * best_fit_coarse(PyObject *self, PyObject *args)
|
||||
PY_TRY
|
||||
{
|
||||
|
||||
TopoShapePy *pcShape = static_cast<TopoShapePy*>(pcObj2); //Shape wird übergeben
|
||||
TopoShapePy *pcShape = static_cast<TopoShapePy*>(pcObj2); //Shape is passed
|
||||
TopoDS_Shape cad = pcShape->getTopoShapePtr()->_Shape; // Input CAD
|
||||
|
||||
|
||||
@@ -287,7 +287,7 @@ static PyObject * best_fit_coarse(PyObject *self, PyObject *args)
|
||||
// if (!PyArg_ParseTuple(args, "O!", &(TopoShapePyOld::Type), &pcObj)) // convert args: Python->C
|
||||
// return NULL; // NULL triggers exception
|
||||
//
|
||||
// TopoShapePyOld *pcShape = static_cast<TopoShapePyOld*>(pcObj); //Surface wird übergeben
|
||||
// TopoShapePyOld *pcShape = static_cast<TopoShapePyOld*>(pcObj); //Surface is passed
|
||||
//// TopoShapePyOld *pcShape2 = static_cast<TopoShapePyOld*>(pcObj2); //Cut-Curve
|
||||
// PY_TRY
|
||||
// {
|
||||
@@ -365,7 +365,7 @@ static PyObject * offset(PyObject *self,PyObject *args)
|
||||
if (!PyArg_ParseTuple(args, "O!d",&(TopoShapePy::Type), &pcObj,&offset ))
|
||||
return NULL;
|
||||
|
||||
TopoShapePy *pcShape = static_cast<TopoShapePy*>(pcObj); //Original-Shape wird hier übergeben
|
||||
TopoShapePy *pcShape = static_cast<TopoShapePy*>(pcObj); //Original shape is passed here
|
||||
|
||||
PY_TRY
|
||||
{
|
||||
@@ -385,7 +385,7 @@ static PyObject * cut(PyObject *self, PyObject *args)
|
||||
{
|
||||
PyObject *pcObj;
|
||||
double z_pitch;
|
||||
//double rGap = 1000.0; //Rand um die Bounding Box für ein sauberes Ergebnis
|
||||
//double rGap = 1000.0; //Border around the bounding box for a clean result
|
||||
if (!PyArg_ParseTuple(args, "O!d", &(TopoShapePyOld::Type), &pcObj,&z_pitch)) // convert args: Python->C
|
||||
return NULL; // NULL triggers exception
|
||||
|
||||
@@ -403,12 +403,12 @@ static PyObject * cut(PyObject *self, PyObject *args)
|
||||
Base::Builder3D logit;
|
||||
|
||||
|
||||
Jetzt die eigentlichen Schnitte erzeugen:
|
||||
1. Wenn die oberste Ebene ein flacher Bereich ist, werden von dort die Bounding Wires genommen
|
||||
Ermittlung über die Bounding Box
|
||||
2. Anschließend über die Differenz von zwei Flat-Bereichen die Anzahl von Schnitten ermitteln mit gegebenem Abstand
|
||||
3. Die Edges bzw. Wires in B-Spline Kurven wandeln und anschließend evaluieren
|
||||
4. Abfahrreihenfolge festlegen und Output für die Simulation bzw. Versuch vorbereiten
|
||||
Now create the actual cuts:
|
||||
1. If the top level is a flat area, the bounding wires will be taken from there
|
||||
Determination by means of the bounding box
|
||||
2. Then use the difference between two flat areas to determine the number of cuts with the given distance
|
||||
3. Convert the edges or wires into B-spline curves and then evaluate them
|
||||
4. Determine the sequence of operations and prepare the output for the simulation or experiment
|
||||
|
||||
|
||||
|
||||
@@ -3117,7 +3117,7 @@ static PyObject * useMesh(PyObject *self, PyObject *args)
|
||||
{
|
||||
MeshPy *pcObject;
|
||||
PyObject *pcObj;
|
||||
if (!PyArg_ParseTuple(args, "O!; Need exatly one Mesh object", &(MeshPy::Type), &pcObj)) // convert args: Python->C
|
||||
if (!PyArg_ParseTuple(args, "O!; Need exactly one Mesh object", &(MeshPy::Type), &pcObj)) // convert args: Python->C
|
||||
return NULL; // NULL triggers exception
|
||||
|
||||
pcObject = (MeshPy*)pcObj;
|
||||
@@ -3166,7 +3166,7 @@ static PyObject * useMesh(PyObject *self, PyObject *args)
|
||||
++It;
|
||||
}
|
||||
|
||||
// most of the algoristhms are under src/Mod/Mesh/App/Core!
|
||||
// most of the algorithms are under src/Mod/Mesh/App/Core!
|
||||
|
||||
} PY_CATCH;
|
||||
|
||||
@@ -3295,7 +3295,7 @@ static PyObject * offset_mesh(PyObject *self, PyObject *args)
|
||||
|
||||
MeshPy *pcObject;
|
||||
PyObject *pcObj;
|
||||
if (!PyArg_ParseTuple(args, "O!d; Need exatly one Mesh object", &(MeshPy::Type), &pcObj, &offset)) // convert args: Python->C
|
||||
if (!PyArg_ParseTuple(args, "O!d; Need exactly one Mesh object", &(MeshPy::Type), &pcObj, &offset)) // convert args: Python->C
|
||||
return NULL; // NULL triggers exception
|
||||
|
||||
pcObject = (MeshPy*)pcObj;
|
||||
@@ -3328,18 +3328,19 @@ static PyObject * offset_mesh(PyObject *self, PyObject *args)
|
||||
|
||||
for (unsigned long i=0; i<mesh.CountPoints(); i++)
|
||||
{
|
||||
// Satz von Dreiecken zu jedem Punkt
|
||||
// Set of triangles at each point
|
||||
const std::set<unsigned long>& faceSet = rf2pt[i];
|
||||
float fArea = 0.0;
|
||||
normal.Set(0.0,0.0,0.0);
|
||||
|
||||
|
||||
// Iteriere über die Dreiecke zu jedem Punkt
|
||||
// Iterate over the triangles to each point
|
||||
for (std::set<unsigned long>::const_iterator it = faceSet.begin(); it != faceSet.end(); ++it)
|
||||
{
|
||||
// Einmal derefernzieren, um an das MeshFacet zu kommen und dem Kernel uebergeben, dass er ein MeshGeomFacet liefert
|
||||
// Dereferencing once it gets to the MeshFacet
|
||||
// and handing over to the kernel so that it delivers a MeshGeomFacet
|
||||
t_face = mesh.GetFacet(*it);
|
||||
// Flaecheninhalt aufsummieren
|
||||
// Sum up the area content
|
||||
float local_Area = t_face.Area();
|
||||
local_normal = t_face.GetNormal();
|
||||
if (local_normal.z < 0)
|
||||
@@ -3370,16 +3371,16 @@ static PyObject * offset_mesh(PyObject *self, PyObject *args)
|
||||
|
||||
/*for(p_it.Begin();!(p_it.EndReached()); ++p_it)
|
||||
{
|
||||
cout << "Erste Schleife" <<endl;
|
||||
cout << "First loop" <<endl;
|
||||
for(f_it.Begin(); !(f_it.EndReached()); ++f_it)
|
||||
{
|
||||
cout << "Zweite Schleife" <<endl;
|
||||
cout << "Second loop" <<endl;
|
||||
int pos = f_it.Position();
|
||||
t_face = mesh.GetFacet(f_it.Position());
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
cout << "dritte Schleife" <<endl;
|
||||
cout << "Third loop" <<endl;
|
||||
if(*p_it == t_face._aclPoints[i])
|
||||
{
|
||||
a += t_face.Area();
|
||||
@@ -3398,14 +3399,14 @@ static PyObject * offset_mesh(PyObject *self, PyObject *args)
|
||||
//{
|
||||
// PyObject *pcObj;
|
||||
//
|
||||
// if (!PyArg_ParseTuple(args, "O!; Need exatly one CAD object",&(TopoShapePyOld::Type), &pcObj)) // convert args: Python->C
|
||||
// if (!PyArg_ParseTuple(args, "O!; Need exactly one CAD object",&(TopoShapePyOld::Type), &pcObj)) // convert args: Python->C
|
||||
// return NULL; // NULL triggers exception
|
||||
//
|
||||
//
|
||||
// TopoShapePyOld *pcShape = static_cast<TopoShapePyOld*>(pcObj); //Surface wird übergeben
|
||||
// TopoShapePyOld *pcShape = static_cast<TopoShapePyOld*>(pcObj); //Surface is passed
|
||||
//
|
||||
// TopExp_Explorer Ex;
|
||||
// Ex.Init(pcShape->getShape(),TopAbs_FACE); // initialisiere cad-geometrie (trimmed surface)
|
||||
// Ex.Init(pcShape->getShape(),TopAbs_FACE); // initialize cad geometry (trimmed surface)
|
||||
//
|
||||
// Base::Builder3D m_log3d;
|
||||
//
|
||||
@@ -3445,7 +3446,7 @@ static PyObject * offset_mesh(PyObject *self, PyObject *args)
|
||||
//
|
||||
// for (;Ex.More();Ex.Next())
|
||||
// {
|
||||
// // übergebe die einzelnen patches
|
||||
// // pass the single patches
|
||||
// atopo_surface = TopoDS::Face (Ex.Current());
|
||||
// adaptor_surface.Initialize(atopo_surface);
|
||||
//
|
||||
@@ -3649,7 +3650,7 @@ static PyObject * best_fit_complete(PyObject *self, PyObject *args)
|
||||
gp_Pnt orig;
|
||||
|
||||
pcObject = (MeshPy*)pcObj;
|
||||
TopoShapePy *pcShape = static_cast<TopoShapePy*>(pcObj2); //Shape wird übergeben
|
||||
TopoShapePy *pcShape = static_cast<TopoShapePy*>(pcObj2); //Shape is passed
|
||||
TopoDS_Shape cad = pcShape->getTopoShapePtr()->_Shape; // Input CAD
|
||||
MeshCore::MeshKernel mesh = pcObject->getMeshObjectPtr()->getKernel(); // Input Mesh
|
||||
|
||||
@@ -3682,7 +3683,7 @@ static PyObject * best_fit_test(PyObject *self, PyObject *args)
|
||||
PY_TRY
|
||||
{
|
||||
|
||||
TopoShapePy *pcShape = static_cast<TopoShapePy*>(pcObj); //Shape wird übergeben
|
||||
TopoShapePy *pcShape = static_cast<TopoShapePy*>(pcObj); //Shape is passed
|
||||
TopoDS_Shape aShape = pcShape->getTopoShapePtr()->_Shape;
|
||||
TopExp_Explorer anExplorer;
|
||||
TopExp_Explorer aFaceExplorer;
|
||||
@@ -3719,7 +3720,7 @@ static PyObject * best_fit_test(PyObject *self, PyObject *args)
|
||||
}
|
||||
firstrun=false;
|
||||
}
|
||||
//Uniformes Grid erzeugen und verschieben
|
||||
//Create and move a uniform grid
|
||||
BRepAdaptor_Surface afirstFaceAdaptor(first);
|
||||
|
||||
BRepAdaptor_Surface asecondFaceAdaptor(second);
|
||||
@@ -3755,7 +3756,7 @@ static PyObject * best_fit_test(PyObject *self, PyObject *args)
|
||||
}
|
||||
GeomAPI_PointsToBSplineSurface *Approx_Surface = new GeomAPI_PointsToBSplineSurface(Input, 3, 8, GeomAbs_C1,0.1);
|
||||
Handle(Geom_BSplineSurface) Final_Approx = Approx_Surface->Surface () ;
|
||||
//Jetzt die Wires vom ursprünglichen Face offsettieren.
|
||||
//Now offset the wires from the original face.
|
||||
TopExp_Explorer asecondFaceExplorer;
|
||||
TopoDS_Wire aFaceWire;
|
||||
for (asecondFaceExplorer.Init(first,TopAbs_WIRE);asecondFaceExplorer.More();asecondFaceExplorer.Next())
|
||||
@@ -3763,7 +3764,7 @@ static PyObject * best_fit_test(PyObject *self, PyObject *args)
|
||||
aFaceWire = TopoDS::Wire(asecondFaceExplorer.Current());
|
||||
}
|
||||
WireExplorer awireexplorer(aFaceWire);
|
||||
//Punkte auf der Wire erzeugen und dann diese Punkte als Input in den Delaynay reinschieben
|
||||
//Create points on the wire and then insert these points into the delay as inputs
|
||||
BRepAdaptor_CompCurve2 aWireAdapter(aFaceWire);
|
||||
Standard_Real first_p,last_p,delta_u;
|
||||
last_p = aWireAdapter.LastParameter();
|
||||
@@ -3860,7 +3861,7 @@ static PyObject * shape2orig(PyObject *self, PyObject *args)
|
||||
GProp_PrincipalProps pprop;
|
||||
gp_Pnt orig;
|
||||
|
||||
TopoShapePy *pcShape = static_cast<TopoShapePy*>(pcObj); //shape wird übergeben
|
||||
TopoShapePy *pcShape = static_cast<TopoShapePy*>(pcObj); //shape is passed
|
||||
TopoDS_Shape cad = pcShape->getTopoShapePtr()->_Shape; // Input CAD
|
||||
|
||||
// best_fit befi(cad);
|
||||
@@ -3892,8 +3893,8 @@ static PyObject * spring_back(PyObject *self, PyObject *args)
|
||||
gp_Pnt orig;
|
||||
|
||||
pcObject = (MeshPy*)pcObj;
|
||||
TopoShapePy *pcShape = static_cast<TopoShapePy*>(pcObj2); //Shape wird übergeben
|
||||
TopoDS_Shape cad = pcShape->getTopoShapePtr()->_Shape; // Input CAD
|
||||
TopoShapePy *pcShape = static_cast<TopoShapePy*>(pcObj2); //Shape is passed
|
||||
TopoDS_Shape cad = pcShape->getTopoShapePtr()->_Shape; // Input CAD
|
||||
MeshObject* anObject = pcObject->getMeshObjectPtr(); // Input Mesh
|
||||
MeshCore::MeshKernel mesh = anObject->getKernel();
|
||||
|
||||
@@ -3934,7 +3935,7 @@ static PyObject * tess_shape(PyObject *self, PyObject *args)
|
||||
PY_TRY
|
||||
{
|
||||
|
||||
TopoShapePy *pcShape = static_cast<TopoShapePy*>(pcObj); //shape wird übergeben
|
||||
TopoShapePy *pcShape = static_cast<TopoShapePy*>(pcObj); //shape is passed
|
||||
TopoDS_Shape cad = pcShape->getTopoShapePtr()->_Shape; // Input CAD
|
||||
|
||||
//best_fit befi(cad);
|
||||
@@ -4030,14 +4031,14 @@ static PyObject * fit_iter(PyObject *self, PyObject *args)
|
||||
PyObject *pcObj;
|
||||
PyObject *pcObj2;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "O!O!; Need exatly one Mesh object", &(MeshPy::Type), &pcObj, &(TopoShapePy::Type), &pcObj2)) // convert args: Python->C
|
||||
if (!PyArg_ParseTuple(args, "O!O!; Need exactly one Mesh object", &(MeshPy::Type), &pcObj, &(TopoShapePy::Type), &pcObj2)) // convert args: Python->C
|
||||
return NULL; // NULL triggers exception
|
||||
|
||||
TopoShapePy *pcShape = static_cast<TopoShapePy*>(pcObj2); //Surface wird übergeben
|
||||
TopoShapePy *pcShape = static_cast<TopoShapePy*>(pcObj2); //Surface is passed
|
||||
TopoDS_Shape cad = pcShape->getTopoShapePtr()->_Shape;
|
||||
|
||||
TopExp_Explorer Ex;
|
||||
Ex.Init(cad,TopAbs_FACE); // initialisiere cad-geometrie (trimmed surface)
|
||||
Ex.Init(cad,TopAbs_FACE); // initialize cad geometry (trimmed surface)
|
||||
|
||||
pcObject = (MeshPy*)pcObj;
|
||||
|
||||
@@ -4048,7 +4049,7 @@ static PyObject * fit_iter(PyObject *self, PyObject *args)
|
||||
Base::Vector3f tmp_pnt;
|
||||
IntCurvesFace_ShapeIntersector shp_int;
|
||||
|
||||
std::vector< std::vector<double> > R(3, std::vector<double>(3,0.0)); // Rotationsmatrix
|
||||
std::vector< std::vector<double> > R(3, std::vector<double>(3,0.0)); // Rotation matrix
|
||||
double err = 1001;
|
||||
|
||||
TopoDS_Face atopo_surface;
|
||||
@@ -4084,18 +4085,18 @@ static PyObject * fit_iter(PyObject *self, PyObject *args)
|
||||
err = 0.0;
|
||||
for (unsigned long i=0; i<mesh.CountPoints(); i++)
|
||||
{
|
||||
// Satz von Dreiecken zu jedem Punkt
|
||||
// Set of triangles at each point
|
||||
const std::set<unsigned long>& faceSet = rf2pt[i];
|
||||
float fArea = 0.0;
|
||||
normal.Set(0.0,0.0,0.0);
|
||||
|
||||
|
||||
// Iteriere über die Dreiecke zu jedem Punkt
|
||||
// Iterate over the triangles to each point
|
||||
for (std::set<unsigned long>::const_iterator it = faceSet.begin(); it != faceSet.end(); ++it)
|
||||
{
|
||||
// Einmal derefernzieren, um an das MeshFacet zu kommen und dem Kernel uebergeben, dass er ein MeshGeomFacet liefert
|
||||
// Dereference once to get to the MeshFacet and to hand over to the kernel that it delivers a MeshGeomFacet
|
||||
t_face = mesh.GetFacet(*it);
|
||||
// Flaecheninhalt aufsummieren
|
||||
// Sum up the area content
|
||||
float local_Area = t_face.Area();
|
||||
local_normal = t_face.GetNormal();
|
||||
if (local_normal.z < 0)
|
||||
|
||||
@@ -97,8 +97,7 @@ BRepAdaptor_CompCurve2::BRepAdaptor_CompCurve2(const TopoDS_Wire& W,
|
||||
}
|
||||
}
|
||||
|
||||
Forward = Standard_True; // Defaut ; Les Edge Reverse seront parcourue
|
||||
// a rebourt.
|
||||
Forward = Standard_True; // Default; Led Edge Reverse will be counted backward.
|
||||
if((NbEdge > 2) || ((NbEdge==2) && (!myWire.Closed())) ) {
|
||||
TopAbs_Orientation Or = myCurves->Value(1).Edge().Orientation();
|
||||
Standard_Boolean B;
|
||||
@@ -107,11 +106,11 @@ BRepAdaptor_CompCurve2::BRepAdaptor_CompCurve2(const TopoDS_Wire& W,
|
||||
myCurves->Value(2).Edge(),
|
||||
VI);
|
||||
VL = TopExp::LastVertex(myCurves->Value(1).Edge());
|
||||
if (VI.IsSame(VL)) { // On Garde toujours le sens de parcout
|
||||
if (VI.IsSame(VL)) { // We always keep the direction of the path
|
||||
if (Or == TopAbs_REVERSED)
|
||||
Forward = Standard_False;
|
||||
}
|
||||
else {// On renverse toujours le sens de parcout
|
||||
else {// We always reverse the direction of path
|
||||
if (Or != TopAbs_REVERSED)
|
||||
Forward = Standard_False;
|
||||
}
|
||||
@@ -139,14 +138,14 @@ BRepAdaptor_CompCurve2::BRepAdaptor_CompCurve2(const TopoDS_Wire& W,
|
||||
TLast = Last;
|
||||
PTol = Tol;
|
||||
|
||||
// Trim des courbes extremes.
|
||||
// Trim extreme curves.
|
||||
Handle (BRepAdaptor_HCurve) HC;
|
||||
Standard_Integer i1, i2;
|
||||
Standard_Real f=TFirst, l=TLast, d;
|
||||
i1 = i2 = CurIndex;
|
||||
Prepare(f, d, i1);
|
||||
Prepare(l, d, i2);
|
||||
CurIndex = (i1+i2)/2; // Petite optimisation
|
||||
CurIndex = (i1+i2)/2; // Small optimization
|
||||
if (i1==i2) {
|
||||
if (l > f)
|
||||
HC = Handle(BRepAdaptor_HCurve)::DownCast(myCurves->Value(i1).Trim(f, l, PTol));
|
||||
@@ -231,14 +230,14 @@ const TopoDS_Wire& BRepAdaptor_CompCurve2::Wire() const
|
||||
Standard_Integer ii, jj, kk, n;
|
||||
Standard_Real f, F, delta;
|
||||
|
||||
// Premiere courbe (sens de parcourt de le edge)
|
||||
// First curve (direction of path edge)
|
||||
n = myCurves->ChangeValue(1).NbIntervals(S);
|
||||
Handle(TColStd_HArray1OfReal) Ti = new (TColStd_HArray1OfReal) (1, n+1);
|
||||
myCurves->ChangeValue(1).Intervals(Ti->ChangeArray1(), S);
|
||||
InvPrepare(1, f, delta);
|
||||
F = myKnots->Value(1);
|
||||
if (delta < 0) {
|
||||
//sens de parcourt inverser
|
||||
//reverse direction of path
|
||||
for (kk=1,jj=Ti->Length(); jj>0; kk++, jj--)
|
||||
T(kk) = F + (Ti->Value(jj)-f)*delta;
|
||||
}
|
||||
@@ -247,7 +246,7 @@ const TopoDS_Wire& BRepAdaptor_CompCurve2::Wire() const
|
||||
T(kk) = F + (Ti->Value(kk)-f)*delta;
|
||||
}
|
||||
|
||||
// et les suivante
|
||||
// and the following
|
||||
for (ii=2; ii<=myCurves->Length(); ii++) {
|
||||
n = myCurves->ChangeValue(ii).NbIntervals(S);
|
||||
if (n != Ti->Length()-1) Ti = new (TColStd_HArray1OfReal) (1, n+1);
|
||||
@@ -255,7 +254,7 @@ const TopoDS_Wire& BRepAdaptor_CompCurve2::Wire() const
|
||||
InvPrepare(ii, f, delta);
|
||||
F = myKnots->Value(ii);
|
||||
if (delta < 0) {
|
||||
//sens de parcourt inverser
|
||||
//reverse direction of path
|
||||
for (jj=Ti->Length()-1; jj>0; kk++, jj--)
|
||||
T(kk) = F + (Ti->Value(jj)-f)*delta;
|
||||
}
|
||||
@@ -362,7 +361,7 @@ const TopoDS_Wire& BRepAdaptor_CompCurve2::Wire() const
|
||||
|
||||
GeomAbs_CurveType BRepAdaptor_CompCurve2::GetType() const
|
||||
{
|
||||
return GeomAbs_OtherCurve; //temporaire
|
||||
return GeomAbs_OtherCurve; //temporary
|
||||
// if ( myCurves->Length() > 1) return GeomAbs_OtherCurve;
|
||||
// return myCurves->Value(1).GetType();
|
||||
}
|
||||
@@ -425,15 +424,15 @@ const TopoDS_Wire& BRepAdaptor_CompCurve2::Wire() const
|
||||
//=======================================================================
|
||||
//function : Prepare
|
||||
//purpose :
|
||||
// Lorsque le parametre est pres de un "noeud" on determine la loi en
|
||||
// fonction du signe de tol:
|
||||
// - negatif -> Loi precedente au noeud.
|
||||
// - positif -> Loi consecutive au noeud.
|
||||
// When the parameter is near a "node" we determine the law by
|
||||
// function of the sign of Tol:
|
||||
// - negative -> Law preceding the node.
|
||||
// - positive -> Law following the node.
|
||||
//=======================================================================
|
||||
|
||||
void BRepAdaptor_CompCurve2::Prepare(Standard_Real& W,
|
||||
Standard_Real& Delta,
|
||||
Standard_Integer& CurIndex) const
|
||||
Standard_Real& Delta,
|
||||
Standard_Integer& CurIndex) const
|
||||
{
|
||||
Standard_Real f,l, Wtest, Eps;
|
||||
Standard_Integer ii;
|
||||
@@ -441,23 +440,23 @@ const TopoDS_Wire& BRepAdaptor_CompCurve2::Wire() const
|
||||
else { Eps = -PTol;}
|
||||
|
||||
|
||||
Wtest = W+Eps; //Decalage pour discriminer les noeuds
|
||||
Wtest = W+Eps; //Offset to discriminate between nodes
|
||||
if(Periodic){
|
||||
Wtest = ElCLib::InPeriod(Wtest,
|
||||
0,
|
||||
myPeriod);
|
||||
0,
|
||||
myPeriod);
|
||||
W = Wtest-Eps;
|
||||
}
|
||||
|
||||
// Recheche de le index
|
||||
// Index search
|
||||
Standard_Boolean Trouve = Standard_False;
|
||||
if (myKnots->Value(CurIndex) > Wtest) {
|
||||
for (ii=CurIndex-1; ii>0 && !Trouve; ii--)
|
||||
if (myKnots->Value(ii)<= Wtest) {
|
||||
CurIndex = ii;
|
||||
Trouve = Standard_True;
|
||||
CurIndex = ii;
|
||||
Trouve = Standard_True;
|
||||
}
|
||||
if (!Trouve) CurIndex = 1; // En dehors des bornes ...
|
||||
if (!Trouve) CurIndex = 1; // Out of bounds...
|
||||
}
|
||||
|
||||
else if (myKnots->Value(CurIndex+1) <= Wtest) {
|
||||
@@ -466,7 +465,7 @@ const TopoDS_Wire& BRepAdaptor_CompCurve2::Wire() const
|
||||
CurIndex = ii;
|
||||
Trouve = Standard_True;
|
||||
}
|
||||
if (!Trouve) CurIndex = myCurves->Length(); // En dehors des bornes ...
|
||||
if (!Trouve) CurIndex = myCurves->Length(); // Out of bounds...
|
||||
}
|
||||
|
||||
// Reverse ?
|
||||
@@ -476,7 +475,7 @@ const TopoDS_Wire& BRepAdaptor_CompCurve2::Wire() const
|
||||
Reverse = (Forward && (Or == TopAbs_REVERSED)) ||
|
||||
(!Forward && (Or != TopAbs_REVERSED));
|
||||
|
||||
// Calcul du parametre local
|
||||
// Calculation of the local parameter
|
||||
BRep_Tool::Range(E, f, l);
|
||||
Delta = myKnots->Value(CurIndex+1) - myKnots->Value(CurIndex);
|
||||
if (Delta > PTol*1.e-9) Delta = (l-f)/Delta;
|
||||
@@ -491,8 +490,8 @@ const TopoDS_Wire& BRepAdaptor_CompCurve2::Wire() const
|
||||
}
|
||||
|
||||
void BRepAdaptor_CompCurve2::InvPrepare(const Standard_Integer index,
|
||||
Standard_Real& First,
|
||||
Standard_Real& Delta) const
|
||||
Standard_Real& First,
|
||||
Standard_Real& Delta) const
|
||||
{
|
||||
// Reverse ?
|
||||
const TopoDS_Edge& E = myCurves->Value(index).Edge();
|
||||
@@ -501,8 +500,8 @@ void BRepAdaptor_CompCurve2::InvPrepare(const Standard_Integer index,
|
||||
Reverse = (Forward && (Or == TopAbs_REVERSED)) ||
|
||||
(!Forward && (Or != TopAbs_REVERSED));
|
||||
|
||||
// Calcul des parametres de reparametrisation
|
||||
// tel que : T = Ti + (t-First)*Delta
|
||||
// Calculation of reparametrization parameters
|
||||
// such as: T = Ti + (t-First)*Delta
|
||||
Standard_Real f, l;
|
||||
BRep_Tool::Range(E, f, l);
|
||||
Delta = myKnots->Value(index+1) - myKnots->Value(index);
|
||||
|
||||
@@ -92,7 +92,7 @@ class Geom_BSplineCurve;
|
||||
//! The Curve from BRepAdaptor allows to use a Wire of the BRep topology
|
||||
//! like a 3D curve. <br>
|
||||
//! Warning: With this class of curve, C0 and C1 continuities
|
||||
//! are not assumed. So be careful with some algorithm!
|
||||
//! are not assumed. So be careful with some algorithms!
|
||||
class BRepAdaptor_CompCurve2 : public Adaptor3d_Curve
|
||||
{
|
||||
|
||||
|
||||
@@ -96,12 +96,12 @@ double best_fit::ANN()
|
||||
double error = 0.0;
|
||||
|
||||
int a_dim = 3;
|
||||
int a_nbPnts =(int) m_pntCloud_2.size(); // Size vom eingescanntem Netz
|
||||
int a_nbNear = 1; // anzahl der rückgabewerte
|
||||
int a_nbPnts =(int) m_pntCloud_2.size(); // Size of the scanned network
|
||||
int a_nbNear = 1; // number of return values
|
||||
queryPt = annAllocPt(a_dim); // allocate query point storage
|
||||
dataPts = annAllocPts(a_nbPnts, a_dim); // allocate data points storage
|
||||
nnIdx = new ANNidx[a_nbNear]; // allocate near neigh indices
|
||||
dists = new ANNdist[a_nbNear]; // allocatenear neighbor dists
|
||||
nnIdx = new ANNidx[a_nbNear]; // allocate near neighbor indices
|
||||
dists = new ANNdist[a_nbNear]; // allocate near neighbor dists
|
||||
|
||||
m_LSPnts[0].clear();
|
||||
m_LSPnts[1].clear();
|
||||
@@ -115,7 +115,7 @@ double best_fit::ANN()
|
||||
|
||||
kdTree = new ANNkd_tree( // build search structure
|
||||
dataPts, // the data points
|
||||
a_nbPnts, // number of points
|
||||
a_nbPnts, // number of points
|
||||
a_dim); // dimension of space
|
||||
|
||||
|
||||
@@ -126,8 +126,8 @@ double best_fit::ANN()
|
||||
queryPt[2] = m_pntCloud_1[i].z;
|
||||
|
||||
kdTree->annkSearch( // search
|
||||
queryPt, // query point
|
||||
a_nbNear, // number of near neighbors
|
||||
queryPt, // query point
|
||||
a_nbNear, // number of near neighbors
|
||||
nnIdx, // nearest neighbors (returned)
|
||||
dists // distance (returned)
|
||||
); // error bound
|
||||
@@ -219,7 +219,7 @@ bool best_fit::Perform()
|
||||
M[1][3] = m_cad2orig.Y();
|
||||
M[2][3] = m_cad2orig.Z();
|
||||
|
||||
m_CadMesh.Transform(M); // besser: tesselierung nach der trafo !!!
|
||||
m_CadMesh.Transform(M); // better: tessellation after the transformer!
|
||||
m_MeshWork.Transform(M);
|
||||
PointTransform(m_pntCloud_1,M);
|
||||
|
||||
@@ -404,9 +404,9 @@ bool best_fit::Coarse_correction()
|
||||
|
||||
T.setToUnity();
|
||||
best_fit befi;
|
||||
|
||||
//error = CompError_GetPnts(m_pnts, m_normals)[0]; // startfehler int n=360/rstep_corr;
|
||||
|
||||
|
||||
//error = CompError_GetPnts(m_pnts, m_normals)[0]; // start error int n=360/rstep_corr;
|
||||
|
||||
error = ANN();
|
||||
|
||||
for (int i=1; i<4; ++i)
|
||||
@@ -443,33 +443,33 @@ bool best_fit::Coarse_correction()
|
||||
|
||||
bool best_fit::LSM()
|
||||
{
|
||||
double TOL = 0.05; // Abbruchkriterium des Newton-Verfahren
|
||||
int maxIter = 100; // maximale Anzahl von Iterationen für den Fall,
|
||||
// dass das Abbruchkriterium nicht erfüllt wird
|
||||
double TOL = 0.05; // Termination criterion of the Newton method
|
||||
int maxIter = 100; // maximum number of iterations for the case,
|
||||
// that the termination criterion is not met
|
||||
|
||||
int mult = 2; // zur Halbierung der Schrittweite bei Misserfolg des Newton Verfahrens
|
||||
int mult = 2; // to halve the step size in the event of failure of the Newton method
|
||||
|
||||
double val, tmp = 1e+10, delta, delta_tmp = 0.0;
|
||||
Base::Matrix4D Tx,Ty,Tz,Rx,Ry,Rz,M; // Transformaitonsmatrizen
|
||||
Base::Matrix4D Tx,Ty,Tz,Rx,Ry,Rz,M; // Transformation matrices
|
||||
|
||||
ofstream anOutputFile;
|
||||
anOutputFile.open("c:/outputBestFit.txt");
|
||||
anOutputFile.precision(7);
|
||||
|
||||
int c=0; // Laufvariable
|
||||
|
||||
int c=0; // Run variable
|
||||
|
||||
|
||||
|
||||
std::vector<double> del_x(3,0.0);
|
||||
std::vector<double> x(3,0.0); // Startparameter entspricht Nullvektor
|
||||
std::vector<double> x(3,0.0); // Start parameter corresponds to zero vector
|
||||
|
||||
Base::Vector3f centr_l,centr_r, cent; // Schwerpunkte der Punktesätze
|
||||
Base::Vector3f centr_l,centr_r, cent; // Focal points of the point sets
|
||||
|
||||
// Newton Verfahren: 1. Löse H*del_x = -J
|
||||
// 2. Setze x = x + del_x
|
||||
// Newton's method: 1. Solve H*del_x = -J
|
||||
// 2. Set x = x + del_x
|
||||
|
||||
std::vector<double> Jac(3); // 1.Ableitung der Fehlerfunktion (Jacobi-Matrix)
|
||||
std::vector< std::vector<double> > H; // 2.Ableitung der Fehlerfunktion (Hesse-Matrix)
|
||||
std::vector<double> Jac(3); // 1. Deriving the error function (Jacobi-Matrix)
|
||||
std::vector< std::vector<double> > H; // 2. Deriving the error function (Hesse-Matrix)
|
||||
|
||||
time_t seconds1, seconds2, sec1, sec2;
|
||||
seconds1 = time(NULL);
|
||||
@@ -480,26 +480,26 @@ bool best_fit::LSM()
|
||||
seconds1 = time(NULL);
|
||||
//m_Mesh = m_MeshWork;
|
||||
|
||||
// Fehlerberechnung vom CAD -> Mesh
|
||||
//tmp = CompError_GetPnts(m_pnts, m_normals); // hier: - Berechnung der LS-Punktesätze
|
||||
// CompTotalError() // - Berechnung der zugehörigen Gewichtungen
|
||||
// Error calculation from CAD -> Mesh
|
||||
//tmp = CompError_GetPnts(m_pnts, m_normals); // here: - Calculation of the LS point sets
|
||||
// CompTotalError() // - Calculation of the corresponding weightings
|
||||
|
||||
delta = delta_tmp;
|
||||
delta_tmp = ANN(); // gibt durchschnittlichen absoluten Fehler aus
|
||||
delta = delta - delta_tmp ; // hier wird die Fehlerverbesserung zum vorigen Iterationsschritt gespeichert
|
||||
delta_tmp = ANN(); // returns average absolute errors
|
||||
delta = delta - delta_tmp ; // the error correction for the previous iteration step is stored here
|
||||
|
||||
if (c==maxIter || delta < ERR_TOL && c>1) break; // Abbruchkriterium (falls maximale Iterationsschrite erreicht
|
||||
// oder falls Fehleränderung unsignifikant gering)
|
||||
if (c==maxIter || delta < ERR_TOL && c>1) break; // Abort criterion (if maximum iteration steps are reached or if
|
||||
// the change in error is insignificantly small)
|
||||
|
||||
seconds2 = time(NULL);
|
||||
anOutputFile << c << ", " << delta_tmp << ", " << delta << " - Time: " << seconds2 - seconds1 << " sec" << endl;
|
||||
seconds1 = time(NULL);
|
||||
|
||||
sec1 = time(NULL);
|
||||
for (unsigned int i=0; i<x.size(); ++i) x[i] = 0.0; // setzt startwerte für newton auf null
|
||||
for (unsigned int i=0; i<x.size(); ++i) x[i] = 0.0; // sets the starting values for newton to zero
|
||||
|
||||
|
||||
// Berechne gewichtete Schwerpunkte und verschiebe die Punktesätze entsprechend:
|
||||
// Calculate weighted centroids and shift the point sets accordingly:
|
||||
centr_l.Scale(0.0,0.0,0.0);
|
||||
centr_r.Scale(0.0,0.0,0.0);
|
||||
|
||||
@@ -529,7 +529,7 @@ bool best_fit::LSM()
|
||||
|
||||
|
||||
|
||||
// Verschiebung der Schwerpunkte zum Ursprung
|
||||
// Shifting the focus to the origin
|
||||
TransMat(Tx,centr_l.x,1);
|
||||
TransMat(Ty,centr_l.y,2);
|
||||
TransMat(Tz,centr_l.z,3);
|
||||
@@ -540,26 +540,26 @@ bool best_fit::LSM()
|
||||
PointTransform(m_pntCloud_2,M);
|
||||
m_MeshWork.Transform(M);
|
||||
|
||||
TransMat(Tx,centr_r.x,1); // Berechnung der Translationsmatrix in x-Richtung
|
||||
TransMat(Ty,centr_r.y,2); // Berechnung der Translationsmatrix in y-Richtung
|
||||
TransMat(Tz,centr_r.z,3); // Berechnung der Translationsmatrix in z-Richtung
|
||||
TransMat(Tx,centr_r.x,1); // Calculation of the translation matrix in x-direction
|
||||
TransMat(Ty,centr_r.y,2); // Calculation of the translation matrix in y-direction
|
||||
TransMat(Tz,centr_r.z,3); // Calculation of the translation matrix in z-direction
|
||||
|
||||
M = Tx*Ty*Tz; // Zusammenfügen zu einer Gesamttranslationsmatrix
|
||||
PointTransform(m_LSPnts[1],M); // Anwendung der Translation auf m_LSPnts
|
||||
M = Tx*Ty*Tz; // Merge into an overall translation matrix
|
||||
PointTransform(m_LSPnts[1],M); // Applying the translation to m_LSPnts
|
||||
PointTransform(m_pntCloud_1,M);
|
||||
//PointNormalTransform(m_pnts, m_normals, M); // Anwendung der Translation auf m_pnts
|
||||
m_CadMesh.Transform(M); // Anwendung der Translation auf das CadMesh
|
||||
//PointNormalTransform(m_pnts, m_normals, M); // Application of translation to m_pnts
|
||||
m_CadMesh.Transform(M); // Application of translation to the CadMesh
|
||||
|
||||
sec2 = time(NULL);
|
||||
anOutputFile << c+1 << " - Initialisierung und Transformation um gewichtete Schwerpunkte: " << sec2 - sec1 << " sec" << endl;
|
||||
anOutputFile << c+1 << " - Initialization and transformation around weighted focal points: " << sec2 - sec1 << " sec" << endl;
|
||||
|
||||
sec1 = time(NULL);
|
||||
// Newton-Verfahren zur Berechnung der Rotationsmatrix:
|
||||
// Newton's method for calculating the rotation matrix:
|
||||
while (true)
|
||||
{
|
||||
|
||||
Jac = Comp_Jacobi(x); // berechne 1.Ableitung
|
||||
H = Comp_Hess(x); // berechne 2.Ableitung
|
||||
Jac = Comp_Jacobi(x); // compute 1st derivative
|
||||
H = Comp_Hess(x); // compute 2nd derivative
|
||||
|
||||
val = 0.0;
|
||||
for (unsigned int i=0; i<Jac.size(); ++i)
|
||||
@@ -568,13 +568,13 @@ bool best_fit::LSM()
|
||||
}
|
||||
val = sqrt(val);
|
||||
|
||||
if (val < TOL) break; // Abbruchkriterium des Newton-Verfahren
|
||||
if (val < TOL) break; // Termination criterion of the Newton method
|
||||
|
||||
if (val>tmp && mult < 1e+4)
|
||||
{
|
||||
for (unsigned int i=0; i<del_x.size(); ++i)
|
||||
{
|
||||
x[i] -= del_x[i]/double(mult); // Halbiere Schrittweite falls keine Verbesserung
|
||||
x[i] -= del_x[i]/double(mult); // Halve the increment if no improvement
|
||||
}
|
||||
mult *= 2;
|
||||
continue;
|
||||
@@ -586,8 +586,8 @@ bool best_fit::LSM()
|
||||
|
||||
tmp = val;
|
||||
|
||||
del_x = Routines::NewtonStep(Jac,H); // löst Gl.system: H*del_x = -J
|
||||
for (unsigned int i=0; i<x.size(); ++i) // nächster Iterationswert: x = x + del_x
|
||||
del_x = Routines::NewtonStep(Jac,H); // solves equation system: H*del_x = -J
|
||||
for (unsigned int i=0; i<x.size(); ++i) // next iteration value: x = x + del_x
|
||||
{
|
||||
x[i] += del_x[i];
|
||||
}
|
||||
@@ -596,7 +596,7 @@ bool best_fit::LSM()
|
||||
sec2 = time(NULL);
|
||||
anOutputFile << c+1 << " - Newton: " << seconds2 - seconds1 << " sec" << endl;
|
||||
sec1 = time(NULL);
|
||||
// Rotiere und verschiebe zurück zum Ursprung der !!! CAD-Geometrie !!!
|
||||
// Rotate and shift back to the origin of the !!! CAD geometry !!!
|
||||
RotMat (Rx,(x[0]*180.0/PI),1);
|
||||
RotMat (Ry,(x[1]*180.0/PI),2);
|
||||
RotMat (Rz,(x[2]*180.0/PI),3);
|
||||
@@ -612,7 +612,7 @@ bool best_fit::LSM()
|
||||
TransMat(Ty, -centr_r.y - cent.y + centr_l.y, 2);
|
||||
TransMat(Tz, -centr_r.z - cent.z + centr_l.z, 3);
|
||||
|
||||
M = Tx*Ty*Tz*Rx*Ry*Rz; // Rotiere zuerst !!! (Rotationen stets um den Nullpunkt...)
|
||||
M = Tx*Ty*Tz*Rx*Ry*Rz; // Rotate first !!! (Rotations always around the zero point ...)
|
||||
|
||||
PointTransform(m_pntCloud_2,M);
|
||||
m_MeshWork.Transform(M);
|
||||
@@ -629,7 +629,7 @@ bool best_fit::LSM()
|
||||
sec2 = time(NULL);
|
||||
|
||||
anOutputFile << c+1 << " - Trafo: " << seconds2 - seconds1 << " sec" << endl;
|
||||
++c; //Erhöhe Laufvariable
|
||||
++c; //Increase run variable
|
||||
}
|
||||
|
||||
anOutputFile.close();
|
||||
@@ -763,7 +763,7 @@ bool best_fit::Comp_Weights()
|
||||
|
||||
bool bf;
|
||||
|
||||
// explores all faces ------------ Hauptschleife
|
||||
// explores all faces ------------ Main loop
|
||||
for (aExpFace.Init(m_Cad,TopAbs_FACE);aExpFace.More();aExpFace.Next())
|
||||
{
|
||||
TopoDS_Face aFace = TopoDS::Face(aExpFace.Current());
|
||||
@@ -851,7 +851,7 @@ bool best_fit::Comp_Weights()
|
||||
bool best_fit::RotMat(Base::Matrix4D &M, double degree, int axis)
|
||||
{
|
||||
M.setToUnity();
|
||||
degree = 2*PI*degree/360; // trafo bogenmaß
|
||||
degree = 2*PI*degree/360; // transformer bend
|
||||
|
||||
switch (axis)
|
||||
{
|
||||
@@ -1060,7 +1060,7 @@ bool best_fit::PointCloud_Coarse()
|
||||
Base::Builder3D log3d_mesh, log3d_cad;
|
||||
gp_Pnt orig;
|
||||
|
||||
gp_Vec v1,v2,v3,v,vec; // Hauptachsenrichtungen
|
||||
gp_Vec v1,v2,v3,v,vec; // Major axis directions
|
||||
gp_Trsf trafo;
|
||||
|
||||
FitFunc_1.Clear();
|
||||
@@ -1088,7 +1088,7 @@ bool best_fit::PointCloud_Coarse()
|
||||
|
||||
Base::Matrix4D T5, T1;
|
||||
|
||||
// Füllt Matrix T5
|
||||
// Fills matrix T5
|
||||
T5[0][0] = DirA_1.x;
|
||||
T5[1][0] = DirA_1.y;
|
||||
T5[2][0] = DirA_1.z;
|
||||
@@ -1122,7 +1122,7 @@ bool best_fit::PointCloud_Coarse()
|
||||
T5[2][3] = Grav_1.z;*/
|
||||
|
||||
|
||||
// Füllt Matrix T1
|
||||
// Fills matrix T1
|
||||
T1[0][0] = DirA_2.x;
|
||||
T1[1][0] = DirA_2.y;
|
||||
T1[2][0] = DirA_2.z;
|
||||
@@ -1197,7 +1197,7 @@ bool best_fit::PointCloud_Coarse()
|
||||
pnt.z = (float) orig.Z();
|
||||
|
||||
log3d_mesh.addSingleArrow(pnt,x,3,1,0,0);log3d_mesh.addSingleArrow(pnt,y,3,0,1,0);log3d_mesh.addSingleArrow(pnt,z,3,0,0,1);
|
||||
log3d_mesh.addSinglePoint(0,0,0,20,1,1,1); // plotte Ursprung
|
||||
log3d_mesh.addSinglePoint(0,0,0,20,1,1,1); // plot origins
|
||||
//log3d_mesh.addSinglePoint(pnt,6,0,0,0);
|
||||
log3d_mesh.saveToFile("c:/Mesh_CoordSys.iv");
|
||||
|
||||
@@ -1221,7 +1221,7 @@ bool best_fit::MeshFit_Coarse()
|
||||
Base::Builder3D log3d_mesh, log3d_cad;
|
||||
gp_Pnt orig;
|
||||
|
||||
gp_Vec v1,v2,v3,v,vec; // Hauptachsenrichtungen
|
||||
gp_Vec v1,v2,v3,v,vec; // Major axis directions
|
||||
gp_Trsf trafo;
|
||||
|
||||
/* BRepGProp::SurfaceProperties(m_Cad, prop);
|
||||
@@ -1300,7 +1300,7 @@ bool best_fit::MeshFit_Coarse()
|
||||
pnt.z = (float) orig.Z();
|
||||
|
||||
log3d_mesh.addSingleArrow(pnt,x,3,1,0,0);log3d_mesh.addSingleArrow(pnt,y,3,0,1,0);log3d_mesh.addSingleArrow(pnt,z,3,0,0,1);
|
||||
log3d_mesh.addSinglePoint(0,0,0,20,1,1,1); // plotte Ursprung
|
||||
log3d_mesh.addSinglePoint(0,0,0,20,1,1,1); // plot origins
|
||||
//log3d_mesh.addSinglePoint(pnt,6,0,0,0);
|
||||
log3d_mesh.saveToFile("c:/Mesh_CoordSys.iv");
|
||||
|
||||
@@ -1317,7 +1317,7 @@ bool best_fit::ShapeFit_Coarse()
|
||||
SurfProp.SurfaceProperties(m_Cad, prop);
|
||||
orig = prop.CentreOfMass();
|
||||
|
||||
// CAD-Mesh -> zurück zum Ursprung
|
||||
// CAD-Mesh -> back to the origin
|
||||
m_cad2orig.SetX(-orig.X());
|
||||
m_cad2orig.SetY(-orig.Y());
|
||||
m_cad2orig.SetZ(-orig.Z());
|
||||
@@ -1339,7 +1339,7 @@ bool best_fit::Tesselate_Face(const TopoDS_Face &aface, MeshCore::MeshKernel &me
|
||||
Base::Vector3f Points[3];
|
||||
if (!BRepTools::Triangulation(aface,0.1))
|
||||
{
|
||||
// removes all the triangulations of the faces ,
|
||||
// removes all the triangulations of the faces,
|
||||
// and all the polygons on the triangulations of the edges:
|
||||
BRepTools::Clean(aface);
|
||||
|
||||
@@ -1349,8 +1349,8 @@ bool best_fit::Tesselate_Face(const TopoDS_Face &aface, MeshCore::MeshKernel &me
|
||||
/*The next two lines have been from the occ6.2 adapt mesh library. They do not work within OCC6.3
|
||||
TriangleAdapt_Parameters MeshingParams;
|
||||
BRepMeshAdapt::Mesh(aface,deflection,MeshingParams);
|
||||
*/
|
||||
BRepMesh_IncrementalMesh Mesh(aface,deflection);
|
||||
*/
|
||||
BRepMesh_IncrementalMesh Mesh(aface,deflection);
|
||||
}
|
||||
TopLoc_Location aLocation;
|
||||
// takes the triangulation of the face aFace:
|
||||
@@ -1511,7 +1511,7 @@ std::vector<Base::Vector3f> best_fit::Comp_Normals(MeshCore::MeshKernel &M)
|
||||
|
||||
for (int i=0; i<NumOfPoints; ++i)
|
||||
{
|
||||
// Satz von Dreiecken zu jedem Punkt
|
||||
// Set of triangles at each point
|
||||
mPnt = M.GetPoint(i);
|
||||
origPoint.x = mPnt.x;
|
||||
origPoint.y = mPnt.y;
|
||||
@@ -1521,12 +1521,13 @@ std::vector<Base::Vector3f> best_fit::Comp_Normals(MeshCore::MeshKernel &M)
|
||||
fArea = 0.0;
|
||||
normal.Set(0.0,0.0,0.0);
|
||||
|
||||
// Iteriere über die Dreiecke zu jedem Punkt
|
||||
// Iterate over the triangles to each point
|
||||
for (std::set<unsigned long>::const_iterator it = faceSet.begin(); it != faceSet.end(); ++it)
|
||||
{
|
||||
// Zweimal derefernzieren, um an das MeshFacet zu kommen und dem Kernel uebergeben, dass er ein MeshGeomFacet liefert
|
||||
// Dereference twice to get to the MeshFacet and hand over
|
||||
// to the kernel that it delivers a MeshGeomFacet
|
||||
t_face = M.GetFacet(*it);
|
||||
// Flaecheninhalt aufsummieren
|
||||
// Sum up the area content
|
||||
local_Area = t_face.Area();
|
||||
local_normal = t_face.GetNormal();
|
||||
if (local_normal.z < 0)
|
||||
@@ -1741,7 +1742,7 @@ double best_fit::CompTotalError()
|
||||
m_LSPnts[1].clear();
|
||||
for (p_it.Begin(); p_it.More(); p_it.Next())
|
||||
{
|
||||
if (malg.NearestFacetOnRay(*p_it, m_normals[i], aFacetGrid, projPoint, facetIndex)) // gridoptimiert
|
||||
if (malg.NearestFacetOnRay(*p_it, m_normals[i], aFacetGrid, projPoint, facetIndex)) // grid-optimized
|
||||
{
|
||||
log3d.addSingleArrow(*p_it, projPoint, 3, 0,0,0);
|
||||
distVec = projPoint - *p_it;
|
||||
@@ -1760,7 +1761,7 @@ double best_fit::CompTotalError()
|
||||
else
|
||||
{
|
||||
|
||||
if (!malg2.NearestFacetOnRay(*p_it, m_normals[i], projPoint, facetIndex)) // nicht gridoptimiert
|
||||
if (!malg2.NearestFacetOnRay(*p_it, m_normals[i], projPoint, facetIndex)) // not grid-optimized
|
||||
{
|
||||
c++;
|
||||
//m_normals[i].Scale(-10,-10,-10);
|
||||
@@ -1792,7 +1793,7 @@ double best_fit::CompTotalError()
|
||||
|
||||
//for (p_it.Begin(); p_it.More(); p_it.Next())
|
||||
// {
|
||||
// if (!malg.NearestFacetOnRay(*p_it, m_normals[i], aFacetGrid, projPoint, facetIndex)) // gridoptimiert
|
||||
// if (!malg.NearestFacetOnRay(*p_it, m_normals[i], aFacetGrid, projPoint, facetIndex)) // grid-optimized
|
||||
// {
|
||||
// if (malg2.NearestFacetOnRay(*p_it, m_normals[i], projPoint, facetIndex))
|
||||
// {
|
||||
@@ -1898,7 +1899,7 @@ double best_fit::CompTotalError(MeshCore::MeshKernel &mesh)
|
||||
|
||||
for (p_it.Begin(); p_it.More(); p_it.Next())
|
||||
{
|
||||
if (malg.NearestFacetOnRay(*p_it, m_normals[i], aFacetGrid, projPoint, facetIndex)) // gridoptimiert
|
||||
if (malg.NearestFacetOnRay(*p_it, m_normals[i], aFacetGrid, projPoint, facetIndex)) // grid-optimized
|
||||
{
|
||||
distVec = projPoint - *p_it;
|
||||
sqrdis = distVec*distVec;
|
||||
@@ -1913,13 +1914,13 @@ double best_fit::CompTotalError(MeshCore::MeshKernel &mesh)
|
||||
else
|
||||
{
|
||||
|
||||
if (!malg2.NearestFacetOnRay(*p_it, m_normals[i], projPoint, facetIndex)) // nicht gridoptimiert
|
||||
if (!malg2.NearestFacetOnRay(*p_it, m_normals[i], projPoint, facetIndex)) // not grid-optimized
|
||||
{
|
||||
c++;
|
||||
FailProj.push_back(i);
|
||||
FailProj.push_back(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
distVec = projPoint - *p_it;
|
||||
sqrdis = distVec*distVec;
|
||||
|
||||
|
||||
@@ -37,7 +37,8 @@
|
||||
|
||||
|
||||
#define SMALL_NUM 1e-6
|
||||
#define ERR_TOL 0.001 // Abbruchkriterium für Least-Square-Matching (Fehleränderung zweier aufeinanderfolgenden Iterationsschritten)
|
||||
#define ERR_TOL 0.001 // Abort criterion for least square matching
|
||||
// (error change in two successive iteration steps)
|
||||
|
||||
|
||||
/*! \brief The main class for the best_fit routine
|
||||
@@ -104,7 +105,7 @@ public:
|
||||
average-error-value
|
||||
*/
|
||||
double CompTotalError(MeshCore::MeshKernel &mesh);
|
||||
|
||||
|
||||
/*! \brief Computes a triangulation on shape.
|
||||
|
||||
\param shape specifies the shape to be tessellated
|
||||
@@ -113,7 +114,7 @@ public:
|
||||
triangulation
|
||||
*/
|
||||
static bool Tesselate_Shape(const TopoDS_Shape &shape, MeshCore::MeshKernel &mesh, float deflection);
|
||||
|
||||
|
||||
/*! \brief Computes a triangulation on aface.
|
||||
|
||||
\param aface specifies the face to be tessellated
|
||||
@@ -129,7 +130,7 @@ public:
|
||||
\param Mesh Input-Mesh
|
||||
*/
|
||||
static std::vector<Base::Vector3f> Comp_Normals(MeshCore::MeshKernel &Mesh);
|
||||
|
||||
|
||||
/*! \brief Check and corrects mesh-position by rotating around all
|
||||
coordinate-axes with 180 degree
|
||||
*/
|
||||
@@ -167,19 +168,19 @@ public:
|
||||
std::vector<double> m_error;
|
||||
|
||||
/*! \brief Stores the point-sets computed with the function ANN() */
|
||||
std::vector<std::vector<Base::Vector3f> > m_LSPnts; // zu fittende Punktesätze für den Least-Square
|
||||
std::vector<std::vector<Base::Vector3f> > m_LSPnts; // Points sets to be fitted for Least-Square
|
||||
|
||||
/*! \brief Stores the weights computed with the function Comp_Weights() */
|
||||
std::vector<double> m_weights; // gewichtungen für den Least-Square bzgl. allen Netzpunkte
|
||||
std::vector<double> m_weights; // weighting for the Least-Square with respect to all network points
|
||||
|
||||
/*! \brief A working-copy of m_weights */
|
||||
std::vector<double> m_weights_loc; // gewichtungen für den Least-Square bzgl. den projezierten Netzpunkten
|
||||
std::vector<double> m_weights_loc; // weighting for the Least-Square with respect to the projected network points
|
||||
|
||||
/*! \brief Translation-vector from the function ShapeFit_Coarse() */
|
||||
gp_Vec m_cad2orig; // Translationsvektor welche die CAD-Geometrie um den Ursprung zentriert
|
||||
|
||||
gp_Vec m_cad2orig; // Translation vector that centers the CAD geometry about the origin
|
||||
|
||||
/*! \brief Vector of the preselected-faces for the weighting */
|
||||
std::vector<TopoDS_Face> m_LowFaces; // Vektor der in der GUI selektierten Faces mit geringer Gewichtung
|
||||
std::vector<TopoDS_Face> m_LowFaces; // Vector of the faces selected in the GUI with little weighting
|
||||
|
||||
private:
|
||||
/*! \brief Computes the rotation-matrix with reference to the given
|
||||
@@ -190,7 +191,7 @@ private:
|
||||
\param rotationAxis rotation-axis (1: x-axis, 2: y-axis, 3: z-axis)
|
||||
*/
|
||||
inline bool RotMat(Base::Matrix4D &matrix, double degree, int rotationAxis);
|
||||
|
||||
|
||||
/*! \brief Computes the translation-matrix with reference to the given
|
||||
parameters
|
||||
|
||||
@@ -199,7 +200,7 @@ private:
|
||||
\param translationAxis translation-axis (1: x-axis, 2: y-axis, 3: z-axis)
|
||||
*/
|
||||
inline bool TransMat(Base::Matrix4D &matrix, double translation, int translationAxis);
|
||||
|
||||
|
||||
/*! \brief Transforms the point-set \p pnts and the corresponding
|
||||
surface-normals normals with reference to the input-matrix
|
||||
|
||||
@@ -210,14 +211,14 @@ private:
|
||||
inline bool PointNormalTransform(std::vector<Base::Vector3f> &pnts,
|
||||
std::vector<Base::Vector3f> &normals,
|
||||
Base::Matrix4D &M);
|
||||
|
||||
|
||||
/*! \brief Transforms the point-set pnts with reference to the input-matrix
|
||||
|
||||
\param pnts point-vector to transform
|
||||
\param M is the 4x4-input-matrix
|
||||
*/
|
||||
bool PointTransform(std::vector<Base::Vector3f> &pnts, const Base::Matrix4D &M);
|
||||
|
||||
|
||||
/*! \brief Sets the weights for the ICP-Algorithm */
|
||||
bool Comp_Weights();
|
||||
|
||||
@@ -246,8 +247,8 @@ private:
|
||||
SMESH_Gen *m_aMeshGen1;
|
||||
SMESH_Gen *m_aMeshGen2;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//int intersect_RayTriangle(const Base::Vector3f &normal,const MeshCore::MeshGeomFacet &T, Base::Vector3f &P, Base::Vector3f &I);
|
||||
// bool Intersect(const Base::Vector3f &normal,const MeshCore::MeshKernel &mesh, Base::Vector3f &P, Base::Vector3f &I);
|
||||
};
|
||||
|
||||
@@ -80,7 +80,7 @@ bool Deviation::GenNormals()
|
||||
MeshMap.insert(inp);
|
||||
}
|
||||
|
||||
// explores all faces ------------ Hauptschleife
|
||||
// explores all faces ------------ Main loop
|
||||
for (aExpFace.Init(m_Cad,TopAbs_FACE);aExpFace.More();aExpFace.Next())
|
||||
{
|
||||
TopoDS_Face aFace = TopoDS::Face(aExpFace.Current());
|
||||
@@ -173,7 +173,7 @@ bool Deviation::Compute()
|
||||
if (malg.NearestFacetOnRay(*p_it, m_nlvec[i], aFacetGrid, projPoint, facetIndex)) // gridoptimiert
|
||||
{
|
||||
distVec = projPoint - *p_it;
|
||||
m_nlvec[i] = distVec; // überschreibt normalenvektor
|
||||
m_nlvec[i] = distVec; // overwrites normal vector
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -186,7 +186,7 @@ bool Deviation::Compute()
|
||||
else
|
||||
{
|
||||
distVec = projPoint - *p_it;
|
||||
m_nlvec[i] = distVec; // überschreibt normalenvektor
|
||||
m_nlvec[i] = distVec; // overwrites normal vector
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
void WriteOutput(const QString &dateiname);
|
||||
bool Compute();
|
||||
|
||||
TopoDS_Shape m_Cad; // CAD-Geometrie
|
||||
TopoDS_Shape m_Cad; // CAD-Geometry
|
||||
MeshCore::MeshKernel m_MeshCad;
|
||||
MeshCore::MeshKernel m_Mesh;
|
||||
|
||||
|
||||
@@ -64,15 +64,15 @@ double Routines::TrapezoidIntergration(const std::vector<double> &WithRespectTo,
|
||||
|
||||
std::vector<double> Routines::NewtonStep(std::vector<double> &F,std::vector<std::vector<double> > &DF)
|
||||
{
|
||||
// löst folgendes Gleichungssystem: DF*x = F
|
||||
// solves the following equation system: DF*x = F
|
||||
int siz = (int) F.size();
|
||||
std::vector<double> x_new(siz);
|
||||
std::vector<int> piv(siz); // pivotelement
|
||||
std::vector<int> piv(siz); // pivot element
|
||||
|
||||
ublas::matrix<double> A(siz, siz);
|
||||
ublas::matrix<double> b(1, siz);
|
||||
|
||||
// füllt blas-matrizen
|
||||
// fills blow molding matrices
|
||||
for (unsigned int i=0; i<siz; ++i)
|
||||
{
|
||||
b(0,i) = -F[i];
|
||||
@@ -88,8 +88,9 @@ std::vector<double> Routines::NewtonStep(std::vector<double> &F,std::vector<std:
|
||||
cout << A(2,0) << "," << A(2,1) << "," << A(2,2) << endl;*/
|
||||
|
||||
|
||||
atlas::lu_factor(A,piv); // führt LU-Zerlegung durch
|
||||
atlas::getrs(A,piv,b); // löst Gl.system A*x = b (b wird mit der Lösung überschrieben)
|
||||
atlas::lu_factor(A,piv); // performs LU decomposition
|
||||
atlas::getrs(A,piv,b); // solves equation system A*x = b
|
||||
// (b will be overwritten with the solution)
|
||||
|
||||
for (unsigned int i=0; i<siz; ++i)
|
||||
{
|
||||
|
||||
@@ -69,7 +69,7 @@ typedef struct
|
||||
class CamExport Routines
|
||||
{
|
||||
public:
|
||||
// mehrdimensionales Newton-Verfahren mit festem Startwert 0
|
||||
// Multi-dimensional Newton method with a fixed starting value of 0
|
||||
static std::vector<double> NewtonStep(std::vector<double> &F,std::vector<std::vector<double> > &DF);
|
||||
protected:
|
||||
double TrapezoidIntergration(const std::vector<double> &WithRespectTo, const std::vector<double> &Intergral);
|
||||
|
||||
Reference in New Issue
Block a user