]> OCCT Git - occt-copy.git/commitdiff
0024055: Reading a STEP file produces invalid shape
authorika <ika@opencascade.com>
Thu, 29 May 2014 12:43:38 +0000 (16:43 +0400)
committerapn <apn@opencascade.com>
Thu, 29 May 2014 12:44:57 +0000 (16:44 +0400)
Add checks for cone-like surfaces during seam fixing
Delete check for missing degenerated edge for cones in FixMissingSeam() function, because this check is exist in FixPeriodicDegenerated(). Check for uniqueness of wire is unnecessary after this.
Update of test-cases

src/ShapeFix/ShapeFix_Face.cxx
tests/bugs/iges/bug23622_1
tests/bugs/iges/bug23622_2
tests/bugs/step/bug24055
tests/de/step_4/H6

index 40467ab24a93ab3f8a19e061603b9178d832c9bc..bcac2ebe375b32a42193457e18ecb6fb71523a19 100644 (file)
@@ -1584,31 +1584,63 @@ Standard_Boolean ShapeFix_Face::FixMissingSeam()
 
   BRep_Builder B;
   if ( w1.IsNull() ) return Standard_False;
-  else if ( w2.IsNull() ) {
-    // WARNING!!! Temporarily for spheres only: 
-    // If only one of wires limiting face on sphere is open in 2d,
-    // this means that degenerated edge should be added to one of poles, and
+  else if ( w2.IsNull()) {
+    // For spheres and BSpline cone-like surfaces(bug 24055):
+    // If only one of wires limiting face on surface is open in 2d,
+    // this may means that degenerated edge should be added, and
     // then usual procedure applied
+    gp_Pnt2d p;
+    gp_Dir2d d;
+    Standard_Real aRange;
+
     if ( ismodeu && mySurf->Surface()->IsKind(STANDARD_TYPE(Geom_SphericalSurface)) ) {
-      gp_Pnt2d p ( ( ismodeu < 0 ? 0. : 2.*M_PI ), ismodeu * 0.5 * M_PI );
-      gp_Dir2d d ( -ismodeu, 0. );
-      Handle(Geom2d_Line) line = new Geom2d_Line ( p, d );
-      TopoDS_Edge edge;
-      B.MakeEdge ( edge );
-      B.Degenerated ( edge, Standard_True );
-      B.UpdateEdge ( edge, line, myFace, ::Precision::Confusion() );
-      B.Range ( edge, myFace, 0., 2*M_PI );
-      TopoDS_Vertex V;
-      B.MakeVertex ( V, mySurf->Value ( p.X(), p.Y() ), ::Precision::Confusion() );
-      V.Orientation(TopAbs_FORWARD);
-      B.Add(edge,V);
-      V.Orientation(TopAbs_REVERSED);
-      B.Add(edge,V);
-      B.MakeWire ( w2 );
-      B.Add ( w2, edge );
-      ws.Append ( w2 );
+      p.SetCoord ( ( ismodeu < 0 ? 0. : 2.*M_PI ), ismodeu * 0.5 * M_PI );
+      Standard_Real aXCoord = -ismodeu;
+      d.SetCoord ( aXCoord, 0.);
+      aRange = 2.*M_PI;
+    }
+    else if ( ismodev && mySurf->Surface()->IsKind(STANDARD_TYPE(Geom_BSplineSurface))) {
+      Standard_Real uCoord;
+      if (mySurf->Value(SUF, SVF).Distance(mySurf->Value(SUF, (SVF + SVL) / 2)) < ::Precision::Confusion())
+        uCoord = SUF;
+      else if (mySurf->Value(SUL, SVF).Distance(mySurf->Value(SUL, (SVF + SVL) / 2)) < ::Precision::Confusion())
+        uCoord = SUL;
+      else return Standard_False;
+
+      p.SetCoord ( uCoord, ( ismodev < 0 ? 0. : VRange ) );
+      d.SetCoord ( 0., -ismodev);
+      aRange = VRange;
+    }
+    else if ( ismodeu && mySurf->Surface()->IsKind(STANDARD_TYPE(Geom_BSplineSurface))) {
+      Standard_Real vCoord;
+      if (mySurf->Value(SUF, SVF).Distance(mySurf->Value((SUF + SUL) / 2, SVF)) < ::Precision::Confusion())
+        vCoord = SVF;
+      else if (mySurf->Value(SUL, SVL).Distance(mySurf->Value((SUF + SUL) / 2, SVL)) < ::Precision::Confusion())
+        vCoord = SVL;
+      else return Standard_False;
+
+      p.SetCoord ( ( ismodeu < 0 ? 0. : URange ), vCoord );
+      Standard_Real aXCoord = -ismodeu;
+      d.SetCoord ( aXCoord, 0.);
+      aRange = URange;
     }
     else return Standard_False;
+
+    Handle(Geom2d_Line) line = new Geom2d_Line ( p, d );
+    TopoDS_Edge edge;
+    B.MakeEdge ( edge );
+    B.Degenerated ( edge, Standard_True );
+    B.UpdateEdge ( edge, line, myFace, ::Precision::Confusion() );
+    B.Range ( edge, myFace, 0., aRange );
+    TopoDS_Vertex V;
+    B.MakeVertex ( V, mySurf->Value ( p.X(), p.Y() ), ::Precision::Confusion() );
+    V.Orientation(TopAbs_FORWARD);
+    B.Add(edge,V);
+    V.Orientation(TopAbs_REVERSED);
+    B.Add(edge,V);
+    B.MakeWire ( w2 );
+    B.Add ( w2, edge );
+    ws.Append ( w2 );
   }
   
   // sort original wires
@@ -1724,7 +1756,7 @@ Standard_Boolean ShapeFix_Face::FixMissingSeam()
     }
     Standard_Boolean skipV = ! vclosed;
     if ( vclosed && ! ismodeu ) {
-      pos1.SetY ( pos1.Y() + ShapeAnalysis::AdjustByPeriod ( pos1.Y(), SVF, URange ) );
+      pos1.SetY ( pos1.Y() + ShapeAnalysis::AdjustByPeriod ( pos1.Y(), SVF, VRange ) );
       if ( foundV ==2 && Abs ( pos1.Y() ) > Abs(vf) ) skipV = Standard_True;
       else if ( ! foundV || ( foundV ==1 && Abs ( pos1.Y() ) < Abs(vf) ) ) {
        foundV = 1;
index 2d6890fef48d67412d58a2a13909e9a34e497163..dacbcf010ba6b79683b0ac3a6d15ccbeb3a17718 100755 (executable)
@@ -12,15 +12,15 @@ renamevar s1_1 result
 
 nbshapes result
 
-set nb_v_good 4
-set nb_e_good 5
+set nb_v_good 2
+set nb_e_good 3
 set nb_w_good 1
 set nb_f_good 1
 set nb_sh_good 0
 set nb_sol_good 0
 set nb_compsol_good 0
 set nb_compound_good 0
-set nb_shape_good 11
+set nb_shape_good 7
 
 set tol [tolerance result ]
 regexp { *Tolerance +MAX=([-0-9.+eE]+)} ${tol} full max_tol
index d5973988b47aa7252c8c18cf9df09ab0776a79f4..1fc0c589890120ae9182589f557e42985f2c22b0 100755 (executable)
@@ -14,15 +14,15 @@ renamevar s1_1 result
 
 nbshapes result
 
-set nb_v_good 4
-set nb_e_good 5
+set nb_v_good 2
+set nb_e_good 3
 set nb_w_good 1
 set nb_f_good 1
 set nb_sh_good 0
 set nb_sol_good 0
 set nb_compsol_good 0
 set nb_compound_good 0
-set nb_shape_good 11
+set nb_shape_good 7
 
 set tol [tolerance result ]
 regexp { *Tolerance +MAX=([-0-9.+eE]+)} ${tol} full max_tol
index 04aa2528d7e73f85e883e563298aa91b5ae7812a..11f21c6d9daee149a399e323453572be8d96ba59 100644 (file)
@@ -1,5 +1,3 @@
-puts "TODO OCC24055 Debian60-64 Windows: Faulty shapes in variables faulty_1 to faulty_"
-
 puts "============"
 puts "OCC24055"
 puts "============"
index c7a246137b03b3043afd260d29fbe874462b4578..f3a3a43215fc9e2bcc618da5261dee01ac097351 100644 (file)
@@ -5,9 +5,9 @@ set ref_data {
 DATA        : Faulties = 0  ( 0 )  Warnings = 0  ( 0 )  Summary  = 0  ( 0 )
 TPSTAT      : Faulties = 0  ( 0 )  Warnings = 137  ( 225 )  Summary  = 137  ( 225 )
 CHECKSHAPE  : Wires    = 2  ( 2 )  Faces    = 2  ( 2 )  Shells   = 0  ( 0 )   Solids   = 0 ( 0 )
-NBSHAPES    : Solid    = 1  ( 1 )  Shell    = 1  ( 1 )  Face     = 1026  ( 1026 )   Summary  = 6942  ( 6942 )
-STATSHAPE   : Solid    = 1  ( 1 )  Shell    = 1  ( 1 )  Face     = 1026  ( 1026 )   FreeWire = 0  ( 0 )   FreeEdge  = 0 ( 0 )   SharedEdge = 2940  ( 2940 )
-TOLERANCE   : MaxTol   =    7.063803693  (    7.063803693 )  AvgTol   =  0.004074972268  (  0.004152493478 )
+NBSHAPES    : Solid    = 1  ( 1 )  Shell    = 1  ( 1 )  Face     = 1026  ( 1026 )   Summary  = 6914  ( 6914 )
+STATSHAPE   : Solid    = 1  ( 1 )  Shell    = 1  ( 1 )  Face     = 1026  ( 1026 )   FreeWire = 0  ( 0 )   FreeEdge  = 0 ( 0 )   SharedEdge = 2926  ( 2926 )
+TOLERANCE   : MaxTol   =    7.063803693  (    7.063803693 )  AvgTol   =  0.004095376603  (  0.004135679611 )
 LABELS      : N0Labels = 1  ( 1 )  N1Labels = 0  ( 0 )  N2Labels = 0  ( 0 )   TotalLabels = 1  ( 1 )   NameLabels = 1  ( 1 )   ColorLabels = 1  ( 1 )   LayerLabels = 0  ( 0 )
 PROPS       : Centroid = 0  ( 0 )  Volume   = 0  ( 0 )  Area     = 0  ( 0 )
 NCOLORS     : NColors  = 1  ( 1 )