From 01a0b3c3fc41ea7d16b75c052dd4cc300fa2c720 Mon Sep 17 00:00:00 2001 From: Carlo Pinciroli Date: Mon, 25 Sep 2023 16:12:44 -0400 Subject: [PATCH] Fixed compilation and linking issues with transform functions. --- src/core/CMakeLists.txt | 2 +- src/core/utility/math/transforms.cpp | 43 ++++++++++++++-------------- src/core/utility/math/transforms.h | 12 ++++---- 3 files changed, 29 insertions(+), 28 deletions(-) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 546031b9..fc8b23aa 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -156,7 +156,7 @@ set(ARGOS3_SOURCES_CORE utility/math/cylinder.cpp utility/math/convex_hull.cpp utility/math/pose2.cpp - utility/math/transforms.h + utility/math/transforms.cpp utility/math/vector2.cpp utility/math/vector3.cpp utility/math/plane.cpp diff --git a/src/core/utility/math/transforms.cpp b/src/core/utility/math/transforms.cpp index ffb4b463..a0725f15 100644 --- a/src/core/utility/math/transforms.cpp +++ b/src/core/utility/math/transforms.cpp @@ -1,29 +1,30 @@ #include "transforms.h" -using namespace argos; +namespace argos { -/****************************************/ -/****************************************/ + /****************************************/ + /****************************************/ -CVector3 GlobalToLocal(const CVector3& c_global, - const CVector3& c_translation, - const CQuaternion& c_orientation) { - CVector3 cLocal = c_global - c_translation; - cLocal.Rotate(c_orientation.Inverse()); - return cLocal; -} + CVector3 GlobalToLocal(CVector3 c_global, + CVector3 c_translation, + CQuaternion c_orientation) { + CVector3 cLocal = c_global - c_translation; + cLocal.Rotate(c_orientation.Inverse()); + return cLocal; + } -/****************************************/ -/****************************************/ + /****************************************/ + /****************************************/ -CVector3 LocalToGlobal(const CVector3& c_local, - const CVector3& c_translation, - const CQuaternion& c_orientation) { - CVector cGlobal = c_local.Rotate(c_orientation); - cGlobal += c_translation; - return cGlobal; -} + CVector3 LocalToGlobal(CVector3 c_local, + CVector3 c_translation, + CQuaternion c_orientation) { + CVector3 cGlobal = c_local.Rotate(c_orientation); + cGlobal += c_translation; + return cGlobal; + } -/****************************************/ -/****************************************/ + /****************************************/ + /****************************************/ +} diff --git a/src/core/utility/math/transforms.h b/src/core/utility/math/transforms.h index dfdc8a82..7a47c8b8 100644 --- a/src/core/utility/math/transforms.h +++ b/src/core/utility/math/transforms.h @@ -6,13 +6,13 @@ namespace argos { - CVector3 GlobalToLocal(const CVector3& c_global, - const CVector3& c_translation, - const CQuaternion& c_orientation); + CVector3 GlobalToLocal(CVector3 c_global, + CVector3 c_translation, + CQuaternion c_orientation); - CVector3 LocalToGlobal(const CVector3& c_local, - const CVector3& c_translation, - const CQuaternion& c_orientation); + CVector3 LocalToGlobal(CVector3 c_local, + CVector3 c_translation, + CQuaternion c_orientation); }