From 91f42802e83f017df372b04a8f619a95f5cc58bb Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Sun, 18 May 2025 17:34:52 +0200 Subject: [PATCH] Reduced the use of raw pointers --- Direction.cpp | 6 ++++-- Direction.h | 2 -- Polar.cpp | 4 ++-- Spherical.cpp | 4 ++++ Spherical.h | 1 - SwingTwist.cpp | 6 +++++- test/Direction_test.cc | 2 ++ 7 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Direction.cpp b/Direction.cpp index f9c5e40..86fa77c 100644 --- a/Direction.cpp +++ b/Direction.cpp @@ -9,6 +9,7 @@ #include +namespace LinearAlgebra { template DirectionOf::DirectionOf() { this->horizontal = AngleOf(); @@ -98,5 +99,6 @@ void DirectionOf::Normalize() { } } -template class DirectionOf; -template class DirectionOf; +template class LinearAlgebra::DirectionOf; +template class LinearAlgebra::DirectionOf; +} \ No newline at end of file diff --git a/Direction.h b/Direction.h index 57f6647..8c58b6c 100644 --- a/Direction.h +++ b/Direction.h @@ -99,6 +99,4 @@ using Direction = DirectionSingle; } // namespace LinearAlgebra -using namespace LinearAlgebra; - #endif \ No newline at end of file diff --git a/Polar.cpp b/Polar.cpp index 9dea130..15ac40f 100644 --- a/Polar.cpp +++ b/Polar.cpp @@ -175,5 +175,5 @@ PolarOf PolarOf::Rotate(const PolarOf& v, AngleOf angle) { return r; } -template class PolarOf; -template class PolarOf; \ No newline at end of file +template class LinearAlgebra::PolarOf; +template class LinearAlgebra::PolarOf; \ No newline at end of file diff --git a/Spherical.cpp b/Spherical.cpp index 1a50357..0371f92 100644 --- a/Spherical.cpp +++ b/Spherical.cpp @@ -5,6 +5,8 @@ #include +namespace LinearAlgebra { + template SphericalOf::SphericalOf() { this->distance = 0.0f; @@ -301,3 +303,5 @@ SphericalOf SphericalOf::RotateVertical(const SphericalOf& v, template class SphericalOf; template class SphericalOf; + +} // namespace LinearAlgebra \ No newline at end of file diff --git a/Spherical.h b/Spherical.h index 5cad52c..309db03 100644 --- a/Spherical.h +++ b/Spherical.h @@ -186,7 +186,6 @@ using Spherical = SphericalSingle; #endif } // namespace LinearAlgebra -using namespace LinearAlgebra; #include "Polar.h" #include "Vector3.h" diff --git a/SwingTwist.cpp b/SwingTwist.cpp index 58905c7..deca73c 100644 --- a/SwingTwist.cpp +++ b/SwingTwist.cpp @@ -4,6 +4,8 @@ #include "SwingTwist.h" +namespace LinearAlgebra { + template SwingTwistOf::SwingTwistOf() { this->swing = DirectionOf(AngleOf(), AngleOf()); @@ -165,4 +167,6 @@ void SwingTwistOf::Normalize() { } template class SwingTwistOf; -template class SwingTwistOf; \ No newline at end of file +template class SwingTwistOf; + +} \ No newline at end of file diff --git a/test/Direction_test.cc b/test/Direction_test.cc index 461140c..6489caa 100644 --- a/test/Direction_test.cc +++ b/test/Direction_test.cc @@ -6,6 +6,8 @@ #include "Direction.h" +using namespace LinearAlgebra; + #define FLOAT_INFINITY std::numeric_limits::infinity() TEST(Direction16, Compare) {