Euphoria
|
a 3d vector More...
Public Member Functions | |
v3 (float a) | |
v3 (const std::tuple< float, float, float > &a) | |
constexpr | v3 (float ax, float ay, float az) |
v3 (const float *a) | |
assumes the given pointer is a array of 3 floats | |
float | dot (const v3 &rhs) const |
v3 | cross (const v3 &u) const |
void | operator+= (const v3 &rhs) |
void | operator-= (const v3 &rhs) |
void | operator/= (float rhs) |
void | operator*= (float rhs) |
v3 | operator- () const |
float * | get_data_ptr () |
Returns an array to the data. | |
const float * | get_data_ptr () const |
Returns an array to the data. | |
constexpr float | get_length_squared () const |
Returns the squared length of the vector. | |
float | get_length () const |
Returns the length of the vector. | |
bool | normalize () |
Changes the length to 1. | |
std::optional< n3 > | get_normalized () const |
Returns a unit vector. | |
bool | operator== (const v3 &rhs)=delete |
Static Public Member Functions | |
static v3 | from_to (const v3 &from, const v3 &to) |
creates a vector going from from to to | |
static v3 | from_localspace_rui (const Q &rotation, float right, float up, float in) |
Creates a vector in quaterion local space from Right Up In. | |
Public Attributes | |
float | x |
float | y |
float | z |
|
explicit |
|
static |
Creates a vector in quaterion local space from Right Up In.
creates a vector going from from
to to
float * eu::v3::get_data_ptr | ( | ) |
Returns an array to the data.
non const so it's useful for letting an API tweak the members.
float eu::v3::get_length | ( | ) | const |
Returns the length of the vector.
Returns the squared length of the vector.
This is useful if you want to compare to zero, sort by length or similar, otherwise see get_length()
std::optional< n3 > eu::v3::get_normalized | ( | ) | const |
Returns a unit vector.
if the length is zero, nullopt
is returend
bool eu::v3::normalize | ( | ) |
Changes the length to 1.
If the calculated length is zero, the vector is changed to a known value and false is returned
v3 eu::v3::operator- | ( | ) | const |