X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAPI%2FGeomAPI_Pnt.cpp;h=0cf67c2ad7ae7c5b506b685c7fc17d66fac336ee;hb=7b4a6a2a335d41a647e0f6a6becb7c23df042be1;hp=b4ad659760d8bf2c38970f6ff2b4ec6e9cedb320;hpb=38afbd899a8645c83e17f2c24a17a2b7414911b4;p=modules%2Fshaper.git diff --git a/src/GeomAPI/GeomAPI_Pnt.cpp b/src/GeomAPI/GeomAPI_Pnt.cpp index b4ad65976..0cf67c2ad 100644 --- a/src/GeomAPI/GeomAPI_Pnt.cpp +++ b/src/GeomAPI/GeomAPI_Pnt.cpp @@ -8,10 +8,13 @@ #include #include #include +#include #include +#include +#include -#define MY_PNT static_cast(myImpl) +#define MY_PNT implPtr() GeomAPI_Pnt::GeomAPI_Pnt(const double theX, const double theY, const double theZ) : GeomAPI_Interface(new gp_Pnt(theX, theY, theZ)) @@ -73,3 +76,22 @@ std::shared_ptr GeomAPI_Pnt::to2D(const std::shared_ptrx() + aVec.Y() * theDirY->y() + aVec.Z() * theDirY->z(); return std::shared_ptr(new GeomAPI_Pnt2d(aX, aY)); } + + +void GeomAPI_Pnt::translate(const std::shared_ptr& theDir, double theDist) +{ + gp_Vec aVec(theDir->impl()); + aVec.Normalize(); + aVec.Multiply(theDist); + MY_PNT->Translate(aVec); +} + +std::shared_ptr GeomAPI_Pnt::to2D(const std::shared_ptr& thePln) const +{ + double aA, aB, aC, aD; + thePln->coefficients(aA, aB, aC, aD); + gp_Pln aPln(aA, aB, aC, aD); + + gp_Pnt2d aRes = ProjLib::Project(aPln, *MY_PNT); + return std::shared_ptr(new GeomAPI_Pnt2d(aRes.X(), aRes.Y())); +}