Vector with 3 floating point components: (x, y, z). More...
#include <kanzi/core/math/vector3.hpp>
Public Member Functions | |
| 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 a vectors. | |
| Vector3 | maximumAxis () const |
| Returns axis based on the largest component of Vector3. | |
| Vector3 | minimumAxis () const |
| Returns axis based on the minimum component of Vector3. | |
| KZ_NO_DISCARD Vector3 | normalized () const |
| Normalizes the vector and returns the resulting vector. | |
| constexpr Vector3 & | operator*= (float scalar) |
| Multiplies each vector element with a scalar. | |
| constexpr Vector3 & | operator+= (float scalar) |
| Adds a scalar to each vector element. | |
| constexpr Vector3 & | operator+= (Vector3 v) |
| Modifies this vector by adding another vector. | |
| constexpr Vector3 & | operator-= (Vector3 v) |
| Modifies this vector by subtracting another vector from this vector. | |
| constexpr Vector3 & | 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 | 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 a vectors. | |
| constexpr | Vector3 () |
| Default constructor. | |
| constexpr | Vector3 (float v) |
| Constructor. | |
| constexpr | Vector3 (float x, float y, float z) |
| Constructor, initializes the vector to (x, y, z). | |
Static Public Member Functions | |
| static constexpr Vector3 | highestValue () |
| Returns the vector with each element having the most positive float value. | |
| static constexpr Vector3 | lowestValue () |
| Returns the vector with each element having the most negative float value. | |
| static constexpr Vector3 | nan () |
| Returns the vector with each element being NaN. | |
| static constexpr Vector3 | negativeInfinity () |
| Returns the vector with each element being the negative infinity. | |
| static constexpr Vector3 | negativeX () |
| Returns the unit vector pointing left. | |
| static constexpr Vector3 | negativeY () |
| Returns the unit vector pointing down. | |
| static constexpr Vector3 | negativeZ () |
| Returns the unit vector pointing forward. | |
| static KZ_NO_DISCARD constexpr const Vector3 | one () |
| Returns the vector with each element being one. | |
| static constexpr Vector3 | positiveInfinity () |
| Returns the vector with each element being the positive infinity. | |
| static constexpr Vector3 | positiveX () |
| Returns the unit vector pointing right. | |
| static constexpr Vector3 | positiveY () |
| Returns the unit vector pointing up. | |
| static constexpr Vector3 | positiveZ () |
| Returns the unit vector pointing backward. | |
| static KZ_NO_DISCARD constexpr const Vector3 | zero () |
| Returns the vector with each element being zero. | |
Vector with 3 floating point components: (x, y, z).
|
inlineexplicitconstexpr |
Default constructor.
Initializes the vector to (0.0, 0.0, 0.0).
Constructor, initializes the vector to (x, y, z).
| x | X component of the vector. |
| y | Y component of the vector. |
| z | Z component of the vector. |
Constructor.
Initializes the vector to (v, v, v).
| v | X, Y and Z components of the vector. |
Access to individual elements of the vector.
| index | Index of the accessed element. Should be either 0, 1, or 2. |
Access to individual elements of the vector.
| index | Index of the accessed element. Should be either 0, 1, or 2. |
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. |
|
inlinestaticconstexpr |
Returns the vector with each element being zero.
|
inlinestaticconstexpr |
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.
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. |
|
inline |
Returns axis based on the minimum component of Vector3.
|
inline |
Returns axis based on the largest component of Vector3.
|
inline |
Calculates the length a vectors.
Calculates the squared length a vectors.
|
inline |
Normalizes the vector and returns the resulting vector.
Returns the vector with each element having the most negative float value.
Returns the vector with each element having the most positive float value.
Returns the vector with each element being NaN.
|
inline |
Returns true if and only if at least one of the vector values is NaN.
Returns the vector with each element being the positive infinity.
Returns the vector with each element being the negative infinity.
Returns the unit vector pointing right.
Returns the unit vector pointing up.
Returns the unit vector pointing backward.
Returns the unit vector pointing left.
Returns the unit vector pointing down.
Returns the unit vector pointing forward.