Holds a 3D vector.
More...
#include <Vec3.hpp>
|
| double | x { 0.0 } |
| |
| double | y { 0.0 } |
| |
| double | z { 0.0 } |
| |
◆ Vec3() [1/4]
| constexpr nc::Vec3::Vec3 |
( |
| ) |
|
|
constexprdefault |
◆ Vec3() [2/4]
| constexpr nc::Vec3::Vec3 |
( |
double |
inX, |
|
|
double |
inY, |
|
|
double |
inZ |
|
) |
| |
|
inlineconstexprnoexcept |
Constructor
- Parameters
-
| inX | the x component |
| inY | the y component |
| inZ | the y component |
◆ Vec3() [3/4]
| nc::Vec3::Vec3 |
( |
const std::initializer_list< double > & |
inList | ) |
|
|
inline |
◆ Vec3() [4/4]
| nc::Vec3::Vec3 |
( |
const NdArray< double > & |
ndArray | ) |
|
|
inline |
◆ angle()
| double nc::Vec3::angle |
( |
const Vec3 & |
otherVec | ) |
const |
|
inlinenoexcept |
Returns the angle between the two vectors
- Parameters
-
- Returns
- the angle in radians
◆ back()
| static constexpr Vec3 nc::Vec3::back |
( |
| ) |
|
|
inlinestaticconstexprnoexcept |
Returns the unit vector [0, 0, -1]
- Returns
- Vec3
◆ clampMagnitude()
| Vec3 nc::Vec3::clampMagnitude |
( |
double |
maxLength | ) |
const |
|
inlinenoexcept |
Returns a copy of the vector with its magnitude clamped to maxLength
- Parameters
-
- Returns
- Vec3
◆ cross()
| Vec3 nc::Vec3::cross |
( |
const Vec3 & |
otherVec | ) |
const |
|
inlinenoexcept |
Returns the cross product of the two vectors
- Parameters
-
- Returns
- the dot product
◆ distance()
| double nc::Vec3::distance |
( |
const Vec3 & |
otherVec | ) |
const |
|
inlinenoexcept |
Returns the distance between the two vectors
- Parameters
-
- Returns
- the distance (equivalent to (a - b).norm()
◆ dot()
| double nc::Vec3::dot |
( |
const Vec3 & |
otherVec | ) |
const |
|
inlinenoexcept |
Returns the dot product of the two vectors
- Parameters
-
- Returns
- the dot product
◆ down()
| static constexpr Vec3 nc::Vec3::down |
( |
| ) |
|
|
inlinestaticconstexprnoexcept |
Returns the unit vector [0, -1, 0]
- Returns
- Vec3
◆ forward()
| static constexpr Vec3 nc::Vec3::forward |
( |
| ) |
|
|
inlinestaticconstexprnoexcept |
Returns the unit vector [0, 0, 1]
- Returns
- Vec3
◆ left()
| static constexpr Vec3 nc::Vec3::left |
( |
| ) |
|
|
inlinestaticconstexprnoexcept |
Returns the unit vector [-1, 0, 0]
- Returns
- Vec3
◆ lerp()
| Vec3 nc::Vec3::lerp |
( |
const Vec3 & |
otherVec, |
|
|
double |
t |
|
) |
| const |
|
inlinenoexcept |
Linearly interpolates between two vectors
- Parameters
-
| otherVec | |
| t | the amount to interpolate by (clamped from [0, 1]); |
- Returns
- Vec3
◆ norm()
| double nc::Vec3::norm |
( |
| ) |
const |
|
inlinenoexcept |
Returns the magnitude of the vector
- Returns
- magnitude of the vector
◆ normalize()
| Vec3 nc::Vec3::normalize |
( |
| ) |
const |
|
inlinenoexcept |
Returns a new normalized Vec3
- Returns
- Vec3
◆ operator!=()
| bool nc::Vec3::operator!= |
( |
const Vec3 & |
rhs | ) |
const |
|
inlinenoexcept |
Not Equality operator
- Parameters
-
- Returns
- bool
◆ operator*=()
| Vec3& nc::Vec3::operator*= |
( |
double |
scaler | ) |
|
|
inlinenoexcept |
Scalar mulitplication
- Parameters
-
- Returns
- Vec3
◆ operator+=() [1/2]
| Vec3& nc::Vec3::operator+= |
( |
const Vec3 & |
rhs | ) |
|
|
inlinenoexcept |
Adds the two vectors
- Parameters
-
- Returns
- Vec3
◆ operator+=() [2/2]
| Vec3& nc::Vec3::operator+= |
( |
double |
scaler | ) |
|
|
inlinenoexcept |
Adds the scaler to the vector
- Parameters
-
- Returns
- Vec3
◆ operator-=() [1/2]
| Vec3& nc::Vec3::operator-= |
( |
const Vec3 & |
rhs | ) |
|
|
inlinenoexcept |
Subtracts the two vectors
- Parameters
-
- Returns
- Vec3
◆ operator-=() [2/2]
| Vec3& nc::Vec3::operator-= |
( |
double |
scaler | ) |
|
|
inlinenoexcept |
Subtracts the scaler from the vector
- Parameters
-
- Returns
- Vec3
◆ operator/=()
| Vec3& nc::Vec3::operator/= |
( |
double |
scaler | ) |
|
|
inlinenoexcept |
Scalar division
- Parameters
-
- Returns
- Vec3
◆ operator==()
| bool nc::Vec3::operator== |
( |
const Vec3 & |
rhs | ) |
const |
|
inlinenoexcept |
Equality operator
- Parameters
-
- Returns
- bool
◆ project()
| Vec3 nc::Vec3::project |
( |
const Vec3 & |
otherVec | ) |
const |
|
inlinenoexcept |
Projects the vector onto the input vector
- Parameters
-
- Returns
- Vec3
◆ right()
| static constexpr Vec3 nc::Vec3::right |
( |
| ) |
|
|
inlinestaticconstexprnoexcept |
Returns the unit vector [1, 0, 0]
- Returns
- Vec3
◆ toNdArray()
| NdArray<double> nc::Vec3::toNdArray |
( |
| ) |
const |
|
inline |
◆ toString()
| std::string nc::Vec3::toString |
( |
| ) |
const |
|
inline |
Returns the Vec3 as a string
- Returns
- std::string
◆ up()
| static constexpr Vec3 nc::Vec3::up |
( |
| ) |
|
|
inlinestaticconstexprnoexcept |
Returns the unit vector [0, 1, 0]
- Returns
- Vec3
| double nc::Vec3::x { 0.0 } |
| double nc::Vec3::y { 0.0 } |
| double nc::Vec3::z { 0.0 } |
The documentation for this class was generated from the following file: