A 4-component vector class, with floats.
More...
|
static float | distanceVec2 (const Vector &a, const Vector &b) |
|
static float | distanceVec3 (const Vector &a, const Vector &b) |
|
static float | distanceVec4 (const Vector &a, const Vector &b) |
|
static float | distanceSquaredVec2 (const Vector &a, const Vector &b) |
|
static float | distanceSquaredVec3 (const Vector &a, const Vector &b) |
|
static float | distanceSquaredVec4 (const Vector &a, const Vector &b) |
|
static float | dotVec2 (const Vector &a, const Vector &b) |
|
static float | dotVec3 (const Vector &a, const Vector &b) |
|
static float | dotVec4 (const Vector &a, const Vector &b) |
|
static Vector | crossVec3 (const Vector &a, const Vector &b) |
|
|
float | _x |
| X component of the vector.
|
|
float | _y |
| Y component of the vector.
|
|
float | _z |
| Z component of the vector.
|
|
float | _w |
| W component of the vector.
|
|
A 4-component vector class, with floats.
◆ Vector() [1/6]
nkMaths::Vector::Vector |
( |
| ) |
|
|
noexcept |
Default constructor. Defaults all components to 0.
◆ Vector() [2/6]
nkMaths::Vector::Vector |
( |
float |
x, |
|
|
float |
y |
|
) |
| |
|
noexcept |
2D constructor.
- Parameters
-
x | The x component to assign. |
y | The y component to assign. |
◆ Vector() [3/6]
nkMaths::Vector::Vector |
( |
float |
x, |
|
|
float |
y, |
|
|
float |
z |
|
) |
| |
|
noexcept |
3D constructor.
- Parameters
-
x | The x component to assign. |
y | The y component to assign. |
z | The z component to assign. |
◆ Vector() [4/6]
nkMaths::Vector::Vector |
( |
float |
x, |
|
|
float |
y, |
|
|
float |
z, |
|
|
float |
w |
|
) |
| |
|
noexcept |
4D constructor.
- Parameters
-
x | The x component to assign. |
y | The y component to assign. |
z | The z component to assign. |
w | The w component to assign. |
◆ Vector() [5/6]
nkMaths::Vector::Vector |
( |
const Vector & |
other | ) |
|
|
noexcept |
Copy constructor.
- Parameters
-
other | The vector to copy from. |
◆ Vector() [6/6]
nkMaths::Vector::Vector |
( |
const IntVector & |
other | ) |
|
|
noexcept |
Copy constructor.
- Parameters
-
other | The vector to copy from. |
◆ getLengthVec2()
float nkMaths::Vector::getLengthVec2 |
( |
| ) |
const |
- Returns
- The length of the vector, as if it was a 2D vector.
◆ getLengthVec3()
float nkMaths::Vector::getLengthVec3 |
( |
| ) |
const |
- Returns
- The length of the vector, as if it was a 3D vector.
◆ getLengthVec4()
float nkMaths::Vector::getLengthVec4 |
( |
| ) |
const |
- Returns
- The length of the vector, as if it was a 4D vector.
◆ getLengthSquaredVec2()
float nkMaths::Vector::getLengthSquaredVec2 |
( |
| ) |
const |
- Returns
- The squared length of the vector as if it was a 2D vector.
◆ getLengthSquaredVec3()
float nkMaths::Vector::getLengthSquaredVec3 |
( |
| ) |
const |
- Returns
- The squared length of the vector as if it was a 3D vector.
◆ getLengthSquaredVec4()
float nkMaths::Vector::getLengthSquaredVec4 |
( |
| ) |
const |
- Returns
- The squared length of the vector as if it was a 4D vector.
◆ getDistanceVec2()
float nkMaths::Vector::getDistanceVec2 |
( |
const Vector & |
other | ) |
const |
- Parameters
-
other | The vector to check the distance with. |
- Returns
- The distance between both vectors, as if they were 2D vectors.
◆ getDistanceVec3()
float nkMaths::Vector::getDistanceVec3 |
( |
const Vector & |
other | ) |
const |
- Parameters
-
other | The vector to check the distance with. |
- Returns
- The distance between both vectors, as if they were 3D vectors.
◆ getDistanceVec4()
float nkMaths::Vector::getDistanceVec4 |
( |
const Vector & |
other | ) |
const |
- Parameters
-
other | The vector to check the distance with. |
- Returns
- The distance between both vectors, as if they were 4D vectors.
◆ getDistanceSquaredVec2()
float nkMaths::Vector::getDistanceSquaredVec2 |
( |
const Vector & |
other | ) |
const |
- Parameters
-
other | The vector to check the distance with. |
- Returns
- The squared distance between both vectors, as if they were 2D vectors.
◆ getDistanceSquaredVec3()
float nkMaths::Vector::getDistanceSquaredVec3 |
( |
const Vector & |
other | ) |
const |
- Parameters
-
other | The vector to check the distance with. |
- Returns
- The squared distance between both vectors, as if they were 3D vectors.
◆ getDistanceSquaredVec4()
float nkMaths::Vector::getDistanceSquaredVec4 |
( |
const Vector & |
other | ) |
const |
- Parameters
-
other | The vector to check the distance with. |
- Returns
- The squared distance between both vectors, as if they were 4D vectors.
◆ normalizeVec2()
Vector& nkMaths::Vector::normalizeVec2 |
( |
| ) |
|
Normalizes the vector, interpreting it as a 2D vector.
◆ normalizeVec3()
Vector& nkMaths::Vector::normalizeVec3 |
( |
| ) |
|
Normalizes the vector, interpreting it as a 3D vector.
◆ normalizeVec4()
Vector& nkMaths::Vector::normalizeVec4 |
( |
| ) |
|
Normalizes the vector, interpreting it as a 4D vector.
◆ getNormalizedVec2()
Vector nkMaths::Vector::getNormalizedVec2 |
( |
| ) |
const |
- Returns
- A vector corresponding to this vector interpreted as a 2D vector and normalized.
◆ getNormalizedVec3()
Vector nkMaths::Vector::getNormalizedVec3 |
( |
| ) |
const |
- Returns
- A vector corresponding to this vector interpreted as a 3D vector and normalized.
◆ getNormalizedVec4()
Vector nkMaths::Vector::getNormalizedVec4 |
( |
| ) |
const |
- Returns
- A vector corresponding to this vector interpreted as a 4D vector and normalized.
◆ dotProductVec2()
float nkMaths::Vector::dotProductVec2 |
( |
const Vector & |
other | ) |
const |
Computes the dot product, interpreting both vectors as 2D vectors.
- Parameters
-
other | The vector to compute the product with. |
- Returns
- The resulting dot product computed.
◆ dotProductVec3()
float nkMaths::Vector::dotProductVec3 |
( |
const Vector & |
other | ) |
const |
Computes the dot product, interpreting both vectors as 3D vectors.
- Parameters
-
other | The vector to compute the product with. |
- Returns
- The resulting dot product computed.
◆ dotProductVec4()
float nkMaths::Vector::dotProductVec4 |
( |
const Vector & |
other | ) |
const |
Computes the dot product, interpreting both vectors as 4D vectors.
- Parameters
-
other | The vector to compute the product with. |
- Returns
- The resulting dot product computed.
◆ setAsCrossVec3()
Vector& nkMaths::Vector::setAsCrossVec3 |
( |
const Vector & |
other | ) |
|
Computes and sets in place the cross product, interpreting both vectors as 3D vectors.
- Parameters
-
other | The vector to compute the product with. |
◆ getCrossVec3()
Vector nkMaths::Vector::getCrossVec3 |
( |
const Vector & |
other | ) |
const |
Computes the cross product, interpreting both vectors as 3D vectors.
- Parameters
-
other | The vector to compute the product with. |
- Returns
- The resulting cross product computed.
◆ toString()
- Returns
- The vector expressed as a string, formatted as "x, y, z, w".
◆ fromString()
Parse components from a string. Format is "x,y,z,w".
- Parameters
-
- Returns
- The updated vector instance.
◆ operator=() [1/2]
Assignment operator.
- Parameters
-
other | The vector to overwrite from. |
- Returns
- The calling vector, updated.
◆ operator=() [2/2]
Assignment operator.
- Parameters
-
other | The vector to overwrite from. |
- Returns
- The calling vector, updated.
◆ operator+()
Vector nkMaths::Vector::operator+ |
( |
const Vector & |
other | ) |
const |
Addition operator.
- Parameters
-
other | The vector to operate with. |
- Returns
- A result vector, after operation application.
◆ operator+=()
void nkMaths::Vector::operator+= |
( |
const Vector & |
other | ) |
|
Addition and assignment operator.
- Parameters
-
other | The vector to operate with. |
◆ operator-() [1/2]
Vector nkMaths::Vector::operator- |
( |
| ) |
const |
Negation operator.
- Returns
- A result vector, with all its members negated.
◆ operator-() [2/2]
Vector nkMaths::Vector::operator- |
( |
const Vector & |
other | ) |
const |
Subtraction operator.
- Parameters
-
other | The vector to operate with. |
- Returns
- A result vector, after operation application.
◆ operator-=()
void nkMaths::Vector::operator-= |
( |
const Vector & |
other | ) |
|
Subtraction and assignment operator.
- Parameters
-
other | The vector to operate with. |
◆ operator*() [1/4]
Vector nkMaths::Vector::operator* |
( |
const Vector & |
other | ) |
const |
Multiplication operator.
- Parameters
-
other | The vector to operate with. |
- Returns
- A result vector, after operation application.
◆ operator*=() [1/4]
void nkMaths::Vector::operator*= |
( |
const Vector & |
other | ) |
|
Multiplication and assignment operator.
- Parameters
-
other | The vector to operate with. |
◆ operator*() [2/4]
Multiplication operator.
- Parameters
-
other | The quaternion to operate with. |
- Returns
- A result vector, after transformation.
◆ operator*=() [2/4]
void nkMaths::Vector::operator*= |
( |
const Quaternion & |
other | ) |
|
Multiplication and assignment operator.
- Parameters
-
other | The quaternion to operate with. |
◆ operator*() [3/4]
Vector nkMaths::Vector::operator* |
( |
const Matrix & |
mat | ) |
const |
Multiplication operator.
- Parameters
-
mat | The matrix to operate with. |
- Returns
- A result vector, after transformation.
◆ operator*=() [3/4]
void nkMaths::Vector::operator*= |
( |
const Matrix & |
other | ) |
|
Multiplication and assignment operator.
- Parameters
-
other | The matrix to operate with. |
◆ operator*() [4/4]
Vector nkMaths::Vector::operator* |
( |
float |
coeff | ) |
const |
Multiplication operator.
- Parameters
-
coeff | The scalar to operate with. |
- Returns
- A result vector, after operation application on all components.
◆ operator*=() [4/4]
void nkMaths::Vector::operator*= |
( |
float |
coeff | ) |
|
Multiplication and assignment operator.
- Parameters
-
coeff | The scalar to operate with. |
◆ operator/() [1/2]
Vector nkMaths::Vector::operator/ |
( |
const Vector & |
other | ) |
const |
Division operator.
- Parameters
-
other | The vector to operate with. |
- Returns
- A result vector, after operation application.
◆ operator/=() [1/2]
void nkMaths::Vector::operator/= |
( |
const Vector & |
other | ) |
|
Division and assignment operator.
- Parameters
-
other | The vector to operate with. |
◆ operator/() [2/2]
Vector nkMaths::Vector::operator/ |
( |
float |
coeff | ) |
const |
Division operator.
- Parameters
-
coeff | The scalar to operate with. |
- Returns
- A result vector, after operation application on all components.
◆ operator/=() [2/2]
void nkMaths::Vector::operator/= |
( |
float |
coeff | ) |
|
Division and assignment operator.
- Parameters
-
coeff | The scalar to operate with. |
◆ operator==()
bool nkMaths::Vector::operator== |
( |
const Vector & |
other | ) |
const |
Equality operator.
- Parameters
-
other | The vector to check against. |
- Returns
- If the vectors are equal (true) or not (false).
◆ operator!=()
bool nkMaths::Vector::operator!= |
( |
const Vector & |
other | ) |
const |
Difference operator.
- Parameters
-
other | The vector to check against. |
- Returns
- If the vectors are different (true) or not (false).
◆ operator<()
bool nkMaths::Vector::operator< |
( |
const Vector & |
other | ) |
const |
Less than operator.
- Parameters
-
other | The vector to check against. |
- Returns
- If the calling vector is smaller (true) or not (false).
◆ operator<=()
bool nkMaths::Vector::operator<= |
( |
const Vector & |
other | ) |
const |
Less than or equal operator.
- Parameters
-
other | The vector to check against. |
- Returns
- If the calling vector is smaller, equal (true) or not (false).
◆ operator>()
bool nkMaths::Vector::operator> |
( |
const Vector & |
other | ) |
const |
Greater than operator.
- Parameters
-
other | The vector to check against. |
- Returns
- If the calling vector is greater (true) or not (false).
◆ operator>=()
bool nkMaths::Vector::operator>= |
( |
const Vector & |
other | ) |
const |
Greater than or equal operator.
- Parameters
-
other | The vector to check against. |
- Returns
- If the calling vector is greater, equal (true) or not (false).
◆ distanceVec2()
static float nkMaths::Vector::distanceVec2 |
( |
const Vector & |
a, |
|
|
const Vector & |
b |
|
) |
| |
|
static |
Static version for a.getDistanceVec2(b).
- Parameters
-
a | The left operand. |
b | The right operand. |
- Returns
- The result of the operation.
◆ distanceVec3()
static float nkMaths::Vector::distanceVec3 |
( |
const Vector & |
a, |
|
|
const Vector & |
b |
|
) |
| |
|
static |
Static version for a.getDistanceVec3(b).
- Parameters
-
a | The left operand. |
b | The right operand. |
- Returns
- The result of the operation.
◆ distanceVec4()
static float nkMaths::Vector::distanceVec4 |
( |
const Vector & |
a, |
|
|
const Vector & |
b |
|
) |
| |
|
static |
Static version for a.getDistanceVec4(b).
- Parameters
-
a | The left operand. |
b | The right operand. |
- Returns
- The result of the operation.
◆ distanceSquaredVec2()
static float nkMaths::Vector::distanceSquaredVec2 |
( |
const Vector & |
a, |
|
|
const Vector & |
b |
|
) |
| |
|
static |
Static version for a.getDistanceSquaredVec2(b).
- Parameters
-
a | The left operand. |
b | The right operand. |
- Returns
- The result of the operation.
◆ distanceSquaredVec3()
static float nkMaths::Vector::distanceSquaredVec3 |
( |
const Vector & |
a, |
|
|
const Vector & |
b |
|
) |
| |
|
static |
Static version for a.getDistanceSquaredVec3(b).
- Parameters
-
a | The left operand. |
b | The right operand. |
- Returns
- The result of the operation.
◆ distanceSquaredVec4()
static float nkMaths::Vector::distanceSquaredVec4 |
( |
const Vector & |
a, |
|
|
const Vector & |
b |
|
) |
| |
|
static |
Static version for a.getDistanceSquaredVec4(b).
- Parameters
-
a | The left operand. |
b | The right operand. |
- Returns
- The result of the operation.
◆ dotVec2()
static float nkMaths::Vector::dotVec2 |
( |
const Vector & |
a, |
|
|
const Vector & |
b |
|
) |
| |
|
static |
Static version for a.dotProductVec2(b).
- Parameters
-
a | The left operand. |
b | The right operand. |
- Returns
- The result of the operation.
◆ dotVec3()
static float nkMaths::Vector::dotVec3 |
( |
const Vector & |
a, |
|
|
const Vector & |
b |
|
) |
| |
|
static |
Static version for a.dotProductVec3(b).
- Parameters
-
a | The left operand. |
b | The right operand. |
- Returns
- The result of the operation.
◆ dotVec4()
static float nkMaths::Vector::dotVec4 |
( |
const Vector & |
a, |
|
|
const Vector & |
b |
|
) |
| |
|
static |
Static version for a.dotProductVec3(b).
- Parameters
-
a | The left operand. |
b | The right operand. |
- Returns
- The result of the operation.
◆ crossVec3()
Static version for a.getCrossVec3(b).
- Parameters
-
a | The left operand. |
b | The right operand. |
- Returns
- The result of the operation.
The documentation for this class was generated from the following file:
- Documentation/Headers/NilkinsMaths/Algebra/Vector.h