]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/GeomAPI/GeomAPI_Pnt.cpp
Salome HOME
External edges for sketch: lines and circles
[modules/shaper.git] / src / GeomAPI / GeomAPI_Pnt.cpp
index 0455c15134d64eff166f37bdff38ccc3498053e2..aae0d1b8b03ebc64b9d29006e9b0c0489b4b5beb 100644 (file)
@@ -4,6 +4,8 @@
 
 #include<GeomAPI_Pnt.h>
 #include<GeomAPI_XYZ.h>
+#include<GeomAPI_Pnt2d.h>
+#include<GeomAPI_Dir.h>
 
 #include<gp_Pnt.hxx>
 
@@ -58,3 +60,14 @@ double GeomAPI_Pnt::distance(const boost::shared_ptr<GeomAPI_Pnt>& theOther) con
 {
   return MY_PNT->Distance(theOther->impl<gp_Pnt>());
 }
+
+boost::shared_ptr<GeomAPI_Pnt2d> GeomAPI_Pnt::to2D(const boost::shared_ptr<GeomAPI_Pnt>& theOrigin,
+  const boost::shared_ptr<GeomAPI_Dir>& theDirX, const boost::shared_ptr<GeomAPI_Dir>& theDirY)
+{
+  gp_Pnt anOriginPnt(theOrigin->x(), theOrigin->y(), theOrigin->z());
+  gp_Vec aVec(anOriginPnt, impl<gp_Pnt>());
+
+  double aX = aVec.X() * theDirX->x() + aVec.Y() * theDirX->y() + aVec.Z() * theDirX->z();
+  double aY = aVec.X() * theDirY->x() + aVec.Y() * theDirY->y() + aVec.Z() * theDirY->z();
+  return boost::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(aX, aY));
+}