Vector with 3 floating point components: (x, y, z).
More...
#include <kanzi/core/math/vector3.hpp>
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. |
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.
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.
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 |
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
Vector3 kanzi::Vector3::normalized |
( |
| ) |
const |
|
inline |
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::isNaN |
( |
| ) |
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.
Returns the unit vector pointing right.
- Returns
- Vector3(1.0f, 0.0f, 0.0f).
Returns the unit vector pointing up.
- Returns
- Vector3(0.0f, 1.0f, 0.0f).
Vector3 kanzi::Vector3::backward |
( |
| ) |
|
|
inlinestatic |
Returns the unit vector pointing backward.
- Returns
- Vector3(0.0f, 0.0f, 1.0f).
Returns the unit vector pointing left.
- Returns
- Vector3(-1.0f, 0.0f, 0.0f).
Returns the unit vector pointing down.
- Returns
- Vector3(0.0f, -1.0f, 0.0f).
Vector3 kanzi::Vector3::forward |
( |
| ) |
|
|
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: