31 : m_X(other.m_X.load(std::memory_order_relaxed))
32 , m_Y(other.m_Y.load(std::memory_order_relaxed))
33 , m_Z(other.m_Z.load(std::memory_order_relaxed))
39 : m_X(other.m_X.load(std::memory_order_relaxed))
40 , m_Y(other.m_Y.load(std::memory_order_relaxed))
41 , m_Z(other.m_Z.load(std::memory_order_relaxed))
43 other.m_X.store(0, std::memory_order_relaxed);
44 other.m_Y.store(0, std::memory_order_relaxed);
45 other.m_Z.store(0, std::memory_order_relaxed);
53 m_X.store(other.m_X.load(std::memory_order_relaxed), std::memory_order_relaxed);
54 m_Y.store(other.m_Y.load(std::memory_order_relaxed), std::memory_order_relaxed);
55 m_Z.store(other.m_Z.load(std::memory_order_relaxed), std::memory_order_relaxed);
65 m_X.store(other.m_X.load(std::memory_order_relaxed), std::memory_order_relaxed);
66 m_Y.store(other.m_Y.load(std::memory_order_relaxed), std::memory_order_relaxed);
67 m_Z.store(other.m_Z.load(std::memory_order_relaxed), std::memory_order_relaxed);
68 other.m_X.store(0, std::memory_order_relaxed);
69 other.m_Y.store(0, std::memory_order_relaxed);
70 other.m_Z.store(0, std::memory_order_relaxed);
78 return AVector3(
GetX() + other.GetX(), GetY() + other.GetY(), GetZ() + other.GetZ());
85 SetY(GetY() + other.GetY());
86 SetZ(GetZ() + other.GetZ());
93 return AVector3(
GetX() - other.GetX(), GetY() - other.GetY(), GetZ() - other.GetZ());
100 SetY(GetY() - other.GetY());
101 SetZ(GetZ() - other.GetZ());
114 return AVector3(
GetX() * scalar, GetY() * scalar, GetZ() * scalar);
121 SetY(GetY() * scalar);
122 SetZ(GetZ() * scalar);
129 return AVector3(
GetX() / scalar, GetY() / scalar, GetZ() / scalar);
136 SetY(GetY() / scalar);
137 SetZ(GetZ() / scalar);
144 return GetX() == other.GetX() && GetY() == other.GetY() && GetZ() == other.GetZ();
146 bool operator!=(
const AVector3& other)
const noexcept
148 return !(*
this == other);
154 return m_X.load(std::memory_order_relaxed);
156 T GetY() const noexcept
158 return m_Y.load(std::memory_order_relaxed);
160 T GetZ() const noexcept
162 return m_Z.load(std::memory_order_relaxed);
168 m_X.store(x, std::memory_order_relaxed);
170 void SetY(T y)
noexcept
172 m_Y.store(y, std::memory_order_relaxed);
174 void SetZ(T z)
noexcept
176 m_Z.store(z, std::memory_order_relaxed);
184 return GetX() * other.GetX() + GetY() * other.GetY() + GetZ() * other.GetZ();
190 return AVector3(GetY() * other.GetZ() - GetZ() * other.GetY(),
191 GetZ() * other.GetX() -
GetX() * other.GetZ(),
192 GetX() * other.GetY() - GetY() * other.GetX());
198 return static_cast<T
>(std::sqrt(
GetX() *
GetX() + GetY() * GetY() + GetZ() * GetZ()));
219 template <
typename T>
220 AVector3<T> operator*(T scalar,
const AVector3<T>& vec)
noexcept
226 template <
typename T>
227 std::ostream& operator<<(std::ostream& os,
const AVector3<T>& vec)
229 os <<
"(" << vec.GetX() <<
", " << vec.GetY() <<
", " << vec.GetZ() <<
")";
Definition AVector3.hpp:11
AVector3 Normalized() const noexcept
Returns a normalized (unit-length) copy of the vector.
Definition AVector3.hpp:202
AVector3(const AVector3 &other) noexcept
Copy constructor.
Definition AVector3.hpp:30
AVector3 operator-(const AVector3 &other) const noexcept
Subtraction operator.
Definition AVector3.hpp:91
AVector3 & operator-=(const AVector3 &other) noexcept
Compound subtraction.
Definition AVector3.hpp:97
AVector3 operator-() const noexcept
Unary negation.
Definition AVector3.hpp:106
AVector3 Cross(const AVector3 &other) const noexcept
Cross product.
Definition AVector3.hpp:188
T GetX() const noexcept
Getters.
Definition AVector3.hpp:152
AVector3 & operator=(AVector3 &&other) noexcept
Move assignment operator.
Definition AVector3.hpp:61
AVector3(T x, T y, T z) noexcept
Parameterized constructor.
Definition AVector3.hpp:22
AVector3(AVector3 &&other) noexcept
Move constructor.
Definition AVector3.hpp:38
AVector3 & operator+=(const AVector3 &other) noexcept
Compound addition.
Definition AVector3.hpp:82
AVector3 & operator/=(T scalar) noexcept
Compound scalar division.
Definition AVector3.hpp:133
T Dot(const AVector3 &other) const noexcept
Additional operations:
Definition AVector3.hpp:182
AVector3 & operator*=(T scalar) noexcept
Compound scalar multiplication.
Definition AVector3.hpp:118
T Length() const noexcept
Returns the vector's magnitude.
Definition AVector3.hpp:196
AVector3 operator*(T scalar) const noexcept
Scalar multiplication.
Definition AVector3.hpp:112
AVector3() noexcept
Default constructor: initializes coordinates to zero.
Definition AVector3.hpp:14
AVector3 & operator=(const AVector3 &other) noexcept
Copy assignment operator.
Definition AVector3.hpp:49
AVector3 operator/(T scalar) const noexcept
Scalar division.
Definition AVector3.hpp:127
void SetX(T x) noexcept
Setters.
Definition AVector3.hpp:166
bool operator==(const AVector3 &other) const noexcept
Equality operators.
Definition AVector3.hpp:142
AVector3 operator+(const AVector3 &other) const noexcept
Addition operator.
Definition AVector3.hpp:76