1 // File: GeomAlgoAPI_EdgeBuilder.cpp
2 // Created: 23 Apr 2014
3 // Author: Mikhail PONIKAROV
5 #include <GeomAlgoAPI_EdgeBuilder.h>
7 #include <BRepBuilderAPI_MakeEdge.hxx>
8 #include <TopoDS_Edge.hxx>
10 #include <BRep_Tool.hxx>
11 #include <Geom_Plane.hxx>
13 boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_EdgeBuilder::line(
14 boost::shared_ptr<GeomAPI_Pnt> theStart, boost::shared_ptr<GeomAPI_Pnt> theEnd)
16 const gp_Pnt& aStart = theStart->impl<gp_Pnt>();
17 const gp_Pnt& anEnd = theEnd->impl<gp_Pnt>();
19 if (aStart.IsEqual(anEnd, Precision::Confusion()))
20 return boost::shared_ptr<GeomAPI_Shape>();
21 if (Abs(aStart.SquareDistance(anEnd)) > 1.e+100)
22 return boost::shared_ptr<GeomAPI_Shape>();
23 BRepBuilderAPI_MakeEdge anEdgeBuilder(aStart, anEnd);
24 boost::shared_ptr<GeomAPI_Shape> aRes(new GeomAPI_Shape);
25 TopoDS_Edge anEdge = anEdgeBuilder.Edge();
26 aRes->setImpl(new TopoDS_Shape(anEdge));