]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.cpp
Salome HOME
refs #80 - Sketch base GUI: create/draw point, circle and arc
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_EdgeBuilder.cpp
index 2cc821e39fc26a8d52a3103a0fa3adf923b379ed..57afd7a6956fb9ae7c033c9997e72a4441a67529 100644 (file)
@@ -10,6 +10,9 @@
 #include <BRep_Tool.hxx>
 #include <Geom_Plane.hxx>
 
+#include <gp_Ax2.hxx>
+#include <gp_Circ.hxx>
+
 boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_EdgeBuilder::line(
   boost::shared_ptr<GeomAPI_Pnt> theStart, boost::shared_ptr<GeomAPI_Pnt> theEnd)
 {
@@ -26,3 +29,19 @@ boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_EdgeBuilder::line(
   aRes->setImpl(new TopoDS_Shape(anEdge));
   return aRes;
 }
+
+boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_EdgeBuilder::lineCircle(
+    boost::shared_ptr<GeomAPI_Pnt> theCenter,
+    boost::shared_ptr<GeomAPI_Dir> theNormal, double theRadius)
+{
+  const gp_Pnt& aCenter = theCenter->impl<gp_Pnt>();
+  const gp_Dir& aDir = theNormal->impl<gp_Dir>();
+
+  gp_Circ aCircle(gp_Ax2(aCenter, aDir), theRadius);
+
+  BRepBuilderAPI_MakeEdge anEdgeBuilder(aCircle);
+  boost::shared_ptr<GeomAPI_Shape> aRes(new GeomAPI_Shape);
+  TopoDS_Edge anEdge = anEdgeBuilder.Edge();
+  aRes->setImpl(new TopoDS_Shape(anEdge));
+  return aRes;
+}