From e3096decb61c0e5b9da3233522582a0221eaabbd Mon Sep 17 00:00:00 2001 From: gka Date: Thu, 16 Jan 2014 13:11:45 +0400 Subject: [PATCH] 0024370: [Regression] 6.7.0beta ShapeFix_EdgeProjAux breaks conventions on using IsDone flag. Projection of 3d points corresponding to range of edge on 2d curve considered as successful for all cases to except for cases when projection is not made. Initialization initial values of flags Modification initial values of flags setting status Done for first and last parameters Adding new draw-command for issue CR24370 Test case for issue CR24370 --- src/QABugs/QABugs_19.cxx | 65 +++++++++++++++++++++++++++ src/ShapeFix/ShapeFix_EdgeProjAux.cxx | 43 ++++++++---------- tests/bugs/heal/bug24370 | 31 +++++++++++++ tests/de/step_3/E6 | 22 +++++---- tests/de/step_4/C9 | 9 ++-- tests/de/step_4/D1 | 9 ++-- 6 files changed, 133 insertions(+), 46 deletions(-) create mode 100755 tests/bugs/heal/bug24370 diff --git a/src/QABugs/QABugs_19.cxx b/src/QABugs/QABugs_19.cxx index 4df516c42a..241cdb2ebb 100644 --- a/src/QABugs/QABugs_19.cxx +++ b/src/QABugs/QABugs_19.cxx @@ -1428,6 +1428,70 @@ static Standard_Integer OCC24271 (Draw_Interpretor& di, return 0; } +#include +static Standard_Integer OCC24370 (Draw_Interpretor& di, Standard_Integer argc,const char ** argv) +{ + if (argc < 5) { + di<<"Usage: " << argv[0] << " invalid number of arguments"<<"\n"; + return 1; + } + + TopoDS_Shape aSh = DBRep::Get(argv[1]); + if (aSh.IsNull()) { + di << argv[0] << " Error: Null input edge\n"; + return 1; + } + const TopoDS_Edge& anEdge = TopoDS::Edge (aSh); + + Handle(Geom2d_Curve) aC = DrawTrSurf::GetCurve2d(argv[2]); + if (aC.IsNull()) { + di << argv[0] << " Error: Null input curve\n"; + return 1; + } + + Handle(Geom_Surface) aS = DrawTrSurf::GetSurface(argv[3]); + if (aS.IsNull()) { + di << argv[0] << " Error: Null input surface\n"; + return 1; + } + + Standard_Real prec = Draw::Atof(argv[4]); + + //prepare data + TopoDS_Face aFace; + BRep_Builder aB; + aB.MakeFace (aFace, aS, Precision::Confusion()); + aB.UpdateEdge (anEdge, aC, aFace, Precision::Confusion()); + aB.Range (anEdge, aFace, aC->FirstParameter(), aC->LastParameter()); + + //call algorithm + ShapeFix_EdgeProjAux aProj (aFace, anEdge); + aProj.Compute (prec); + + Standard_Boolean isfirstdone = aProj.IsFirstDone(); + Standard_Boolean islastdone = aProj.IsLastDone(); + + Standard_Real first = 0.; + Standard_Real last = 0.; + Standard_Integer isfirstdoneInteger = 0; + Standard_Integer islastdoneInteger = 0; + + + if (isfirstdone) { + first = aProj.FirstParam(); + isfirstdoneInteger = 1; + } + + if (islastdone) { + last= aProj.LastParam(); + islastdoneInteger = 1; + } + + di << isfirstdoneInteger << " "<< islastdoneInteger << " "<< first << " "<< last << " \n"; + + return 0; +} + void QABugs::Commands_19(Draw_Interpretor& theCommands) { const char *group = "QABugs"; @@ -1451,5 +1515,6 @@ void QABugs::Commands_19(Draw_Interpretor& theCommands) { theCommands.Add ("OCC24005", "OCC24005 result", __FILE__, OCC24005, group); theCommands.Add ("OCC24137", "OCC24137 face vertex U V [N]", __FILE__, OCC24137, group); theCommands.Add ("OCC24271", "Boolean operations on NCollection_Map", __FILE__, OCC24271, group); + theCommands.Add ("OCC24370", "OCC24370 edge pcurve surface prec", __FILE__, OCC24370, group); return; } diff --git a/src/ShapeFix/ShapeFix_EdgeProjAux.cxx b/src/ShapeFix/ShapeFix_EdgeProjAux.cxx index 6017ce552c..7de2afb7fc 100644 --- a/src/ShapeFix/ShapeFix_EdgeProjAux.cxx +++ b/src/ShapeFix/ShapeFix_EdgeProjAux.cxx @@ -92,7 +92,8 @@ void ShapeFix_EdgeProjAux::Compute (const Standard_Real preci) // Project Point3d on Surface // TEMPORARY Call ShapeFix_EdgeProjAux - + myFirstParam = 0.; + myLastParam = 0.; Init2d(preci); if (IsFirstDone() && IsLastDone()) { Standard_Real U1 = FirstParam(); @@ -223,14 +224,14 @@ static Standard_Boolean FindParameterWithExt (const gp_Pnt& Pt1, void ShapeFix_EdgeProjAux::Init2d (const Standard_Real preci) { - Standard_Real cl, cf; - - // Extract Geometries + Standard_Real cl = 0., cf = 0.; + // Extract Geometries + myFirstDone = myLastDone = Standard_False; Handle(Geom_Surface) theSurface = BRep_Tool::Surface(myFace); Handle(Geom2d_Curve) theCurve2d = BRep_Tool::CurveOnSurface(myEdge, myFace, cf, cl); if ( theCurve2d.IsNull() ) return; //:r5 abv 6 Apr 99: ec_turbine-A.stp, #4313 - myFirstParam = cf; - myLastParam = cl; + myFirstParam = 0.; + myLastParam = 0.; TopoDS_Vertex V1,V2; TopExp::Vertices(myEdge, V1, V2); gp_Pnt Pt1,Pt2; @@ -348,8 +349,7 @@ void ShapeFix_EdgeProjAux::Init2d (const Standard_Real preci) #endif } } - myFirstParam = cf; - myLastParam = cl; + Geom2dAdaptor_Curve CA = Geom2dAdaptor_Curve(theCurve2d,cf,cl); Handle(Geom2dAdaptor_HCurve) myHCur = new Geom2dAdaptor_HCurve(CA); @@ -360,37 +360,32 @@ void ShapeFix_EdgeProjAux::Init2d (const Standard_Real preci) // ---------------------------------------------- Standard_Real Uinf = COnS.FirstParameter(); Standard_Real Usup = COnS.LastParameter(); - myFirstDone = myLastDone = Standard_True; + Standard_Real w1 = 0., w2 = 0.; ShapeAnalysis_Curve sac; gp_Pnt pnt; Standard_Real dist = sac.Project(COnS,Pt1,preci,pnt,w1,Standard_False); //if distance is infinite then projection is not performed if( Precision::IsInfinite(dist)) - { - myFirstDone = Standard_False; - myLastDone = Standard_False; - return; - } - - if (dist > preci) return; + + myFirstDone = Standard_True; + myFirstParam = w1; + dist = sac.Project(COnS,Pt2,preci,pnt,w2,Standard_False); + if( Precision::IsInfinite(dist)) - { - myLastDone = Standard_False; - return; - } - if (dist > preci) return; + + myLastDone = Standard_True; + myLastParam = w2; + if(fabs(w1 - w2) < Precision::PConfusion()) { if(!theSurface->IsUPeriodic() && !theSurface->IsVPeriodic()) return; } - myFirstParam = w1; - myLastParam = w2; - myFirstDone = myLastDone = Standard_True; + if ( myFirstParam == Uinf && myLastParam == Usup ) return; if ( myFirstParam == Usup && myLastParam == Uinf ) { myFirstParam = theCurve2d->ReversedParameter(Usup); diff --git a/tests/bugs/heal/bug24370 b/tests/bugs/heal/bug24370 new file mode 100755 index 0000000000..3b7198e8c0 --- /dev/null +++ b/tests/bugs/heal/bug24370 @@ -0,0 +1,31 @@ +puts "============" +puts "OCC24370" +puts "============" +puts "" +################################################### +## [Regression] 6.7.0beta ShapeFix_EdgeProjAux breaks conventions on using IsDone flag +################################################### + +pload QAcommands + +restore [locate_data_file bug24370_edge.brep] edge +restore [locate_data_file bug24370_pcurve_draw] pcurve +restore [locate_data_file bug24370_surface_draw] surface +set precision 0.001 + +set info [OCC24370 edge pcurve surface ${precision}] + +set IsFirstDone [lindex ${info} 0] +set IsLastDone [lindex ${info} 1] +set First [lindex ${info} 2] +set Last [lindex ${info} 3] + +set expected_First 0 +set tol_abs_First 1.0e-03 +set tol_rel_First 0.01 +checkreal "First" ${First} ${expected_First} ${tol_abs_First} ${tol_rel_First} + +set expected_Last 1 +set tol_abs_Last 1.0e-03 +set tol_rel_Last 0.01 +checkreal "Last" ${Last} ${expected_Last} ${tol_abs_Last} ${tol_rel_Last} diff --git a/tests/de/step_3/E6 b/tests/de/step_3/E6 index a53ef232cc..fd92d4f154 100644 --- a/tests/de/step_3/E6 +++ b/tests/de/step_3/E6 @@ -1,13 +1,11 @@ # !!!! This file is generated automatically, do not edit manually! See end script -puts "TODO ?CR23096 ALL: TPSTAT : Faulty" -puts "TODO ?CR23096 ALL: CHECKSHAPE : Faulty" -puts "TODO ?CR23096 ALL: STATSHAPE : Faulty" -puts "TODO ?CR23096 ALL: TOLERANCE : Faulty" -puts "TODO DEBUG_OCC24121 Debian60-64 Windows: Error: ShapeFix_ComposeShell" -puts "TODO ?DEBUG_OCC24121 Windows: Error : 3 differences with reference data found" -puts "TODO ?CR23096 Mandriva2010: Error : 3 differences with reference data found :" -puts "TODO ?DEBUG_OCC24121 Debian60-64 Windows: Process killed by CPU limit" -puts "TODO ?DEBUG_OCC24121 Debian60-64 Windows: TEST INCOMPLETE" +puts "TODO CR23096 ALL: TPSTAT : Faulty" +puts "TODO CR23096 ALL: CHECKSHAPE : Faulty" +puts "TODO CR23096 ALL: STATSHAPE : Faulty" +puts "TODO CR23096 ALL: TOLERANCE : Faulty" + + +puts "TODO CR23096 Mandriva2010: Error : 3 differences with reference data found :" set LinuxDiff 3 set filename Z8M6SAT.stp @@ -16,9 +14,9 @@ set ref_data { DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 ) TPSTAT : Faulties = 3 ( 0 ) Warnings = 961 ( 3138 ) Summary = 964 ( 3138 ) CHECKSHAPE : Wires = 51 ( 48 ) Faces = 45 ( 47 ) Shells = 0 ( 5 ) Solids = 0 ( 0 ) -NBSHAPES : Solid = 28 ( 28 ) Shell = 773 ( 38 ) Face = 3248 ( 3247 ) Summary = 29520 ( 28710 ) -STATSHAPE : Solid = 28 ( 28 ) Shell = 773 ( 38 ) Face = 3248 ( 3247 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 12674 ( 12611 ) -TOLERANCE : MaxTol = 40.73070494 ( 20.46526799 ) AvgTol = 0.03573666428 ( 0.03196816114 ) +NBSHAPES : Solid = 28 ( 28 ) Shell = 773 ( 38 ) Face = 3248 ( 3247 ) Summary = 29514 ( 28710 ) +STATSHAPE : Solid = 28 ( 28 ) Shell = 773 ( 38 ) Face = 3248 ( 3247 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 12670 ( 12611 ) +TOLERANCE : MaxTol = 40.73070494 ( 20.46526799 ) AvgTol = 0.0357431243 ( 0.03196816114 ) LABELS : N0Labels = 3 ( 3 ) N1Labels = 2 ( 2 ) N2Labels = 0 ( 0 ) TotalLabels = 5 ( 5 ) NameLabels = 5 ( 5 ) ColorLabels = 0 ( 0 ) LayerLabels = 0 ( 0 ) PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 ) NCOLORS : NColors = 0 ( 0 ) diff --git a/tests/de/step_4/C9 b/tests/de/step_4/C9 index df1b00cd26..244eed388e 100644 --- a/tests/de/step_4/C9 +++ b/tests/de/step_4/C9 @@ -1,14 +1,13 @@ # !!!! This file is generated automatically, do not edit manually! See end script - set filename db_exhaust-A.stp set ref_data { DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 ) -TPSTAT : Faulties = 0 ( 0 ) Warnings = 7 ( 6 ) Summary = 7 ( 6 ) +TPSTAT : Faulties = 0 ( 0 ) Warnings = 4 ( 6 ) Summary = 4 ( 6 ) CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 ) -NBSHAPES : Solid = 3 ( 3 ) Shell = 3 ( 3 ) Face = 41 ( 41 ) Summary = 617 ( 612 ) -STATSHAPE : Solid = 3 ( 3 ) Shell = 3 ( 3 ) Face = 41 ( 41 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 280 ( 275 ) -TOLERANCE : MaxTol = 0.003575257609 ( 0.01715433608 ) AvgTol = 0.0001880674778 ( 0.001318475802 ) +NBSHAPES : Solid = 3 ( 3 ) Shell = 3 ( 3 ) Face = 41 ( 41 ) Summary = 612 ( 612 ) +STATSHAPE : Solid = 3 ( 3 ) Shell = 3 ( 3 ) Face = 41 ( 41 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 275 ( 275 ) +TOLERANCE : MaxTol = 0.0039188913 ( 0.01715433608 ) AvgTol = 0.0004030761357 ( 0.001357501264 ) LABELS : N0Labels = 1 ( 1 ) N1Labels = 3 ( 3 ) N2Labels = 0 ( 0 ) TotalLabels = 4 ( 4 ) NameLabels = 1 ( 1 ) ColorLabels = 3 ( 3 ) LayerLabels = 3 ( 3 ) PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 ) NCOLORS : NColors = 1 ( 1 ) diff --git a/tests/de/step_4/D1 b/tests/de/step_4/D1 index 2a233170e2..4c1d9d2663 100644 --- a/tests/de/step_4/D1 +++ b/tests/de/step_4/D1 @@ -1,14 +1,13 @@ # !!!! This file is generated automatically, do not edit manually! See end script - set filename db_exhaust-B.stp set ref_data { DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 ) -TPSTAT : Faulties = 0 ( 0 ) Warnings = 7 ( 6 ) Summary = 7 ( 6 ) +TPSTAT : Faulties = 0 ( 0 ) Warnings = 4 ( 6 ) Summary = 4 ( 6 ) CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 ) -NBSHAPES : Solid = 3 ( 3 ) Shell = 3 ( 3 ) Face = 41 ( 41 ) Summary = 617 ( 612 ) -STATSHAPE : Solid = 3 ( 3 ) Shell = 3 ( 3 ) Face = 41 ( 41 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 280 ( 275 ) -TOLERANCE : MaxTol = 0.003575257609 ( 0.01715433608 ) AvgTol = 0.0001880692499 ( 0.00131847759 ) +NBSHAPES : Solid = 3 ( 3 ) Shell = 3 ( 3 ) Face = 41 ( 41 ) Summary = 612 ( 612 ) +STATSHAPE : Solid = 3 ( 3 ) Shell = 3 ( 3 ) Face = 41 ( 41 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 275 ( 275 ) +TOLERANCE : MaxTol = 0.0039188913 ( 0.01715433608 ) AvgTol = 0.0004030779235 ( 0.001357503052 ) LABELS : N0Labels = 1 ( 1 ) N1Labels = 3 ( 3 ) N2Labels = 0 ( 0 ) TotalLabels = 4 ( 4 ) NameLabels = 1 ( 1 ) ColorLabels = 3 ( 3 ) LayerLabels = 3 ( 3 ) PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 ) NCOLORS : NColors = 1 ( 1 )