X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAPI%2FGeomAPI_Pnt.cpp;h=29fe933a668f87ddfab4985fbf3ff1b910e12c6a;hb=0448acdd8e8c1e1638a2cf861e42e915966b2034;hp=b4ad659760d8bf2c38970f6ff2b4ec6e9cedb320;hpb=38afbd899a8645c83e17f2c24a17a2b7414911b4;p=modules%2Fshaper.git diff --git a/src/GeomAPI/GeomAPI_Pnt.cpp b/src/GeomAPI/GeomAPI_Pnt.cpp index b4ad65976..29fe933a6 100644 --- a/src/GeomAPI/GeomAPI_Pnt.cpp +++ b/src/GeomAPI/GeomAPI_Pnt.cpp @@ -8,8 +8,11 @@ #include #include #include +#include #include +#include +#include #define MY_PNT static_cast(myImpl) @@ -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())); +}