Vector with 4 floating point components: (x, y, z, w). More...
#include <kanzi/core/math/vector4.hpp>
Public Member Functions | |
| constexpr float | getW () const |
| Returns the w element of the vector. | |
| constexpr float | getX () const |
| Returns the x element of the vector. | |
| constexpr float | getY () const |
| Returns the y element of the vector. | |
| constexpr float | getZ () const |
| Returns the z element of the vector. | |
| bool | hasNan () const |
| Returns true if and only if at least one of the vector values is NaN. | |
| float | length () const |
| Calculates the length of the vector. | |
| KZ_NO_DISCARD Vector4 | normalized () const |
| Normalizes the vector and returns the resulting vector. | |
| constexpr Vector4 & | operator*= (float scalar) |
| Multiplies each vector element with a scalar. | |
| constexpr Vector4 & | operator+= (float scalar) |
| Adds a scalar to each vector element. | |
| constexpr Vector4 & | operator+= (Vector4 v) |
| Modifies this vector by adding another vector. | |
| constexpr Vector4 & | operator-= (Vector4 v) |
| Modifies this vector by subtracting another vector from this vector. | |
| constexpr Vector4 & | operator/= (float scalar) |
| Divides each vector element with a scalar. | |
| constexpr float & | operator[] (size_t index) |
| Access to individual elements of the vector. | |
| constexpr const float & | operator[] (size_t index) const |
| Access to individual elements of the vector. | |
| constexpr void | setW (float value) |
| Sets the w element of the vector. | |
| constexpr void | setX (float value) |
| Sets the x element of the vector. | |
| constexpr void | setY (float value) |
| Sets the y element of the vector. | |
| constexpr void | setZ (float value) |
| Sets the z element of the vector. | |
| constexpr float | squaredLength () const |
| Calculates the squared length of the vector. | |
| constexpr | Vector4 () |
| Default constructor. | |
| constexpr | Vector4 (float v) |
| Constructor. | |
| constexpr | Vector4 (float x, float y, float z, float w) |
| Constructor, initializes the vector to (x, y, z, w). | |
Static Public Member Functions | |
| static Vector4 | highestValue () |
| Returns the vector with each element having the most positive float value. | |
| static Vector4 | lowestValue () |
| Returns the vector with each element having the most negative float value. | |
| static Vector4 | nan () |
| Returns the vector with each element being NaN. | |
| static Vector4 | negativeInfinity () |
| Returns the vector with each element being the negative infinity. | |
| static constexpr Vector4 | one () |
| Returns the vector with each element being one. | |
| static Vector4 | positiveInfinity () |
| Returns the vector with each element being the positive infinity. | |
| static constexpr Vector4 | zero () |
| Returns the vector with each element being zero. | |
Vector with 4 floating point components: (x, y, z, w).
|
inlineexplicitconstexpr |
Default constructor.
Initializes the vector to (0.0, 0.0, 0.0, 0.0).
Constructor.
Initializes the vector to (v, v, v, v).
| v | x, y, z, and w component of the vector. |
Constructor, initializes the vector to (x, y, z, w).
| x | x component of the vector. |
| y | y component of the vector. |
| z | z component of the vector. |
| w | w component of the vector. |
Access to individual elements of the vector.
| index | Index of the accessed element. Should be either 0, 1, 2, or 3. |
Access to individual elements of the vector.
| index | Index of the accessed element. Should be either 0, 1, 2, or 3. |
Multiplies each vector element with a scalar.
| scalar | Multiplier for each vector element. |
Divides each vector element with a scalar.
| scalar | Divider for each vector element. |
Adds a scalar to each vector element.
| scalar | Addition to each vector element. |
Modifies this vector by adding another vector.
| v | Another vector. |
Modifies this vector by subtracting another vector from this vector.
| v | Another vector. |
Returns the vector with each element being zero.
Returns the vector with each element being one.
Returns the x element of the vector.
Returns the y element of the vector.
Returns the z element of the vector.
Returns the w element of the vector.
Sets the x element of the vector.
| value | The new value of the x element. |
Sets the y element of the vector.
| value | The new value of the y element. |
Sets the z element of the vector.
| value | The new value of the z element. |
Sets the w element of the vector.
| value | The new value of the w element. |
|
inline |
Calculates the length of the vector.
Calculates the squared length of the vector.
|
inline |
Normalizes the vector and returns the resulting vector.
|
inlinestatic |
Returns the vector with each element having the most negative float value.
|
inlinestatic |
Returns the vector with each element having the most positive float value.
|
inlinestatic |
Returns the vector with each element being NaN.
|
inline |
Returns true if and only if at least one of the vector values is NaN.
|
inlinestatic |
Returns the vector with each element being the positive infinity.
|
inlinestatic |
Returns the vector with each element being the negative infinity.