24 template<typename = typename std::enable_if<std::is_convertible<decltype(std::declval<T>() == std::declval<T>()),
bool>::value>::type>
25 bool operator==(
const Vector4& other)
const {
return w == other.
w &&
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 Vector4& 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>
62 T
dot(
const Vector4& other)
const {
return w * other.
w +
x * other.
x +
y * other.
y +
z * other.
z; }
64 template<typename = typename std::enable_if<std::is_arithmetic<T>::value>::type>
67 template<typename = typename std::enable_if<std::is_arithmetic<T>::value>::type>
68 typename std::conditional<std::is_floating_point<T>::value, T,
double>::type
71 template<typename = typename std::enable_if<std::is_arithmetic<T>::value>::type>
72 typename std::conditional<std::is_floating_point<T>::value, T,
double>::type
75 template<typename = typename std::enable_if<std::is_arithmetic<T>::value>::type>
79 if (len == 0)
return {0, 0};
80 return {T(
w / len), T(
x / len), T(
y / len), T(
z / len)};
83 template<typename = typename std::enable_if<std::is_arithmetic<T>::value>::type>
94 template<typename U = T, typename = typename std::enable_if<std::is_floating_point<U>::value>::type>
96 return std::abs(
w - other.
w) < epsilon &&
97 std::abs(
x - other.
x) < epsilon &&
98 std::abs(
y - other.
y) < epsilon &&
99 std::abs(
z - other.
z) < epsilon;
constexpr T epsilon_v
Definition Constants.hpp:32
Vector4< std::uint32_t > Vector4u
Definition Vector4.hpp:103
Vector4< double > Vector4f
Definition Vector4.hpp:105
Vector4< std::int32_t > Vector4i
Definition Vector4.hpp:104
Definition Vector4.hpp:20
Vector4 operator-(const Vector4 &other) const
Definition Vector4.hpp:35
Vector4 & operator-=(const Vector4 &other)
Definition Vector4.hpp:48
T x
Definition Vector4.hpp:21
Vector4 & operator/=(T scalar)
Definition Vector4.hpp:54
Vector4 operator*(T scalar) const
Definition Vector4.hpp:38
std::conditional< std::is_floating_point< T >::value, T, double >::type magnitude() const
Definition Vector4.hpp:69
T dot(const Vector4 &other) const
Definition Vector4.hpp:62
T z
Definition Vector4.hpp:21
Vector4 & operator*=(T scalar)
Definition Vector4.hpp:51
void normalize()
Definition Vector4.hpp:84
std::conditional< std::is_floating_point< T >::value, T, double >::type distance(const Vector4 &other) const
Definition Vector4.hpp:73
std::uint32_t w
Definition Vector4.hpp:21
Vector4 normalized() const
Definition Vector4.hpp:76
T square_magnitude() const
Definition Vector4.hpp:65
Vector4 & operator+=(const Vector4 &other)
Definition Vector4.hpp:45
bool same(const Vector4 &other, T epsilon=epsilon_v< T >) const
Definition Vector4.hpp:95
T y
Definition Vector4.hpp:21
Vector4 operator/(T scalar) const
Definition Vector4.hpp:41
Vector4 operator+(const Vector4 &other) const
Definition Vector4.hpp:32
Vector4 operator-() const
Definition Vector4.hpp:58