0026288: Offset on faces with opposite orientation
authorisn <isn@opencascade.com>
Thu, 10 Sep 2015 13:21:32 +0000 (16:21 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 10 Sep 2015 13:22:45 +0000 (16:22 +0300)
Test-case for issue #26288

src/BRepOffset/BRepOffset_Offset.cxx
tests/bugs/modalg_6/bug26288 [new file with mode: 0644]

index 05bf9b8..878b30a 100644 (file)
@@ -45,6 +45,8 @@
 #include <Geom_OffsetSurface.hxx>
 #include <Geom_RectangularTrimmedSurface.hxx>
 #include <Geom_SphericalSurface.hxx>
+#include <Geom_SurfaceOfLinearExtrusion.hxx>
+#include <Geom_SurfaceOfRevolution.hxx>
 #include <Geom_Surface.hxx>
 #include <Geom_TrimmedCurve.hxx>
 #include <GeomAdaptor_Curve.hxx>
@@ -495,12 +497,20 @@ void BRepOffset_Offset::Init(const TopoDS_Face&                  Face,
 
   TopLoc_Location L;
   Handle(Geom_Surface) S = BRep_Tool::Surface(Face,L);
-
   // On detrime les surfaces, evite des recopies dans les extensions.
   Handle(Geom_RectangularTrimmedSurface) RT = 
     Handle(Geom_RectangularTrimmedSurface)::DownCast(S);
   if (!RT.IsNull()) S = RT->BasisSurface();
-
+  Standard_Boolean IsTransformed = Standard_False;
+  if ((S->IsKind(STANDARD_TYPE(Geom_BSplineSurface)) || 
+      S->IsKind(STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion)) ||
+      S->IsKind(STANDARD_TYPE(Geom_SurfaceOfRevolution)) ||
+      S->IsKind(STANDARD_TYPE(Geom_OffsetSurface))) && !L.IsIdentity())
+  {
+    S = Handle(Geom_Surface)::DownCast(S->Copy());
+    S->Transform(L.Transformation());
+    IsTransformed = Standard_True;
+  }
   // particular case of cone
   Handle(Geom_ConicalSurface) Co;
   Co = Handle(Geom_ConicalSurface)::DownCast(S);
@@ -786,7 +796,10 @@ void BRepOffset_Offset::Init(const TopoDS_Face&                  Face,
 
   BRep_Builder myBuilder;
   myBuilder.MakeFace(myFace);
-  myBuilder.UpdateFace(myFace,TheSurf,L,BRep_Tool::Tolerance(Face));
+  if  (!IsTransformed)
+    myBuilder.UpdateFace(myFace,TheSurf, L, BRep_Tool::Tolerance(Face));
+  else
+    myBuilder.UpdateFace(myFace,TheSurf, TopLoc_Location(), BRep_Tool::Tolerance(Face));
 
   TopTools_DataMapOfShapeShape MapSS;
 
@@ -870,7 +883,8 @@ void BRepOffset_Offset::Init(const TopoDS_Face&                  Face,
        else
          {
            TheSurf->D0(P2d1.X(),P2d1.Y(),P1);
-           P1.Transform(L.Transformation());
+           if (!L.IsIdentity() && !IsTransformed)
+             P1.Transform(L.Transformation());
            vstart = P2d1.Y();
          }
        if (VonDegen.Contains(V2))
@@ -887,7 +901,8 @@ void BRepOffset_Offset::Init(const TopoDS_Face&                  Face,
        else
          {
            TheSurf->D0(P2d2.X(),P2d2.Y(),P2);
-           P2.Transform(L.Transformation());
+           if (!L.IsIdentity() && !IsTransformed)
+             P2.Transform(L.Transformation());
            vend = P2d2.Y();
          }
        // E a-t-il ume image dans la Map des Created ?
diff --git a/tests/bugs/modalg_6/bug26288 b/tests/bugs/modalg_6/bug26288
new file mode 100644 (file)
index 0000000..4e48457
--- /dev/null
@@ -0,0 +1,18 @@
+puts "========"
+puts "OCC26288"
+puts "========"
+puts ""
+#############################################
+# Offset on faces with opposite orientation
+#############################################
+
+smallview
+
+restore [locate_data_file OCC26288-plate.brep] plate
+
+offsetparameter 1e-7 p i
+offsetload plate 160
+offsetperform r
+fit
+
+set only_screen_axo 1