0022240: Bad triangulation of transformed shapes
authorazn <azn@opencascade.com>
Thu, 29 May 2014 11:39:04 +0000 (15:39 +0400)
committerapn <apn@opencascade.com>
Thu, 29 May 2014 11:40:25 +0000 (15:40 +0400)
Correction of out transformation for the curves on plane surface.
Added test case bugs/vis/bug22240
Modified test cases according to new behavior.

src/BRep/BRep_Tool.cxx
tests/bugs/modalg_2/bug22196
tests/bugs/vis/bug22240 [new file with mode: 0644]
tests/de/iges_2/F4

index 27118a6..ac3875e 100644 (file)
@@ -314,40 +314,42 @@ Handle(Geom2d_Curve) BRep_Tool::CurveOnSurface(const TopoDS_Edge& E,
     GP = Handle(Geom_Plane)::DownCast(S);
   //fin modif du 21-05-97
 
-  if (!GP.IsNull()) {
-
+  if (!GP.IsNull())
+  {
     Handle(GeomAdaptor_HCurve) HC;
     Handle(GeomAdaptor_HSurface) HS;
 
     HC = new GeomAdaptor_HCurve();
     HS = new GeomAdaptor_HSurface();
 
-    TopLoc_Location LC;
+    TopLoc_Location aCurveLocation;
 
     Standard_Real f, l;// for those who call with (u,u).
-    Handle(Geom_Curve) C3d =
-      BRep_Tool::Curve(E,/*LC,*/f,l); // transforming plane instead of curve
-    // we can loose scale factor of Curve transformation (eap 13 May 2002)
+    Handle(Geom_Curve) C3d = BRep_Tool::Curve(E, aCurveLocation, f, l);
 
-    LC = L/*.Predivided(LC)*/;
+    if (C3d.IsNull())
+    {
+      return nullPCurve;
+    }
 
-    if (C3d.IsNull()) return nullPCurve;
+    aCurveLocation = L.Predivided(aCurveLocation);
 
     Handle(Geom_Plane) Plane = GP;
-    if (!LC.IsIdentity()) {
-      const gp_Trsf& T = LC.Transformation();
+    if (!aCurveLocation.IsIdentity())
+    {
+      const gp_Trsf& T = aCurveLocation.Transformation();
       Handle(Geom_Geometry) GPT = GP->Transformed(T);
       Plane = *((Handle(Geom_Plane)*)&GPT);
     }
     GeomAdaptor_Surface& GAS = HS->ChangeSurface();
     GAS.Load(Plane);
-    
+
     Handle(Geom_Curve) ProjOnPlane = 
       GeomProjLib::ProjectOnPlane(new Geom_TrimmedCurve(C3d,f,l),
                                   Plane,
                                   Plane->Position().Direction(),
                                   Standard_True);
-    
+
     GeomAdaptor_Curve& GAC = HC->ChangeCurve();
     GAC.Load(ProjOnPlane);
 
index be2cd23..257a1e9 100755 (executable)
@@ -12,7 +12,7 @@ set BugNumber OCC22196
 
 restore [locate_data_file OCC22196-scaled.brep] result
 
-set square 147.003
+set square 148.902
 
 set nb_v_good 75
 set nb_e_good 157
diff --git a/tests/bugs/vis/bug22240 b/tests/bugs/vis/bug22240
new file mode 100644 (file)
index 0000000..c243c48
--- /dev/null
@@ -0,0 +1,21 @@
+puts "==========="
+puts "OCC22240"
+puts "==========="
+puts ""
+############################################
+# Bad triangulation of transformed shapes
+############################################
+
+restore [locate_data_file bug22240_Pump_Nut.brep] a
+restore [locate_data_file bug22240_Pump_Nut.brep] b
+bscale b 0 0 0 2.
+vinit
+vdisplay a b
+vsetdispmode a 1
+vsetdispmode b 1
+vfit
+
+checkcolor 320 104 0.78 0.55 0.09
+
+set only_screen 1
+
index f6f8c07..2bff558 100755 (executable)
@@ -14,8 +14,8 @@ set ref_data {
 DATA        : Faulties = 0  ( 0 )  Warnings = 0  ( 0 )  Summary  = 0  ( 0 )
 TPSTAT      : Faulties = 30  ( 36 )  Warnings = 570  ( 1854 )  Summary  = 600  ( 1890 )
 CHECKSHAPE  : Wires    = 7  ( 6 )  Faces    = 7  ( 6 )  Shells   = 0  ( 0 )   Solids   = 0 ( 0 )
-NBSHAPES    : Solid    = 0  ( 0 )  Shell    = 0  ( 0 )  Face     = 3500  ( 3499 )   Summary  = 43166  ( 43109 )
-STATSHAPE   : Solid    = 0  ( 0 )  Shell    = 0  ( 0 )  Face     = 3500  ( 3499 )   FreeWire = 0  ( 0 )   FreeEdge  = 164 ( 164 )   SharedEdge = 18147  ( 18117 )
+NBSHAPES    : Solid    = 0  ( 0 )  Shell    = 0  ( 0 )  Face     = 3500  ( 3499 )   Summary  = 43162  ( 43109 )
+STATSHAPE   : Solid    = 0  ( 0 )  Shell    = 0  ( 0 )  Face     = 3500  ( 3499 )   FreeWire = 0  ( 0 )   FreeEdge  = 164 ( 164 )   SharedEdge = 18145  ( 18117 )
 TOLERANCE   : MaxTol   =   0.9816000285  (    5.284023931 )  AvgTol   =   0.02459126458  (   0.02803193293 )
 LABELS      : N0Labels = 12  ( 30 )  N1Labels = 3661  ( 3666 )  N2Labels = 0  ( 0 )   TotalLabels = 3673  ( 3696 )   NameLabels = 1379  ( 3694 )   ColorLabels = 3661  ( 3662 )   LayerLabels = 0  ( 0 )
 PROPS       : Centroid = 0  ( 0 )  Volume   = 0  ( 0 )  Area     = 0  ( 0 )