Salome HOME
[bos #40619][CEA] Add Fuzzy parameter to partition and boolean operators
[modules/geom.git] / src / GEOMImpl / GEOMImpl_DiskDriver.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 63a21d8..5836c16
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -41,6 +41,7 @@
 
 #include <Standard_ConstructionError.hxx>
 #include <Precision.hxx>
+#include <gp_Pln.hxx>
 #include <gp_Pnt.hxx>
 #include <gp_Vec.hxx>
 #include <gp_Circ.hxx>
@@ -68,7 +69,7 @@ GEOMImpl_DiskDriver::GEOMImpl_DiskDriver()
 //function : Execute
 //purpose  :
 //======================================================================= 
-Standard_Integer GEOMImpl_DiskDriver::Execute(TFunction_Logbook& log) const
+Standard_Integer GEOMImpl_DiskDriver::Execute(Handle(TFunction_Logbook)& log) const
 {
   if (Label().IsNull()) return 0;    
   Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
@@ -91,12 +92,15 @@ Standard_Integer GEOMImpl_DiskDriver::Execute(TFunction_Logbook& log) const
       TopExp::Vertices(anE, V1, V2, Standard_True);
       if (!V1.IsNull() && !V2.IsNull()) {
         gp_Vec aV (BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2));
-        gp_Ax2 anAxes (aP, -aV);
-        gp_Circ aCirc (anAxes, aCI.GetRadius());
+        gp_Ax2 anAxes (aP, aV);
+        gp_Ax3 anAxes3(anAxes);
+        gp_Pln aPln(anAxes3);
+        gp_Ax2 anAxes1(aP, -aV);
+        gp_Circ aCirc (anAxes1, aCI.GetRadius());
         TopoDS_Shape aCircle = BRepBuilderAPI_MakeEdge(aCirc).Edge();
         BRepBuilderAPI_MakeWire MW;
         MW.Add(TopoDS::Edge(aCircle));
-        BRepBuilderAPI_MakeFace MF (MW, Standard_False);
+        BRepBuilderAPI_MakeFace MF (aPln, MW);
         aShape = MF.Shape();
       }
     }
@@ -121,10 +125,14 @@ Standard_Integer GEOMImpl_DiskDriver::Execute(TFunction_Logbook& log) const
       if (gp_Vec(aP1, aP2).IsParallel(gp_Vec(aP1, aP3), Precision::Angular()))
         Standard_ConstructionError::Raise("Disk creation aborted: points lay on one line");
       Handle(Geom_Circle) aCirc = GC_MakeCircle(aP3, aP2, aP1).Value();
+      gp_Circ aGpCirc = aCirc->Circ();
+      gp_Ax2 anAxes = aGpCirc.Position();
+      gp_Ax3 anAxes3(anAxes.Location(), -anAxes.Direction());
+      gp_Pln aPln(anAxes3);
       TopoDS_Shape aCircle = BRepBuilderAPI_MakeEdge(aCirc).Edge();
       BRepBuilderAPI_MakeWire MW;
       MW.Add(TopoDS::Edge(aCircle));
-      BRepBuilderAPI_MakeFace MF (MW, Standard_False);
+      BRepBuilderAPI_MakeFace MF (aPln, MW);
       aShape = MF.Shape();
     }  
   }
@@ -139,12 +147,15 @@ Standard_Integer GEOMImpl_DiskDriver::Execute(TFunction_Logbook& log) const
     else if (anOrient == 3)
       aV = gp::DY();
 
-    gp_Ax2 anAxes (aP, -aV);
-    gp_Circ aCirc (anAxes, aCI.GetRadius());
+    gp_Ax2 anAxes (aP, aV);
+    gp_Ax2 anAxes1(aP, -aV);
+    gp_Ax3 anAxes3(anAxes);
+    gp_Pln aPln(anAxes3);
+    gp_Circ aCirc (anAxes1, aCI.GetRadius());
     TopoDS_Shape aCircle = BRepBuilderAPI_MakeEdge(aCirc).Edge();
     BRepBuilderAPI_MakeWire MW;
     MW.Add(TopoDS::Edge(aCircle));
-    BRepBuilderAPI_MakeFace MF (MW, Standard_False);
+    BRepBuilderAPI_MakeFace MF (aPln, MW);
     aShape = MF.Shape();
   }
    else {
@@ -154,7 +165,7 @@ Standard_Integer GEOMImpl_DiskDriver::Execute(TFunction_Logbook& log) const
 
   aFunction->SetValue(aShape);
 
-  log.SetTouched(Label()); 
+  log->SetTouched(Label());
 
   return 1;    
 }
@@ -198,6 +209,5 @@ GetCreationInformation(std::string&             theOperationName,
   
   return true;
 }
-IMPLEMENT_STANDARD_HANDLE (GEOMImpl_DiskDriver,GEOM_BaseDriver);
 
-IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_DiskDriver,GEOM_BaseDriver);
+IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_DiskDriver,GEOM_BaseDriver)