From: jgv Date: Fri, 6 Sep 2019 14:03:59 +0000 (+0300) Subject: 0026071: BRepOffsetAPI_MakePipeShell produces rough result X-Git-Tag: V7_5_0_beta~381 X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff_plain;h=bf327822d60e03b2f7a96355b5baddc0c90dc596 0026071: BRepOffsetAPI_MakePipeShell produces rough result 1. Correct building history: the case of closed spine. 2. Rollback method GeomFill_CorrectedFrenet::InitInterval - correct processing singularities on spine. 3. Correct test cases. --- diff --git a/src/BRepFill/BRepFill_LocationLaw.cxx b/src/BRepFill/BRepFill_LocationLaw.cxx index 6d98735631..6ca54a717b 100644 --- a/src/BRepFill/BRepFill_LocationLaw.cxx +++ b/src/BRepFill/BRepFill_LocationLaw.cxx @@ -451,7 +451,12 @@ void BRepFill_LocationLaw::CurvilinearBounds(const Standard_Integer Index, Standard_Boolean BRepFill_LocationLaw::IsClosed() const { - return myPath.Closed(); + if (myPath.Closed()) + return Standard_True; + + TopoDS_Vertex V1, V2; + TopExp::Vertices(myPath, V1, V2); + return (V1.IsSame(V2)); } //======================================================================= diff --git a/src/BRepFill/BRepFill_PipeShell.cxx b/src/BRepFill/BRepFill_PipeShell.cxx index 6fd49ec84a..5efc443877 100644 --- a/src/BRepFill/BRepFill_PipeShell.cxx +++ b/src/BRepFill/BRepFill_PipeShell.cxx @@ -1377,7 +1377,7 @@ void BRepFill_PipeShell::BuildHistory(const BRepFill_Sweep& theSweep) BB.Add(aWire, CurEdge); } //for (jj = 2; jj <= SeqEdges.Length(); jj++) //case of closed wire - if (mySection->IsVClosed() && + if (myLocation->IsClosed() && !CurVertex.IsSame(FirstVertex)) { const TopTools_ListOfShape& Elist = VEmap.FindFromKey(CurVertex); diff --git a/src/BRepTest/BRepTest_SweepCommands.cxx b/src/BRepTest/BRepTest_SweepCommands.cxx index 1777b1dbd0..e8e528f5ad 100644 --- a/src/BRepTest/BRepTest_SweepCommands.cxx +++ b/src/BRepTest/BRepTest_SweepCommands.cxx @@ -247,6 +247,10 @@ static Standard_Integer geompipe(Draw_Interpretor&, std::cout << "GeomFill_Pipe cannot make a surface" << std::endl; return 1; } + + Standard_Real Accuracy = aPipe.ErrorOnSurf(); + std::cout << "Accuracy of approximation = " << Accuracy << std::endl; + Handle(Geom_Surface) Sur = aPipe.Surface(); TopoDS_Face F; if (!Sur.IsNull()) diff --git a/src/GeomFill/GeomFill_CorrectedFrenet.cxx b/src/GeomFill/GeomFill_CorrectedFrenet.cxx index c6bcb301f7..4bf7413036 100644 --- a/src/GeomFill/GeomFill_CorrectedFrenet.cxx +++ b/src/GeomFill/GeomFill_CorrectedFrenet.cxx @@ -475,16 +475,16 @@ Handle(GeomFill_TrihedronLaw) GeomFill_CorrectedFrenet::Copy() const gp_Vec Tangent, Normal, BN, cross; TColStd_SequenceOfReal parameters; TColStd_SequenceOfReal EvolAT; - Standard_Real Param = First, L, norm; + Standard_Real Param = First, LengthMin, L, norm; Standard_Boolean isZero = Standard_True, isConst = Standard_True; - const Standard_Real minnorm = 1.e-16; Standard_Integer i; gp_Pnt PonC; gp_Vec D1; - frenet->SetInterval(First, Last); //To have the rigth evaluation at bounds + frenet->SetInterval(First, Last); //To have right evaluation at bounds GeomFill_SnglrFunc CS(myCurve); BndLib_Add3dCurve::Add(CS, First, Last, 1.e-2, Boite); + LengthMin = Boite.GetGap()*1.e-4; aT = gp_Vec(0, 0, 0); aN = gp_Vec(0, 0, 0); @@ -541,21 +541,13 @@ Handle(GeomFill_TrihedronLaw) GeomFill_CorrectedFrenet::Copy() const //Evaluate the Next step CS.D1(Param, PonC, D1); - - L = PonC.XYZ().Modulus()/2; + L = Max(PonC.XYZ().Modulus()/2, LengthMin); norm = D1.Magnitude(); - if (norm <= gp::Resolution()) - { - //norm = 2.*gp::Resolution(); - norm = minnorm; + if (norm < Precision::Confusion()) { + norm = Precision::Confusion(); } currStep = L / norm; - if (currStep <= gp::Resolution()) //L = 0 => curvature = 0, linear segment - currStep = Step; - if (currStep < Precision::Confusion()) //too small step - currStep = Precision::Confusion(); - if (currStep > Step) //too big step - currStep = Step;//default value + if (currStep > Step) currStep = Step;//default value } else currStep /= 2; // Step too long ! diff --git a/src/GeometryTest/GeometryTest_SurfaceCommands.cxx b/src/GeometryTest/GeometryTest_SurfaceCommands.cxx index 5b5636ffa9..4854be844c 100644 --- a/src/GeometryTest/GeometryTest_SurfaceCommands.cxx +++ b/src/GeometryTest/GeometryTest_SurfaceCommands.cxx @@ -153,6 +153,9 @@ static Standard_Integer sweep (Draw_Interpretor& di, return 1; } + Standard_Real Accuracy = Pipe.ErrorOnSurf(); + di << "Accuracy of approximation = " << Accuracy << "\n"; + DrawTrSurf::Set(a[1], Pipe.Surface()); return 0; @@ -223,6 +226,10 @@ static Standard_Integer tuyau (Draw_Interpretor& di, di << "GeomFill_Pipe cannot make a surface\n"; return 1; } + + Standard_Real Accuracy = Pipe.ErrorOnSurf(); + di << "Accuracy of approximation = " << Accuracy << "\n"; + DrawTrSurf::Set(a[indice_path-1], Pipe.Surface()); return 0; diff --git a/tests/bugs/modalg_5/bug25883 b/tests/bugs/modalg_5/bug25883 index ed33932f99..f5b1eb0eaa 100644 --- a/tests/bugs/modalg_5/bug25883 +++ b/tests/bugs/modalg_5/bug25883 @@ -1,10 +1,7 @@ -puts "========" -puts "OCC25883" -puts "========" +puts "=============================================================" +puts "OCC25883: BRepOffsetAPI_MakePipeShell produces invalid result" +puts "=============================================================" puts "" -####################################################### -# BRepOffsetAPI_MakePipeShell produces invalid result -####################################################### restore [locate_data_file OCC25883_shape.brep] a @@ -16,12 +13,20 @@ mksweep a_1 addsweep a_2 buildsweep res -donly res -fit - set bug_info [checkshape res] if {[string compare $bug_info "This shape seems to be valid"] != 0} { puts "ERROR: OCC25883 is reproduced." } +set tolres [checkmaxtol res] + +if { ${tolres} > 1.e-4} { + puts "Error: bad tolerance of result" +} + +explode res +mksurface surf2 res_2 +donly surf2 +fit + checkview -screenshot -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/modalg_6/bug27386_1 b/tests/bugs/modalg_6/bug27386_1 index 467e858875..e86e32ac9a 100644 --- a/tests/bugs/modalg_6/bug27386_1 +++ b/tests/bugs/modalg_6/bug27386_1 @@ -33,4 +33,4 @@ checkprops r4 -s 10944.1 explode pr_1 v generated r3 sweep_hist pr_1_3 -checkprops r3 -l 130.036 +checkprops r3 -l 65.0179 diff --git a/tests/bugs/modalg_7/bug21413 b/tests/bugs/modalg_7/bug21413 index 6bf45166a0..08dc76e0e8 100644 --- a/tests/bugs/modalg_7/bug21413 +++ b/tests/bugs/modalg_7/bug21413 @@ -1,3 +1,5 @@ +puts "TODO OCC21413 ALL: bad accuracy of approximation" + puts "========" puts "OCC21413" puts "========" @@ -8,6 +10,12 @@ puts "" restore [locate_data_file bug21413_dc1_err.draw] a -tuyau result a 1 +set log [tuyau result a 1] + +regexp {Accuracy of approximation = ([0-9+-.eE]*)} $log full accuracy + +if { ${accuracy} > 0.0001} { + puts "Error: bad accuracy of approximation" +} checkview -display result -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/modalg_7/bug23942 b/tests/bugs/modalg_7/bug23942 index b528027177..59174a0cab 100644 --- a/tests/bugs/modalg_7/bug23942 +++ b/tests/bugs/modalg_7/bug23942 @@ -1,4 +1,4 @@ -puts "TODO OCC23942 ALL: is not equal" +puts "TODO OCC21413 ALL: bad accuracy of approximation" puts "========" puts "OCC23942" @@ -12,7 +12,13 @@ puts "" ### 1 # interpol c [locate_data_file bug23942_points.txt] -tuyau r_1 c 5 +set log [tuyau r_1 c 5] + +regexp {Accuracy of approximation = ([0-9+-.eE]*)} $log full accuracy + +if { ${accuracy} > 0.0001} { + puts "Error: bad accuracy of approximation" +} decho off dlog reset @@ -38,7 +44,13 @@ puts "VKnots_1 = ${VKnots_1}" # save c ${imagedir}/cc restore ${imagedir}/cc -tuyau r_2 cc 5 +set log [tuyau r_2 cc 5] + +regexp {Accuracy of approximation = ([0-9+-.eE]*)} $log full accuracy + +if { ${accuracy} > 0.0001} { + puts "Error: bad accuracy of approximation" +} decho off dlog reset