X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAPI%2FGeomAPI_Pnt.cpp;h=29fe933a668f87ddfab4985fbf3ff1b910e12c6a;hb=ce9008bdda3fa14d6fa6c61360541249ccf43ce0;hp=ef7b5800135fdcd92d182a123c3b0fbbfbd23d42;hpb=9e869ede4d8c56262bb20534543c2bf56cd6a91b;p=modules%2Fshaper.git diff --git a/src/GeomAPI/GeomAPI_Pnt.cpp b/src/GeomAPI/GeomAPI_Pnt.cpp index ef7b58001..29fe933a6 100644 --- a/src/GeomAPI/GeomAPI_Pnt.cpp +++ b/src/GeomAPI/GeomAPI_Pnt.cpp @@ -1,3 +1,5 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + // File: GeomAPI_Pnt.cpp // Created: 23 Apr 2014 // Author: Mikhail PONIKAROV @@ -6,8 +8,11 @@ #include #include #include +#include #include +#include +#include #define MY_PNT static_cast(myImpl) @@ -71,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())); +}