From 70c9f5e2dc706c38c9cde76df9108011512b8680 Mon Sep 17 00:00:00 2001 From: azv Date: Thu, 23 Apr 2015 09:03:36 +0300 Subject: [PATCH] Calculation of angle between two directions --- src/GeomAPI/GeomAPI_Dir.cpp | 5 +++++ src/GeomAPI/GeomAPI_Dir.h | 3 +++ src/GeomAPI/GeomAPI_Dir2d.cpp | 4 ++++ src/GeomAPI/GeomAPI_Dir2d.h | 3 +++ 4 files changed, 15 insertions(+) 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 -- 2.39.2