From 108a80091e6eaeffab8ba382f6690ed798617ecb Mon Sep 17 00:00:00 2001 From: luz paz Date: Thu, 16 Dec 2021 11:46:54 -0500 Subject: [PATCH] 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. --- src/Mod/Cam/App/AppCamPy.cpp | 85 ++++++------ src/Mod/Cam/App/BRepAdaptor_CompCurve2.cxx | 59 ++++---- src/Mod/Cam/App/BRepAdaptor_CompCurve2.h | 2 +- src/Mod/Cam/App/best_fit.cpp | 151 +++++++++++---------- src/Mod/Cam/App/best_fit.h | 33 ++--- src/Mod/Cam/App/deviation.cpp | 6 +- src/Mod/Cam/App/deviation.h | 2 +- src/Mod/Cam/App/routine.cpp | 11 +- src/Mod/Cam/App/routine.h | 2 +- 9 files changed, 177 insertions(+), 174 deletions(-) diff --git a/src/Mod/Cam/App/AppCamPy.cpp b/src/Mod/Cam/App/AppCamPy.cpp index 93e2d6dc87..822616df14 100644 --- a/src/Mod/Cam/App/AppCamPy.cpp +++ b/src/Mod/Cam/App/AppCamPy.cpp @@ -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(pcObj); //Surface oder Step-File wird übergeben + TopoShapePy *pcShape = static_cast(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(pcObj2); //Shape wird übergeben + TopoShapePy *pcShape = static_cast(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(pcObj); //Surface wird übergeben +// TopoShapePyOld *pcShape = static_cast(pcObj); //Surface is passed //// TopoShapePyOld *pcShape2 = static_cast(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(pcObj); //Original-Shape wird hier übergeben + TopoShapePy *pcShape = static_cast(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& 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::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" <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(pcObj); //Surface wird übergeben +// TopoShapePyOld *pcShape = static_cast(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(pcObj2); //Shape wird übergeben + TopoShapePy *pcShape = static_cast(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(pcObj); //Shape wird übergeben + TopoShapePy *pcShape = static_cast(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(pcObj); //shape wird übergeben + TopoShapePy *pcShape = static_cast(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(pcObj2); //Shape wird übergeben - TopoDS_Shape cad = pcShape->getTopoShapePtr()->_Shape; // Input CAD + TopoShapePy *pcShape = static_cast(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(pcObj); //shape wird übergeben + TopoShapePy *pcShape = static_cast(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(pcObj2); //Surface wird übergeben + TopoShapePy *pcShape = static_cast(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 > R(3, std::vector(3,0.0)); // Rotationsmatrix + std::vector< std::vector > R(3, std::vector(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& 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::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) diff --git a/src/Mod/Cam/App/BRepAdaptor_CompCurve2.cxx b/src/Mod/Cam/App/BRepAdaptor_CompCurve2.cxx index a7f30028d8..0edd0a739b 100644 --- a/src/Mod/Cam/App/BRepAdaptor_CompCurve2.cxx +++ b/src/Mod/Cam/App/BRepAdaptor_CompCurve2.cxx @@ -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); diff --git a/src/Mod/Cam/App/BRepAdaptor_CompCurve2.h b/src/Mod/Cam/App/BRepAdaptor_CompCurve2.h index e31ddde6dd..5a6fefb56d 100644 --- a/src/Mod/Cam/App/BRepAdaptor_CompCurve2.h +++ b/src/Mod/Cam/App/BRepAdaptor_CompCurve2.h @@ -92,7 +92,7 @@ class Geom_BSplineCurve; //! The Curve from BRepAdaptor allows to use a Wire of the BRep topology //! like a 3D curve.
//! 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 { diff --git a/src/Mod/Cam/App/best_fit.cpp b/src/Mod/Cam/App/best_fit.cpp index 64041fa2c6..ac0c306d97 100644 --- a/src/Mod/Cam/App/best_fit.cpp +++ b/src/Mod/Cam/App/best_fit.cpp @@ -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 del_x(3,0.0); - std::vector x(3,0.0); // Startparameter entspricht Nullvektor + std::vector 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 Jac(3); // 1.Ableitung der Fehlerfunktion (Jacobi-Matrix) - std::vector< std::vector > H; // 2.Ableitung der Fehlerfunktion (Hesse-Matrix) + std::vector Jac(3); // 1. Deriving the error function (Jacobi-Matrix) + std::vector< std::vector > 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; itmp && mult < 1e+4) { for (unsigned int i=0; i 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 best_fit::Comp_Normals(MeshCore::MeshKernel &M) for (int i=0; i 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::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; diff --git a/src/Mod/Cam/App/best_fit.h b/src/Mod/Cam/App/best_fit.h index d347112b57..05f0f38c61 100644 --- a/src/Mod/Cam/App/best_fit.h +++ b/src/Mod/Cam/App/best_fit.h @@ -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 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 m_error; /*! \brief Stores the point-sets computed with the function ANN() */ - std::vector > m_LSPnts; // zu fittende Punktesätze für den Least-Square + std::vector > m_LSPnts; // Points sets to be fitted for Least-Square /*! \brief Stores the weights computed with the function Comp_Weights() */ - std::vector m_weights; // gewichtungen für den Least-Square bzgl. allen Netzpunkte + std::vector m_weights; // weighting for the Least-Square with respect to all network points /*! \brief A working-copy of m_weights */ - std::vector m_weights_loc; // gewichtungen für den Least-Square bzgl. den projezierten Netzpunkten + std::vector 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 m_LowFaces; // Vektor der in der GUI selektierten Faces mit geringer Gewichtung + std::vector 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 &pnts, std::vector &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 &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); }; diff --git a/src/Mod/Cam/App/deviation.cpp b/src/Mod/Cam/App/deviation.cpp index b207e339d4..ce1f0a2e1c 100644 --- a/src/Mod/Cam/App/deviation.cpp +++ b/src/Mod/Cam/App/deviation.cpp @@ -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 } } diff --git a/src/Mod/Cam/App/deviation.h b/src/Mod/Cam/App/deviation.h index afd95714d1..024812c874 100644 --- a/src/Mod/Cam/App/deviation.h +++ b/src/Mod/Cam/App/deviation.h @@ -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; diff --git a/src/Mod/Cam/App/routine.cpp b/src/Mod/Cam/App/routine.cpp index a03f15c289..cb25ca7050 100644 --- a/src/Mod/Cam/App/routine.cpp +++ b/src/Mod/Cam/App/routine.cpp @@ -64,15 +64,15 @@ double Routines::TrapezoidIntergration(const std::vector &WithRespectTo, std::vector Routines::NewtonStep(std::vector &F,std::vector > &DF) { - // löst folgendes Gleichungssystem: DF*x = F + // solves the following equation system: DF*x = F int siz = (int) F.size(); std::vector x_new(siz); - std::vector piv(siz); // pivotelement + std::vector piv(siz); // pivot element ublas::matrix A(siz, siz); ublas::matrix b(1, siz); - // füllt blas-matrizen + // fills blow molding matrices for (unsigned int i=0; i Routines::NewtonStep(std::vector &F,std::vector NewtonStep(std::vector &F,std::vector > &DF); protected: double TrapezoidIntergration(const std::vector &WithRespectTo, const std::vector &Intergral);