Vector with 4 floating point components: (x, y, z, w).
More...
#include <kanzi/core/math/vector4.hpp>
|
float | getW () const |
| Returns the w element of the vector.
|
|
float | getX () const |
| Returns the x element of the vector.
|
|
float | getY () const |
| Returns the y element of the vector.
|
|
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.
|
|
Vector4 & | operator*= (float scalar) |
| Multiplies each vector element with a scalar.
|
|
Vector4 & | operator+= (const Vector4 &v) |
| Modifies this vector by adding another vector.
|
|
Vector4 & | operator+= (float scalar) |
| Adds a scalar to each vector element.
|
|
Vector4 & | operator-= (const Vector4 &v) |
| Modifies this vector by subtracting another vector from this vector.
|
|
Vector4 & | operator/= (float scalar) |
| Divides each vector element with a scalar.
|
|
float & | operator[] (size_t index) |
| Access to individual elements of the vector.
|
|
const float & | operator[] (size_t index) const |
| Access to individual elements of the vector.
|
|
void | setW (float value) |
| Sets the w element of the vector.
|
|
void | setX (float value) |
| Sets the x element of the vector.
|
|
void | setY (float value) |
| Sets the y element of the vector.
|
|
void | setZ (float value) |
| Sets the z element of the vector.
|
|
float | squaredLength () const |
| Calculates the squared length of the vector.
|
|
| Vector4 () |
| Default constructor, initializes the vector to (0.0, 0.0, 0.0, 0.0).
|
|
| Vector4 (float v) |
| Constructor, initializes the vector to (v, v, v, v).
|
|
| Vector4 (float x, float y, float z, float w) |
| Constructor, initializes the vector to (x, y, z, w).
|
|
Vector with 4 floating point components: (x, y, z, w).
◆ Vector4() [1/3]
kanzi::Vector4::Vector4 |
( |
| ) |
|
|
inlineexplicit |
Default constructor, initializes the vector to (0.0, 0.0, 0.0, 0.0).
◆ Vector4() [2/3]
kanzi::Vector4::Vector4 |
( |
float | v | ) |
|
|
inlineexplicit |
Constructor, initializes the vector to (v, v, v, v).
- Parameters
-
v | x, y, z, and w component of the vector. |
◆ Vector4() [3/3]
Constructor, initializes the vector to (x, y, z, w).
- Parameters
-
x | x component of the vector. |
y | y component of the vector. |
z | z component of the vector. |
w | w component of the vector. |
◆ operator[]() [1/2]
const float & kanzi::Vector4::operator[] |
( |
size_t | index | ) |
const |
|
inline |
Access to individual elements of the vector.
- Parameters
-
index | Index of the accessed element. Should be either 0, 1, 2, or 3. |
- Returns
- If index is 0, x element. If index is 1, y element. If index is 2, z element. If index is 3, w element.
◆ operator[]() [2/2]
float & kanzi::Vector4::operator[] |
( |
size_t | index | ) |
|
|
inline |
Access to individual elements of the vector.
- Parameters
-
index | Index of the accessed element. Should be either 0, 1, 2, or 3. |
- Returns
- If index is 0, x element. If index is 1, y element. If index is 2, z element. If index is 3, w element.
◆ operator*=()
Multiplies each vector element with a scalar.
- Parameters
-
scalar | Multiplier for each vector element. |
- Returns
- This vector.
◆ operator/=()
Divides each vector element with a scalar.
- Parameters
-
scalar | Divider for each vector element. |
- Returns
- This vector.
◆ operator+=() [1/2]
Adds a scalar to each vector element.
- Parameters
-
scalar | Addition to each vector element. |
- Returns
- This vector.
◆ operator+=() [2/2]
Modifies this vector by adding another vector.
- Parameters
-
- Returns
- This vector.
◆ operator-=()
Modifies this vector by subtracting another vector from this vector.
- Parameters
-
- Returns
- This vector.
◆ zero()
Returns the vector with each element being zero.
- Returns
- Vector with zeroed elements.
◆ one()
Returns the vector with each element being one.
- Returns
- Vector with unit element values.
◆ getX()
float kanzi::Vector4::getX |
( |
| ) |
const |
|
inline |
Returns the x element of the vector.
- Returns
- The x element.
◆ getY()
float kanzi::Vector4::getY |
( |
| ) |
const |
|
inline |
Returns the y element of the vector.
- Returns
- The y element.
◆ getZ()
float kanzi::Vector4::getZ |
( |
| ) |
const |
|
inline |
Returns the z element of the vector.
- Returns
- The z element.
◆ getW()
float kanzi::Vector4::getW |
( |
| ) |
const |
|
inline |
Returns the w element of the vector.
- Returns
- The w element.
◆ setX()
Sets the x element of the vector.
- Parameters
-
value | The new value of the x element. |
◆ setY()
Sets the y element of the vector.
- Parameters
-
value | The new value of the y element. |
◆ setZ()
Sets the z element of the vector.
- Parameters
-
value | The new value of the z element. |
◆ setW()
Sets the w element of the vector.
- Parameters
-
value | The new value of the w element. |
◆ length()
float kanzi::Vector4::length |
( |
| ) |
const |
|
inline |
Calculates the length of the vector.
- Returns
- sqrt(dot product of the vector).
◆ squaredLength()
float kanzi::Vector4::squaredLength |
( |
| ) |
const |
|
inline |
Calculates the squared length of the vector.
- Returns
- Dot product of the vector.
◆ normalized()
Normalizes the vector and returns the resulting vector.
- Returns
- The normalized vector.
◆ lowestValue()
Vector4 kanzi::Vector4::lowestValue |
( |
| ) |
|
|
inlinestatic |
Returns the vector with each element having the most negative float value.
- Returns
- Vector with the lowest possible value.
◆ highestValue()
Vector4 kanzi::Vector4::highestValue |
( |
| ) |
|
|
inlinestatic |
Returns the vector with each element having the most positive float value.
- Returns
- Vector with the highest possible value.
◆ nan()
Returns the vector with each element being NaN.
- Returns
- Vector with NaN elements.
◆ hasNan()
bool kanzi::Vector4::hasNan |
( |
| ) |
const |
|
inline |
Returns true if and only if at least one of the vector values is NaN.
◆ positiveInfinity()
Vector4 kanzi::Vector4::positiveInfinity |
( |
| ) |
|
|
inlinestatic |
Returns the vector with each element being the positive infinity.
- Returns
- Vector with positive infinity elements.
◆ negativeInfinity()
Vector4 kanzi::Vector4::negativeInfinity |
( |
| ) |
|
|
inlinestatic |
Returns the vector with each element being the negative infinity.
- Returns
- Vector with negative infinity elements.
The documentation for this class was generated from the following file: