Vector with 3 floating point components: (x, y, z).
More...
#include <kanzi/core/math/vector3.hpp>
|
float | getX () const |
| Returns the x element of the vector. More...
|
|
float | getY () const |
| Returns the y element of the vector. More...
|
|
float | getZ () const |
| Returns the z element of the vector. More...
|
|
bool | hasNan () const |
| Returns true if and only if at least one of the vector values is NaN. More...
|
|
float | length () const |
| Calculates the length a vectors. More...
|
|
Vector3 | maximumAxis () const |
| Returns axis based on the largest component of Vector3. More...
|
|
Vector3 | minimumAxis () const |
| Returns axis based on the minimum component of Vector3. More...
|
|
KZ_NO_DISCARD Vector3 | normalized () const |
| Normalizes the vector and returns the resulting vector. More...
|
|
Vector3 & | operator*= (float scalar) |
| Multiplies each vector element with a scalar. More...
|
|
Vector3 & | operator+= (float scalar) |
| Adds a scalar to each vector element. More...
|
|
Vector3 & | operator+= (const Vector3 &v) |
| Modifies this vector by adding another vector. More...
|
|
Vector3 & | operator-= (const Vector3 &v) |
| Modifies this vector by subtracting another vector from this vector. More...
|
|
Vector3 & | operator/= (float scalar) |
| Divides each vector element with a scalar. More...
|
|
const float & | operator[] (size_t index) const |
| Access to individual elements of the vector. More...
|
|
float & | operator[] (size_t index) |
| Access to individual elements of the vector. More...
|
|
void | setX (float value) |
| Sets the x element of the vector. More...
|
|
void | setY (float value) |
| Sets the y element of the vector. More...
|
|
void | setZ (float value) |
| Sets the z element of the vector. More...
|
|
float | squaredLength () const |
| Calculates the squared length a vectors. More...
|
|
| Vector3 () |
| Default constructor, initializes the vector to (0.0, 0.0, 0.0). More...
|
|
| Vector3 (float x, float y, float z) |
| Constructor, initializes the vector to (x, y, z). More...
|
|
| Vector3 (float v) |
| Constructor, initializes the vector to (v, v, v). More...
|
|
Vector with 3 floating point components: (x, y, z).
kanzi::Vector3::Vector3 |
( |
| ) |
|
|
inlineexplicit |
Default constructor, initializes the vector to (0.0, 0.0, 0.0).
kanzi::Vector3::Vector3 |
( |
float |
x, |
|
|
float |
y, |
|
|
float |
z |
|
) |
| |
|
inlineexplicit |
Constructor, initializes the vector to (x, y, z).
- Parameters
-
x | x component of the vector. |
y | y component of the vector. |
z | z component of the vector. |
kanzi::Vector3::Vector3 |
( |
float |
v | ) |
|
|
inlineexplicit |
Constructor, initializes the vector to (v, v, v).
- Parameters
-
v | x, y and z components of the vector. |
const float& kanzi::Vector3::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, or 2. |
- Returns
- If index is 0, x element. If index is 1, y element. If index is 2, z element.
float& kanzi::Vector3::operator[] |
( |
size_t |
index | ) |
|
|
inline |
Access to individual elements of the vector.
- Parameters
-
index | Index of the accessed element. Should be either 0, 1, or 2. |
- Returns
- If index is 0, reference to x element. If index is 1, reference to y element. If index is 2, reference to z element.
Vector3& kanzi::Vector3::operator*= |
( |
float |
scalar | ) |
|
|
inline |
Multiplies each vector element with a scalar.
- Parameters
-
scalar | Multiplier for each vector element. |
- Returns
- This vector.
Vector3& kanzi::Vector3::operator/= |
( |
float |
scalar | ) |
|
|
inline |
Divides each vector element with a scalar.
- Parameters
-
scalar | Divider for each vector element. |
- Returns
- This vector.
Vector3& kanzi::Vector3::operator+= |
( |
float |
scalar | ) |
|
|
inline |
Adds a scalar to each vector element.
- Parameters
-
scalar | Addition to each vector element. |
- Returns
- This vector.
Modifies this vector by adding another vector.
- Parameters
-
- Returns
- This vector.
Modifies this vector by subtracting another vector from this vector.
- Parameters
-
- Returns
- This vector.
Returns the vector with each element being zero.
- Returns
- Vector with zeroed elements.
Returns the vector with each element being one.
- Returns
- Vector with unit element values.
float kanzi::Vector3::getX |
( |
| ) |
const |
|
inline |
Returns the x element of the vector.
- Returns
- The x element.
float kanzi::Vector3::getY |
( |
| ) |
const |
|
inline |
Returns the y element of the vector.
- Returns
- The y element.
float kanzi::Vector3::getZ |
( |
| ) |
const |
|
inline |
Returns the z element of the vector.
- Returns
- The z element.
void kanzi::Vector3::setX |
( |
float |
value | ) |
|
|
inline |
Sets the x element of the vector.
- Parameters
-
value | The new value of the x element. |
void kanzi::Vector3::setY |
( |
float |
value | ) |
|
|
inline |
Sets the y element of the vector.
- Parameters
-
value | The new value of the y element. |
void kanzi::Vector3::setZ |
( |
float |
value | ) |
|
|
inline |
Sets the z element of the vector.
- Parameters
-
value | The new value of the z element. |
Vector3 kanzi::Vector3::minimumAxis |
( |
| ) |
const |
|
inline |
Returns axis based on the minimum component of Vector3.
- Returns
- If X component is smallest, (1, 0, 0), else if Y component is smallest, (0, 1, 0), else (0, 0, 1).
Vector3 kanzi::Vector3::maximumAxis |
( |
| ) |
const |
|
inline |
Returns axis based on the largest component of Vector3.
- Returns
- If X component is largest, (1, 0, 0), else if Y component is largest, (0, 1, 0), else (0, 0, 1).
float kanzi::Vector3::length |
( |
| ) |
const |
|
inline |
Calculates the length a vectors.
- Returns
- sqrt(x*x + y*y + z*z)
float kanzi::Vector3::squaredLength |
( |
| ) |
const |
|
inline |
Calculates the squared length a vectors.
- Returns
- x*x + y*y + z*z
Normalizes the vector and returns the resulting vector.
- Returns
- The normalized vector.
Vector3 kanzi::Vector3::lowestValue |
( |
| ) |
|
|
inlinestatic |
Returns the vector with each element having the most negative float value.
- Returns
- Vector with the lowest possible value.
Vector3 kanzi::Vector3::highestValue |
( |
| ) |
|
|
inlinestatic |
Returns the vector with each element having the most positive float value.
- Returns
- Vector with the highest possible value.
Returns the vector with each element being NaN.
- Returns
- Vector with NaN elements.
bool kanzi::Vector3::hasNan |
( |
| ) |
const |
|
inline |
Returns true if and only if at least one of the vector values is NaN.
Vector3 kanzi::Vector3::positiveInfinity |
( |
| ) |
|
|
inlinestatic |
Returns the vector with each element being the positive infinity.
- Returns
- Vector with positive infinity elements.
Vector3 kanzi::Vector3::negativeInfinity |
( |
| ) |
|
|
inlinestatic |
Returns the vector with each element being the negative infinity.
- Returns
- Vector with negative infinity elements.
Vector3 kanzi::Vector3::positiveX |
( |
| ) |
|
|
inlinestatic |
Returns the unit vector pointing right.
- Returns
- Vector3(1.0f, 0.0f, 0.0f).
Vector3 kanzi::Vector3::positiveY |
( |
| ) |
|
|
inlinestatic |
Returns the unit vector pointing up.
- Returns
- Vector3(0.0f, 1.0f, 0.0f).
Vector3 kanzi::Vector3::positiveZ |
( |
| ) |
|
|
inlinestatic |
Returns the unit vector pointing backward.
- Returns
- Vector3(0.0f, 0.0f, 1.0f).
Vector3 kanzi::Vector3::negativeX |
( |
| ) |
|
|
inlinestatic |
Returns the unit vector pointing left.
- Returns
- Vector3(-1.0f, 0.0f, 0.0f).
Vector3 kanzi::Vector3::negativeY |
( |
| ) |
|
|
inlinestatic |
Returns the unit vector pointing down.
- Returns
- Vector3(0.0f, -1.0f, 0.0f).
Vector3 kanzi::Vector3::negativeZ |
( |
| ) |
|
|
inlinestatic |
Returns the unit vector pointing forward.
- Returns
- Vector3(0.0f, 0.0f, -1.0f).
The documentation for this class was generated from the following file: