diff --git a/Angle.h b/Angle.h index 943be90..3c55e48 100644 --- a/Angle.h +++ b/Angle.h @@ -6,6 +6,7 @@ #define ANGLE_H namespace Passer { +namespace LinearAlgebra { template class AngleOf { public: @@ -40,7 +41,8 @@ private: using Angle = AngleOf; +} // namespace LinearAlgebra } // namespace Passer -using namespace Passer; +using namespace Passer::LinearAlgebra; #endif \ No newline at end of file diff --git a/Angle16.h b/Angle16.h index 47d31ce..511ab63 100644 --- a/Angle16.h +++ b/Angle16.h @@ -4,6 +4,7 @@ #include namespace Passer { +namespace LinearAlgebra { typedef AngleUsing Angle16; @@ -22,5 +23,6 @@ template <> float Angle16::ToFloat() const { return f; } +} // namespace LinearAlgebra } // namespace Passer -using namespace Passer; \ No newline at end of file +using namespace Passer::LinearAlgebra; \ No newline at end of file diff --git a/Angle32.h b/Angle32.h index cded359..72b135b 100644 --- a/Angle32.h +++ b/Angle32.h @@ -4,6 +4,8 @@ #include namespace Passer { +namespace LinearAlgebra { + typedef AngleUsing Angle32; template <> Angle32::AngleUsing(float angle) { @@ -21,5 +23,6 @@ template <> float Angle32::ToFloat() const { return f; } +} // namespace LinearAlgebra } // namespace Passer -using namespace Passer; \ No newline at end of file +using namespace Passer::LinearAlgebra; \ No newline at end of file diff --git a/Angle8.h b/Angle8.h index 5ba5f6e..53ba7d2 100644 --- a/Angle8.h +++ b/Angle8.h @@ -4,6 +4,7 @@ #include namespace Passer { +namespace LinearAlgebra { typedef AngleUsing Angle8; @@ -23,5 +24,6 @@ template <> float Angle8::ToFloat() const { return f; } +} // namespace LinearAlgebra } // namespace Passer -using namespace Passer; \ No newline at end of file +using namespace Passer::LinearAlgebra; \ No newline at end of file diff --git a/AngleAxis.h b/AngleAxis.h index b387521..9f64628 100644 --- a/AngleAxis.h +++ b/AngleAxis.h @@ -9,6 +9,7 @@ #include "Axis.h" namespace Passer { +namespace LinearAlgbra { class AngleAxis { public: @@ -18,7 +19,9 @@ public: AngleAxis(); AngleAxis(Angle angle, Axis axis); }; + +} // namespace LinearAlgbra } // namespace Passer -using namespace Passer; +using namespace Passer::LinearAlgbra; #endif \ No newline at end of file diff --git a/AngleUsing.h b/AngleUsing.h index ca179db..7afe51d 100644 --- a/AngleUsing.h +++ b/AngleUsing.h @@ -5,6 +5,7 @@ #include "Range.h" namespace Passer { +namespace LinearAlgebra { // A fixed angle between (-180..180] @@ -40,7 +41,9 @@ public: // protected: T value; }; + +} // namespace LinearAlgebra } // namespace Passer -using namespace Passer; +using namespace Passer::LinearAlgebra; #endif diff --git a/Axis.h b/Axis.h index 7be4e70..ba49ddc 100644 --- a/Axis.h +++ b/Axis.h @@ -8,6 +8,7 @@ #include "Angle.h" namespace Passer { +namespace LinearAlgebra { struct Vector3; @@ -29,7 +30,9 @@ public: Vector3 ToVector3(); }; + +} // namespace LinearAlgebra } // namespace Passer -using namespace Passer; +using namespace Passer::LinearAlgbra; #endif \ No newline at end of file diff --git a/FloatSingle.h b/FloatSingle.h index 8922f06..060cc8b 100644 --- a/FloatSingle.h +++ b/FloatSingle.h @@ -6,6 +6,7 @@ #define FLOAT_H namespace Passer { +namespace LinearAlgebra { class Float { public: @@ -14,7 +15,9 @@ public: static float Clamp(float f, float min, float max); }; + +} // namespace LinearAlgebra } // namespace Passer -using namespace Passer; +using namespace Passer::LinearAlgebra; #endif diff --git a/Matrix.h b/Matrix.h index 3997464..33087aa 100644 --- a/Matrix.h +++ b/Matrix.h @@ -4,6 +4,7 @@ #include "Vector3.h" namespace Passer { +namespace LinearAlgebra { /// @brief Single precision float matrix template class MatrixOf { @@ -112,7 +113,9 @@ private: unsigned int cols; T *data; }; + +} // namespace LinearAlgebra } // namespace Passer -using namespace Passer; +using namespace Passer::LinearAlgebra; #endif \ No newline at end of file diff --git a/Polar.h b/Polar.h index 82cbc05..ec9a2c7 100644 --- a/Polar.h +++ b/Polar.h @@ -8,6 +8,7 @@ #include "Angle.h" namespace Passer { +namespace LinearAlgebra { struct Vector2; struct Spherical; @@ -24,7 +25,8 @@ public: /// @remark The angle shall be between -180 .. 180 Angle angle; - /// @brief A new vector with polar coordinates with zero degrees and distance + /// @brief A new vector with polar coordinates with zero degrees and + /// distance Polar(); /// @brief A new vector with polar coordinates /// @param distance The distance in meters @@ -55,8 +57,8 @@ public: /// @brief Equality test to another vector /// @param v The vector to check against /// @return true: if it is identical to the given vector - /// @note This uses float comparison to check equality which may have strange - /// effects. Equality on floats should be avoided. + /// @note This uses float comparison to check equality which may have + /// strange effects. Equality on floats should be avoided. bool operator==(const Polar &v) const; /// @brief The vector length @@ -120,9 +122,9 @@ public: /// @return The rotated vector static Polar Rotate(const Polar &v, Angle a); }; - +} // namespace LinearAlgebra } // namespace Passer -using namespace Passer; +using namespace Passer::LinearAlgebra; #include "Spherical.h" #include "Vector2.h" diff --git a/Quaternion.h b/Quaternion.h index 079128f..cc99a51 100644 --- a/Quaternion.h +++ b/Quaternion.h @@ -8,6 +8,7 @@ #include "Vector3.h" namespace Passer { +namespace LinearAlgebra { extern "C" { /// @@ -281,7 +282,9 @@ private: Vector3 xyz() const; }; + +} // namespace LinearAlgebra } // namespace Passer -using namespace Passer; +using namespace Passer::LinearAlgebra; #endif diff --git a/Range.h b/Range.h index 59ac3f5..65f1dba 100644 --- a/Range.h +++ b/Range.h @@ -2,6 +2,7 @@ #define RANGE_H namespace Passer { +namespace LinearAlgebra { /* /// @brief Signed range. May be renamed to SignedRange later @@ -41,7 +42,9 @@ public: T value; }; + +} // namespace LinearAlgebra } // namespace Passer -using namespace Passer; +using namespace Passer::LinearAlgebra; #endif \ No newline at end of file diff --git a/Spherical.h b/Spherical.h index 39be3db..dcad9f7 100644 --- a/Spherical.h +++ b/Spherical.h @@ -9,6 +9,7 @@ #include "Polar.h" namespace Passer { +namespace LinearAlgebra { struct Vector3; @@ -120,8 +121,9 @@ public: static Spherical RotateVertical(const Spherical &v, Angle angle); }; +} // namespace LinearAlgebra } // namespace Passer -using namespace Passer; +using namespace Passer::LinearAlgebra; #include "Vector3.h" diff --git a/Vector2.h b/Vector2.h index c72ebd6..aeca26b 100644 --- a/Vector2.h +++ b/Vector2.h @@ -27,6 +27,7 @@ typedef struct Vec2 { } namespace Passer { +namespace LinearAlgebra { struct Vector3; struct Polar; @@ -178,7 +179,7 @@ public: /// @param v The vector to rotate /// @param a The angle in degrees to rotate /// @return The rotated vector - static Vector2 Rotate(const Vector2 &v, Passer::Angle a); + static Vector2 Rotate(const Vector2 &v, Passer::LinearAlgebra::Angle a); /// @brief Lerp (linear interpolation) between two vectors /// @param v1 The starting vector @@ -191,8 +192,9 @@ public: static Vector2 Lerp(const Vector2 &v1, const Vector2 &v2, float f); }; +} // namespace LinearAlgebra } // namespace Passer -using namespace Passer; +using namespace Passer::LinearAlgebra; #include "Polar.h" diff --git a/Vector3.h b/Vector3.h index 9ac6715..27db549 100644 --- a/Vector3.h +++ b/Vector3.h @@ -8,6 +8,7 @@ #include "Vector2.h" namespace Passer { +namespace LinearAlgebra { struct Spherical; @@ -213,8 +214,9 @@ public: static Vector3 Lerp(const Vector3 &v1, const Vector3 &v2, float f); }; +} // namespace LinearAlgebra } // namespace Passer -using namespace Passer; +using namespace Passer::LinearAlgebra; #include "Spherical.h"