From a56fcdc4743e677ecae65d4f37c2dd53ea6a314b Mon Sep 17 00:00:00 2001 From: msv Date: Mon, 31 Jul 2017 16:26:00 +0300 Subject: [PATCH] #Temporary changes to force offset make computations on C0 surfaces. --- src/BRepOffset/BRepOffset_MakeOffset.cxx | 54 +++++++++---------- src/BRepOffset/BRepOffset_Offset.cxx | 4 +- .../IntCurveSurface_Polygon.gxx | 14 +++-- 3 files changed, 38 insertions(+), 34 deletions(-) diff --git a/src/BRepOffset/BRepOffset_MakeOffset.cxx b/src/BRepOffset/BRepOffset_MakeOffset.cxx index 7f22b22617..294186db5c 100644 --- a/src/BRepOffset/BRepOffset_MakeOffset.cxx +++ b/src/BRepOffset/BRepOffset_MakeOffset.cxx @@ -4302,11 +4302,11 @@ Standard_Boolean BRepOffset_MakeOffset::CheckInputData() BRepTools::UVBounds(aF, aUmin, aUmax, aVmin, aVmax); // Continuity check. - if (aSurf->Continuity() == GeomAbs_C0) - { - myError = BRepOffset_C0Geometry; - return Standard_False; - } + //if (aSurf->Continuity() == GeomAbs_C0) + //{ + // myError = BRepOffset_C0Geometry; + // return Standard_False; + //} // Get degenerated points, to avoid check them. NCollection_Vector aBad3dPnts; @@ -4320,31 +4320,31 @@ Standard_Boolean BRepOffset_MakeOffset::CheckInputData() } } - // Geometry grid check. - for(Standard_Integer i = 0; i <= aPntPerDim; i++) - { - Standard_Real aUParam = aUmin + (aUmax - aUmin) * i / aPntPerDim; - for(Standard_Integer j = 0; j <= aPntPerDim; j++) - { - Standard_Real aVParam = aVmin + (aVmax - aVmin) * j / aPntPerDim; + //// Geometry grid check. + //for(Standard_Integer i = 0; i <= aPntPerDim; i++) + //{ + // Standard_Real aUParam = aUmin + (aUmax - aUmin) * i / aPntPerDim; + // for(Standard_Integer j = 0; j <= aPntPerDim; j++) + // { + // Standard_Real aVParam = aVmin + (aVmax - aVmin) * j / aPntPerDim; - myError = checkSinglePoint(aUParam, aVParam, aSurf, aBad3dPnts); - if (myError != BRepOffset_NoError) - return Standard_False; - } - } + // myError = checkSinglePoint(aUParam, aVParam, aSurf, aBad3dPnts); + // if (myError != BRepOffset_NoError) + // return Standard_False; + // } + //} - // Vertex list check. - TopExp_Explorer anExpFV(aF, TopAbs_VERTEX); - for( ; anExpFV.More(); anExpFV.Next()) - { - const TopoDS_Vertex &aV = TopoDS::Vertex(anExpFV.Current()); - aPnt2d = BRep_Tool::Parameters(aV, aF); + //// Vertex list check. + //TopExp_Explorer anExpFV(aF, TopAbs_VERTEX); + //for( ; anExpFV.More(); anExpFV.Next()) + //{ + // const TopoDS_Vertex &aV = TopoDS::Vertex(anExpFV.Current()); + // aPnt2d = BRep_Tool::Parameters(aV, aF); - myError = checkSinglePoint(aPnt2d.X(), aPnt2d.Y(), aSurf, aBad3dPnts); - if (myError != BRepOffset_NoError) - return Standard_False; - } + // myError = checkSinglePoint(aPnt2d.X(), aPnt2d.Y(), aSurf, aBad3dPnts); + // if (myError != BRepOffset_NoError) + // return Standard_False; + //} } return Standard_True; diff --git a/src/BRepOffset/BRepOffset_Offset.cxx b/src/BRepOffset/BRepOffset_Offset.cxx index b1e8df348c..976549389e 100644 --- a/src/BRepOffset/BRepOffset_Offset.cxx +++ b/src/BRepOffset/BRepOffset_Offset.cxx @@ -528,8 +528,8 @@ void BRepOffset_Offset::Init(const TopoDS_Face& Face, if ( !Co->Position().Direct()) myOffset *= -1; } - Handle(Geom_Surface) TheSurf = - BRepOffset::Surface( S, myOffset, myStatus); + Handle(Geom_Surface) TheSurf = fabs(myOffset) > gp::Resolution() ? + BRepOffset::Surface( S, myOffset, myStatus) : S; //processing offsets of faces with possible degenerated edges Standard_Boolean UminDegen = Standard_False; diff --git a/src/IntCurveSurface/IntCurveSurface_Polygon.gxx b/src/IntCurveSurface/IntCurveSurface_Polygon.gxx index c412b5647a..54440968ef 100644 --- a/src/IntCurveSurface/IntCurveSurface_Polygon.gxx +++ b/src/IntCurveSurface/IntCurveSurface_Polygon.gxx @@ -169,11 +169,15 @@ void IntCurveSurface_Polygon::Init(const TheCurve& C, //ddout << "P1 : " << P1.X() << " " << P1.Y() << " " << P1.Z() << endl; gp_Pnt P2=ThePnts.Value(i+1); //ddout << "P2 : " << P2.X() << " " << P2.Y() << " " << P2.Z() << endl; - gp_Lin L(P1,gp_Dir(gp_Vec(P1,P2))); - Standard_Real t=L.Distance(Pm); - //ddout << "Distance " << t << endl; - if(t>TheDeflection) { - TheDeflection = t; + gp_Vec aV12(P1,P2); + if (aV12.SquareMagnitude() > gp::Resolution()) + { + gp_Lin L(P1,gp_Dir()); + Standard_Real t=L.Distance(Pm); + //ddout << "Distance " << t << endl; + if(t>TheDeflection) { + TheDeflection = t; + } } i++; } -- 2.39.5