fix normalize
parent
b51a5363b2
commit
86820b779d
|
@ -63,8 +63,11 @@ namespace blt {
|
||||||
return std::sqrt(total);
|
return std::sqrt(total);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] inline vec<T, size> normalize() const {
|
[[nodiscard]] inline vec<T, size>& normalize() const {
|
||||||
return *this / this->magnitude();
|
auto mag = this->magnitude();
|
||||||
|
if (mag == 0)
|
||||||
|
return *this;
|
||||||
|
return *this / mag;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline T& operator[](int index) {
|
inline T& operator[](int index) {
|
||||||
|
|
Loading…
Reference in New Issue