From: azv Date: Thu, 23 Apr 2015 06:03:36 +0000 (+0300) Subject: Calculation of angle between two directions X-Git-Tag: V_1.2.0~185 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=70c9f5e2dc706c38c9cde76df9108011512b8680;p=modules%2Fshaper.git Calculation of angle between two directions --- diff --git a/src/GeomAPI/GeomAPI_Dir.cpp b/src/GeomAPI/GeomAPI_Dir.cpp index 858d8f877..5c42d68a0 100644 --- a/src/GeomAPI/GeomAPI_Dir.cpp +++ b/src/GeomAPI/GeomAPI_Dir.cpp @@ -53,3 +53,8 @@ const std::shared_ptr GeomAPI_Dir::cross( return std::shared_ptr(new GeomAPI_XYZ(aResult.X(), aResult.Y(), aResult.Z())); } +double GeomAPI_Dir::angle(const std::shared_ptr& theArg) const +{ + return MY_DIR->Angle(theArg->impl()); +} + diff --git a/src/GeomAPI/GeomAPI_Dir.h b/src/GeomAPI/GeomAPI_Dir.h index c713019f9..fa0cdcb6b 100644 --- a/src/GeomAPI/GeomAPI_Dir.h +++ b/src/GeomAPI/GeomAPI_Dir.h @@ -39,6 +39,9 @@ class GEOMAPI_EXPORT GeomAPI_Dir : public GeomAPI_Interface double dot(const std::shared_ptr& theArg) const; /// result is a cross product of two directions const std::shared_ptr cross(const std::shared_ptr& theArg) const; + + /// calculates angle between two directions + double angle(const std::shared_ptr& theArg) const; }; #endif diff --git a/src/GeomAPI/GeomAPI_Dir2d.cpp b/src/GeomAPI/GeomAPI_Dir2d.cpp index e9131f992..abb954f29 100644 --- a/src/GeomAPI/GeomAPI_Dir2d.cpp +++ b/src/GeomAPI/GeomAPI_Dir2d.cpp @@ -46,3 +46,7 @@ double GeomAPI_Dir2d::cross(const std::shared_ptr& theArg) const return MY_DIR->XY().Crossed(theArg->impl().XY()); } +double GeomAPI_Dir2d::angle(const std::shared_ptr& theArg) const +{ + return MY_DIR->Angle(theArg->impl()); +} diff --git a/src/GeomAPI/GeomAPI_Dir2d.h b/src/GeomAPI/GeomAPI_Dir2d.h index ec5587693..afea83723 100644 --- a/src/GeomAPI/GeomAPI_Dir2d.h +++ b/src/GeomAPI/GeomAPI_Dir2d.h @@ -37,6 +37,9 @@ class GEOMAPI_EXPORT GeomAPI_Dir2d : public GeomAPI_Interface double dot(const std::shared_ptr& theArg) const; /// result is a cross product of two directions double cross(const std::shared_ptr& theArg) const; + + /// calculates angle between two directions + double angle(const std::shared_ptr& theArg) const; }; #endif