From 8fc78d8ff671f8a1e48d810dc75ffbc73e322ac4 Mon Sep 17 00:00:00 2001 From: Kacper Donat Date: Sun, 23 Feb 2025 15:01:42 +0100 Subject: [PATCH] Base: Add Vector3*::Unit* axis constants This is simple helper that can be used to replace hardcoded values of base axis with properly labeled ones. --- src/Base/Vector3D.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Base/Vector3D.h b/src/Base/Vector3D.h index ff931c0d1f..62ad1fb5f1 100644 --- a/src/Base/Vector3D.h +++ b/src/Base/Vector3D.h @@ -101,6 +101,10 @@ template class Vector3 { public: + static const Vector3 UnitX; + static const Vector3 UnitY; + static const Vector3 UnitZ; + using num_type = float_type; using traits_type = float_traits; [[nodiscard]] static constexpr num_type epsilon() @@ -256,7 +260,12 @@ public: //@} }; -// global functions +template +Vector3 const Vector3::UnitX(1.0, 0.0, 0.0); +template +Vector3 const Vector3::UnitY(0.0, 1.0, 0.0); +template +Vector3 const Vector3::UnitZ(0.0, 0.0, 1.0); /// Returns the distance between two points template