8#ifndef SEN_LIBS_UTIL_SRC_DR_VEC3_H
9#define SEN_LIBS_UTIL_SRC_DR_VEC3_H
17#include <initializer_list>
31 Vec3(T x, T y, T z) noexcept;
38 [[nodiscard]] const T*
ptr() const noexcept;
41 void set(T x, T y, T z) noexcept;
52 [[nodiscard]] T
getX() const noexcept;
54 [[nodiscard]] T
getY() const noexcept;
56 [[nodiscard]] T
getZ() const noexcept;
59 bool operator==(const
Vec3& v) const noexcept;
61 bool operator!=(const
Vec3& v) const noexcept;
63 bool operator<(const
Vec3& v) const noexcept;
67 T operator*(const
Vec3& rhs) const noexcept;
70 Vec3 operator^(const
Vec3& rhs) const noexcept;
73 Vec3 operator*(T rhs) const noexcept;
76 Vec3& operator*=(T rhs) noexcept;
79 Vec3 operator/(T rhs) const noexcept;
82 Vec3& operator/=(T rhs) noexcept;
85 Vec3 operator+(const
Vec3& rhs) const noexcept;
91 Vec3 operator-(const
Vec3& rhs) const noexcept;
97 Vec3 operator-() const noexcept;
204 return v_[0] == v.v_[0] && v_[1] == v.v_[1] && v_[2] == v.v_[2];
210 return v_[0] != v.v_[0] || v_[1] != v.v_[1] || v_[2] != v.v_[2];
232 return (v_[2] < v.v_[2]);
238 return v_[0] * rhs.v_[0] + v_[1] * rhs.v_[1] + v_[2] * rhs.v_[2];
244 return Vec3(v_[1] * rhs.v_[2] - v_[2] * rhs.v_[1],
245 v_[2] * rhs.v_[0] - v_[0] * rhs.v_[2],
246 v_[0] * rhs.v_[1] - v_[1] * rhs.v_[0]);
252 return Vec3(v_[0] * rhs, v_[1] * rhs, v_[2] * rhs);
267 return Vec3(v_[0] / rhs, v_[1] / rhs, v_[2] / rhs);
282 return Vec3(v_[0] + rhs.v_[0], v_[1] + rhs.v_[1], v_[2] + rhs.v_[2]);
297 return Vec3(v_[0] - rhs.v_[0], v_[1] - rhs.v_[1], v_[2] - rhs.v_[2]);
312 return Vec3(-v_[0], -v_[1], -v_[2]);
318 return std::sqrt(v_[0] * v_[0] + v_[1] * v_[1] + v_[2] * v_[2]);
324 return v_[0] * v_[0] + v_[1] * v_[1] + v_[2] * v_[2];
Handles all mathematical ops involving 3D Vectors.
Definition vec3.h:24
f32 getY() const noexcept
Vec3 operator+(const Vec3 &rhs) const noexcept
Binary vector addition.
Definition vec3.h:280
bool operator<(const Vec3 &v) const noexcept
Definition vec3.h:214
bool operator==(const Vec3 &v) const noexcept
Definition vec3.h:202
f32 length2() const noexcept
f32 getX() const noexcept
void set(f32 x, f32 y, f32 z) noexcept
Vec3 & operator/=(T rhs) noexcept
Unary division by scalar.
Definition vec3.h:271
void setX(f32 x) noexcept
void setY(f32 y) noexcept
Vec3 & operator+=(const Vec3 &rhs) noexcept
Binary vector addition.
Definition vec3.h:286
f32 length() const noexcept
Vec3 & operator-=(const Vec3 &rhs) noexcept
Binary vector subtraction.
Definition vec3.h:301
bool operator!=(const Vec3 &v) const noexcept
Definition vec3.h:208
f32 getZ() const noexcept
Vec3() noexcept
Definition vec3.h:122
Vec3 & operator*=(T rhs) noexcept
Unary scalar multiplication.
Definition vec3.h:256
T operator*(const Vec3 &rhs) const noexcept
Point multiplication.
Definition vec3.h:236
Vec3 operator/(T rhs) const noexcept
Division by scalar.
Definition vec3.h:265
Vec3 operator-() const noexcept
Negates the internal elements of the vector.
Definition vec3.h:310
void setZ(f32 z) noexcept
Vec3 operator^(const Vec3 &rhs) const noexcept
Cross product.
Definition vec3.h:242
float32_t f32
Definition numbers.h:28
float64_t f64
Definition numbers.h:29
Definition iterator_adapters.h:16
Vec3< f64 > Vec3d
Definition vec3.h:115
Vec3< f32 > Vec3f
Definition vec3.h:114