24 template<typename = typename std::enable_if<std::is_convertible<decltype(std::declval<T>() == std::declval<T>()),
bool>::value>::type>
25 bool operator==(
const Vector3& other)
const {
return x == other.
x &&
y == other.
y &&
z == other.
z; }
27 template<typename = typename std::enable_if<std::is_convertible<decltype(std::declval<T>() == std::declval<T>()),
bool>::value>::type>
28 bool operator!=(
const Vector3& other)
const {
return !(*
this == other); }
31 template<typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
34 template<typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
37 template<typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
40 template<typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
44 template<typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
47 template<typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
50 template<typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
53 template<typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
57 template<typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
61 template<typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
64 template<typename = typename std::enable_if<std::is_arithmetic<T>::value>::type>
67 y * other.
z -
z * other.
y,
68 z * other.
x -
x * other.
z,
69 x * other.
y -
y * other.
x
73 template<typename = typename std::enable_if<std::is_arithmetic<T>::value>::type>
76 template<typename = typename std::enable_if<std::is_arithmetic<T>::value>::type>
77 typename std::conditional<std::is_floating_point<T>::value, T,
double>::type
80 template<typename = typename std::enable_if<std::is_arithmetic<T>::value>::type>
81 typename std::conditional<std::is_floating_point<T>::value, T,
double>::type
84 template<typename = typename std::enable_if<std::is_arithmetic<T>::value>::type>
90 return std::atan2(sine,
double(this->
dot(other)));
93 template<typename = typename std::enable_if<std::is_arithmetic<T>::value>::type>
97 if (len == 0)
return {0, 0, 0};
98 return {T(
x / len), T(
y / len), T(
z / len)};
101 template<typename = typename std::enable_if<std::is_arithmetic<T>::value>::type>
105 if (len == 0)
return;
111 template<typename U = T, typename = typename std::enable_if<std::is_floating_point<U>::value>::type>
113 return std::abs(
x - other.
x) < epsilon &&
114 std::abs(
y - other.
y) < epsilon &&
115 std::abs(
z - other.
z) < epsilon;
constexpr T epsilon_v
Definition Constants.hpp:32
Vector3< double > Vector3f
Definition Vector3.hpp:121
Vector3< std::uint32_t > Vector3u
Definition Vector3.hpp:119
Vector3< std::int32_t > Vector3i
Definition Vector3.hpp:120
Definition Vector3.hpp:20
Vector3 normalized() const
Definition Vector3.hpp:94
std::uint32_t x
Definition Vector3.hpp:21
Vector3 & operator*=(T scalar)
Definition Vector3.hpp:51
void normalize()
Definition Vector3.hpp:102
double angle(const Vector3 &other) const
Definition Vector3.hpp:85
Vector3 operator*(T scalar) const
Definition Vector3.hpp:38
std::conditional< std::is_floating_point< T >::value, T, double >::type magnitude() const
Definition Vector3.hpp:78
T y
Definition Vector3.hpp:21
Vector3 & operator+=(const Vector3 &other)
Definition Vector3.hpp:45
T square_magnitude() const
Definition Vector3.hpp:74
Vector3 cross(const Vector3 &other) const
Definition Vector3.hpp:65
std::conditional< std::is_floating_point< T >::value, T, double >::type distance(const Vector3 &other) const
Definition Vector3.hpp:82
bool same(const Vector3 &other, T epsilon=epsilon_v< T >) const
Definition Vector3.hpp:112
Vector3 & operator/=(T scalar)
Definition Vector3.hpp:54
Vector3 operator-() const
Definition Vector3.hpp:58
T dot(const Vector3 &other) const
Definition Vector3.hpp:62
Vector3 operator/(T scalar) const
Definition Vector3.hpp:41
T z
Definition Vector3.hpp:21
Vector3 & operator-=(const Vector3 &other)
Definition Vector3.hpp:48
Vector3 operator+(const Vector3 &other) const
Definition Vector3.hpp:32
Vector3 operator-(const Vector3 &other) const
Definition Vector3.hpp:35