Salome HOME
Dump Python in the High Level Parameterized Geometry API (issue #1648)
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_EdgeBuilder.cpp
index 9089c195acb506840861956f8605354930fdaf2e..360f46bd2b850f90febbc136e831fbff247bde36 100644 (file)
@@ -36,6 +36,23 @@ std::shared_ptr<GeomAPI_Edge> GeomAlgoAPI_EdgeBuilder::line(
   aRes->setImpl(new TopoDS_Shape(anEdge));
   return aRes;
 }
+std::shared_ptr<GeomAPI_Edge> GeomAlgoAPI_EdgeBuilder::line(                                                            
+    double theDX, double theDY, double theDZ)
+{
+  
+  const gp_Pnt& aStart = gp_Pnt(0, 0, 0);
+  const gp_Pnt& anEnd = gp_Pnt(theDX, theDY, theDZ);
+
+  if (aStart.IsEqual(anEnd, Precision::Confusion()))
+    return std::shared_ptr<GeomAPI_Edge>();
+  if (Abs(aStart.SquareDistance(anEnd)) > 1.e+100)
+    return std::shared_ptr<GeomAPI_Edge>();
+  BRepBuilderAPI_MakeEdge anEdgeBuilder(aStart, anEnd);
+  std::shared_ptr<GeomAPI_Edge> aRes(new GeomAPI_Edge);
+  TopoDS_Edge anEdge = anEdgeBuilder.Edge();
+  aRes->setImpl(new TopoDS_Shape(anEdge));
+  return aRes;
+}
 
 std::shared_ptr<GeomAPI_Edge> GeomAlgoAPI_EdgeBuilder::cylinderAxis(
     std::shared_ptr<GeomAPI_Shape> theCylindricalFace)
@@ -147,10 +164,7 @@ std::shared_ptr<GeomAPI_Edge> GeomAlgoAPI_EdgeBuilder::lineCircleArc(
   const gp_Pnt& anEnd = theEndPoint->impl<gp_Pnt>();
 
   BRepBuilderAPI_MakeEdge anEdgeBuilder;
-  if (aStart.IsEqual(anEnd, Precision::Confusion()))
-    anEdgeBuilder = BRepBuilderAPI_MakeEdge(aCircle);
-  else
-    anEdgeBuilder = BRepBuilderAPI_MakeEdge(aCircle, aStart, anEnd);
+  anEdgeBuilder = BRepBuilderAPI_MakeEdge(aCircle, aStart, anEnd);
 
   anEdgeBuilder.Build();