A cartesian 4D vector, 3D homogeneous. More...
#include <NRE_Vector4D.hpp>
Public Member Functions | |
constexpr | Vector4D ()=default |
template<class K , class L , class N , class M , typename = UseIfArithmetic<K, L, N, M>> | |
constexpr | Vector4D (K nX, L nY, N nZ, M nW) |
template<class K , typename = UseIfArithmetic<K>> | |
constexpr | Vector4D (K value) |
constexpr | Vector4D (std::initializer_list< T > list) |
constexpr | Vector4D (Vector4D const &u)=default |
constexpr | Vector4D (Vector4D &&u)=default |
template<class K > | |
constexpr | Vector4D (Vector4D< K > const &u) |
template<class K > | |
constexpr | Vector4D (Vector2D< K > const &u) |
template<class K , class L , class N , typename = UseIfArithmetic<L, N>> | |
constexpr | Vector4D (Vector2D< K > const &u, L nZ, N nW) |
template<class K > | |
constexpr | Vector4D (Vector3D< K > const &u) |
template<class K , class L , typename = UseIfArithmetic<L>> | |
constexpr | Vector4D (Vector3D< K > const &u, L nW) |
~Vector4D ()=default | |
constexpr T | getX () const |
constexpr T | getY () const |
constexpr T | getZ () const |
constexpr T | getW () const |
constexpr T | getR () const |
constexpr T | getG () const |
constexpr T | getB () const |
constexpr T | getA () const |
template<class K , typename = UseIfArithmetic<K>> | |
constexpr void | setX (K nX) |
template<class K , typename = UseIfArithmetic<K>> | |
constexpr void | setY (K nY) |
template<class K , typename = UseIfArithmetic<K>> | |
constexpr void | setZ (K nZ) |
template<class K , typename = UseIfArithmetic<K>> | |
constexpr void | setW (K nW) |
template<class K , typename = UseIfArithmetic<K>> | |
constexpr void | setR (K r) |
template<class K , typename = UseIfArithmetic<K>> | |
constexpr void | setG (K g) |
template<class K , typename = UseIfArithmetic<K>> | |
constexpr void | setB (K b) |
template<class K , typename = UseIfArithmetic<K>> | |
constexpr void | setA (K a) |
template<class K , class L , class N , class M , typename = UseIfArithmetic<K, L, N, M>> | |
constexpr void | setCoord (K nX, L nY, N nZ, M nW) |
template<class K , class L , class N , typename = UseIfArithmetic<L, N>> | |
constexpr void | setCoord (Vector2D< K > const &u, L nZ, N nW) |
template<class K , class L , typename = UseIfArithmetic<L>> | |
constexpr void | setCoord (Vector3D< K > const &u, L nW) |
template<class K , class L , class N , class M , typename = UseIfArithmetic<K, L, N, M>> | |
constexpr void | setRGBA (K r, L g, N b, M a) |
template<class K , class L , typename = UseIfArithmetic<L>> | |
constexpr void | setRGBA (Vector3D< K > const &u, L a) |
long double | norm () const |
constexpr T | normSquared () const |
template<class K > | |
long double | distance (Vector4D< K > const &v) const |
template<class K > | |
constexpr std::common_type_t< T, K > | distanceSquared (Vector4D< K > const &v) const |
Vector4D & | normalize () |
template<class K , typename = UseIfArithmetic<K>> | |
void | limit (K max) |
template<class K , typename = UseIfArithmetic<K>> | |
Vector4D & | pow (K p) |
template<class K > | |
Vector4D & | pow (Vector4D< K > const &p) |
constexpr const T * | value () const |
constexpr T & | operator[] (std::size_t index) |
constexpr T const & | operator[] (std::size_t index) const |
constexpr Vector4D & | operator= (Vector4D const &u)=default |
constexpr Vector4D & | operator= (Vector4D &&u)=default |
template<class K > | |
constexpr Vector4D & | operator= (Vector4D< K > const &u) |
template<class K > | |
constexpr Vector4D & | operator= (Vector4D< K > &&u) |
template<class K , typename = UseIfArithmetic<K>> | |
constexpr Vector4D & | operator+= (K k) |
template<class K > | |
constexpr Vector4D & | operator+= (Vector4D< K > const &u) |
template<class K , typename = UseIfArithmetic<K>> | |
constexpr Vector4D & | operator-= (K k) |
template<class K > | |
constexpr Vector4D & | operator-= (Vector4D< K > const &u) |
template<class K , typename = UseIfArithmetic<K>> | |
constexpr Vector4D & | operator*= (K k) |
template<class K > | |
constexpr Vector4D & | operator*= (Vector4D< K > const &u) |
template<class K , typename = UseIfArithmetic<K>> | |
constexpr Vector4D & | operator/= (K k) |
template<class K > | |
constexpr Vector4D & | operator/= (Vector4D< K > const &u) |
template<class K > | |
constexpr std::common_type_t< T, K > | operator|= (Vector4D< K > const &u) const |
template<class K > | |
constexpr Vector4D & | operator^= (Vector4D< K > const &u) |
template<class K , typename = UseIfArithmetic<K>> | |
constexpr Vector4D< std::common_type_t< T, K > > | operator+ (K k) const |
template<class K > | |
constexpr Vector4D< std::common_type_t< T, K > > | operator+ (Vector4D< K > const &u) const |
template<class K , typename = UseIfArithmetic<K>> | |
constexpr Vector4D< std::common_type_t< T, K > > | operator- (K k) const |
template<class K > | |
constexpr Vector4D< std::common_type_t< T, K > > | operator- (Vector4D< K > const &u) const |
constexpr Vector4D | operator- () const |
template<class K , typename = UseIfArithmetic<K>> | |
constexpr Vector4D< std::common_type_t< T, K > > | operator* (K k) const |
template<class K > | |
constexpr Vector4D< std::common_type_t< T, K > > | operator* (Vector4D< K > const &u) const |
template<class K , typename = UseIfArithmetic<K>> | |
constexpr Vector4D< std::common_type_t< T, K > > | operator/ (K k) const |
template<class K > | |
constexpr Vector4D< std::common_type_t< T, K > > | operator/ (Vector4D< K > const &u) const |
template<class K > | |
constexpr std::common_type_t< T, K > | operator| (Vector4D< K > const &u) const |
template<class K > | |
constexpr Vector4D< std::common_type_t< T, K > > | operator^ (Vector4D< K > const &u) const |
template<class K > | |
constexpr bool | operator== (Vector4D< K > const &u) const |
template<class K > | |
constexpr bool | operator!= (Vector4D< K > const &u) const |
template<class K > | |
constexpr bool | operator< (Vector4D< K > const &u) const |
template<class K > | |
constexpr bool | operator> (Vector4D< K > const &u) const |
template<class K > | |
constexpr bool | operator<= (Vector4D< K > const &u) const |
template<class K > | |
constexpr bool | operator>= (Vector4D< K > const &u) const |
Utility::String | toString () const |
A cartesian 4D vector, 3D homogeneous.
|
default |
Construct the null vector
|
inline |
Construct a vector with passed values
nX | new x value |
nY | new y value |
nZ | new z value |
nW | new w value |
|
inline |
Construct a vector with an unique value for all coordinates
value | new x, y, z and w values |
constexpr NRE::Math::Vector4D< T >::Vector4D | ( | std::initializer_list< T > | list | ) |
Construct a vector from an initializer list
list | the construction list |
|
default |
Copy u into this
u | the object to copy |
|
default |
Move u into this
u | the object to move |
constexpr NRE::Math::Vector4D< T >::Vector4D | ( | Vector4D< K > const & | u | ) |
Convert a K-type vector into a T-type vector
u | the K-type vector to convert |
constexpr NRE::Math::Vector4D< T >::Vector4D | ( | Vector2D< K > const & | u | ) |
Convert a base 2D vector into a 4D vector with a default z and w value
u | the 2D vector to convert |
|
inline |
Convert a base 2D vector into a 4D vector with a passed z and w value
u | the 2D vector to convert |
nZ | the new z value |
nW | the new w value |
constexpr NRE::Math::Vector4D< T >::Vector4D | ( | Vector3D< K > const & | u | ) |
Convert a base 3D vector into a 4D vector with a default w value
u | the 4D vector to convert |
|
inline |
Convert a base 3D vector into a 4D point with a passed w value
u | the 4D vector to convert |
nW | the new w value |
|
default |
Vector4D Deconstructor
long double NRE::Math::Vector4D< T >::distance | ( | Vector4D< K > const & | v | ) | const |
constexpr std::common_type_t<T, K> NRE::Math::Vector4D< T >::distanceSquared | ( | Vector4D< K > const & | v | ) | const |
constexpr T NRE::Math::Vector4D< T >::getA | ( | ) | const |
constexpr T NRE::Math::Vector4D< T >::getB | ( | ) | const |
constexpr T NRE::Math::Vector4D< T >::getG | ( | ) | const |
constexpr T NRE::Math::Vector4D< T >::getR | ( | ) | const |
constexpr T NRE::Math::Vector4D< T >::getW | ( | ) | const |
constexpr T NRE::Math::Vector4D< T >::getX | ( | ) | const |
constexpr T NRE::Math::Vector4D< T >::getY | ( | ) | const |
constexpr T NRE::Math::Vector4D< T >::getZ | ( | ) | const |
|
inline |
Limit the vector value to the given max, if to high then normalize it
max | the maximum value |
long double NRE::Math::Vector4D< T >::norm | ( | ) | const |
Vector4D& NRE::Math::Vector4D< T >::normalize | ( | ) |
Normalize the vector
constexpr T NRE::Math::Vector4D< T >::normSquared | ( | ) | const |
constexpr bool NRE::Math::Vector4D< T >::operator!= | ( | Vector4D< K > const & | u | ) | const |
Difference test between this and u
u | the vector to test with this |
|
inline |
Compute the vector resulting in the multiplication of this by k
k | the multiplication factor |
constexpr Vector4D<std::common_type_t<T, K> > NRE::Math::Vector4D< T >::operator* | ( | Vector4D< K > const & | u | ) | const |
Compute the vector resulting in the multiplication of this by u
u | the multiplication vector |
|
inline |
Multiply this by a factor k
k | the multiplication factor |
constexpr Vector4D& NRE::Math::Vector4D< T >::operator*= | ( | Vector4D< K > const & | u | ) |
Multiply this by a vector u, component by component
u | the multiplication vector |
|
inline |
Compute the vector resulting in the addition of k into this
k | the scalar to add |
constexpr Vector4D<std::common_type_t<T, K> > NRE::Math::Vector4D< T >::operator+ | ( | Vector4D< K > const & | u | ) | const |
Compute the vector resulting in the addition of u into this
u | the vector to add |
|
inline |
Add a scalar to all components
k | the scalar to add |
constexpr Vector4D& NRE::Math::Vector4D< T >::operator+= | ( | Vector4D< K > const & | u | ) |
Add a vector into this
u | the vector to add into this |
|
inline |
Compute the vector resulting in the subtraction of k into this
k | the scalar to add |
constexpr Vector4D<std::common_type_t<T, K> > NRE::Math::Vector4D< T >::operator- | ( | Vector4D< K > const & | u | ) | const |
Compute the vector resulting in the subtraction of u into this
u | the vector to subtract |
constexpr Vector4D NRE::Math::Vector4D< T >::operator- | ( | ) | const |
Compute the opposite version of this
|
inline |
Subtract a scalar to all components
k | the scalar to add |
constexpr Vector4D& NRE::Math::Vector4D< T >::operator-= | ( | Vector4D< K > const & | u | ) |
Subtract a vector into this
u | the vector to subtract into this |
|
inline |
Compute the vector resulting in the division of this by k
k | the division factor |
constexpr Vector4D<std::common_type_t<T, K> > NRE::Math::Vector4D< T >::operator/ | ( | Vector4D< K > const & | u | ) | const |
Compute the vector resulting in the division of this by u
u | the division vector |
|
inline |
Divide this by a factor k
k | the division factor |
constexpr Vector4D& NRE::Math::Vector4D< T >::operator/= | ( | Vector4D< K > const & | u | ) |
Divide this by a vector u, component by component
u | the division vector |
constexpr bool NRE::Math::Vector4D< T >::operator< | ( | Vector4D< K > const & | u | ) | const |
Inferior test between this and u
u | the vector to test with this |
constexpr bool NRE::Math::Vector4D< T >::operator<= | ( | Vector4D< K > const & | u | ) | const |
Inferior or Equal test between this and u
u | the vector to test with this |
|
default |
Copy u into this
u | the object to copy into this |
|
default |
Move u into this
u | the object to move into this |
constexpr Vector4D& NRE::Math::Vector4D< T >::operator= | ( | Vector4D< K > const & | u | ) |
Copy u into this
u | the object to copy into this |
constexpr Vector4D& NRE::Math::Vector4D< T >::operator= | ( | Vector4D< K > && | u | ) |
Move u into this
u | the object to move into this |
constexpr bool NRE::Math::Vector4D< T >::operator== | ( | Vector4D< K > const & | u | ) | const |
Equality test between this and u
u | the vector to test with this |
constexpr bool NRE::Math::Vector4D< T >::operator> | ( | Vector4D< K > const & | u | ) | const |
Superior test between this and u
u | the vector to test with this |
constexpr bool NRE::Math::Vector4D< T >::operator>= | ( | Vector4D< K > const & | u | ) | const |
Superior or Equal test between this and u
u | the vector to test with this |
constexpr T& NRE::Math::Vector4D< T >::operator[] | ( | std::size_t | index | ) |
Return a reference on a vector's object
index | the object's index |
constexpr T const& NRE::Math::Vector4D< T >::operator[] | ( | std::size_t | index | ) | const |
Return a const reference on a vector's object
index | the object's index |
constexpr Vector4D<std::common_type_t<T, K> > NRE::Math::Vector4D< T >::operator^ | ( | Vector4D< K > const & | u | ) | const |
Compute the vector resulting in the cross product of this and u
u | the vector |
constexpr Vector4D& NRE::Math::Vector4D< T >::operator^= | ( | Vector4D< K > const & | u | ) |
Replace this by the cross product between this and u
u | the vector |
constexpr std::common_type_t<T, K> NRE::Math::Vector4D< T >::operator| | ( | Vector4D< K > const & | u | ) | const |
Compute the scalar product between this and u
u | the vector |
constexpr std::common_type_t<T, K> NRE::Math::Vector4D< T >::operator|= | ( | Vector4D< K > const & | u | ) | const |
Compute the scalar product between this and u
u | the vector |
|
inline |
Raise all components to the given power
p | the power to which to raise this |
Vector4D& NRE::Math::Vector4D< T >::pow | ( | Vector4D< K > const & | p | ) |
Raise all components to the given power vector
p | the set of power to which to raise this |
|
inline |
W setter
a | the new value for w |
|
inline |
Z setter
b | the new value for z |
|
inline |
Set the values for x, y, z and w
nX | the new value for x |
nY | the new value for y |
nZ | the new value for z |
nW | the new value for w |
|
inline |
Set the values for x, y, z and w with a base 2D vector
u | the base 2D vector for x and y values |
nZ | the new value for z |
nW | the new value for w |
|
inline |
Set the values for x, y, z and w with a base 3D vector
u | the base 3D vector for x, y and z values |
nW | the new value for w |
|
inline |
Y setter
g | the new value for y |
|
inline |
X setter
r | the new value for x |
|
inline |
Set the values for x, y, z and w
r | the new value for x |
g | the new value for y |
b | the new value for z |
a | the new value for w |
|
inline |
Set the values for x, y, z and w with a base 3D vector
u | the base 3D vector for x, y and z values |
a | the new value for w |
|
inline |
W setter
nW | the new value for w |
|
inline |
X setter
nX | the new value for x |
|
inline |
Y setter
nY | the new value for y |
|
inline |
Z setter
nZ | the new value for z |
Utility::String NRE::Math::Vector4D< T >::toString | ( | ) | const |
Convert the vector into a string
constexpr const T* NRE::Math::Vector4D< T >::value | ( | ) | const |