a 2d vector
More...
a 2d vector
Definition at line 16 of file vec2.h.
◆ v2() [1/4]
◆ v2() [2/4]
| eu::v2::v2 |
( |
float | ax, |
|
|
float | ay ) |
|
inlineconstexpr |
◆ v2() [3/4]
| eu::v2::v2 |
( |
const std::tuple< float, float > & | a | ) |
|
|
explicit |
◆ v2() [4/4]
| eu::v2::v2 |
( |
const n2 & | u | ) |
|
|
explicit |
◆ from()
| v2 eu::v2::from |
( |
const n2 & | n | ) |
|
|
staticnodiscard |
◆ from_to()
| v2 eu::v2::from_to |
( |
const v2 & | from, |
|
|
const v2 & | to ) |
|
staticnodiscard |
◆ get_data_ptr() [1/2]
| float * eu::v2::get_data_ptr |
( |
| ) |
|
Returns an array to the data.
non const so it's useful for letting an API tweak the members.
◆ get_data_ptr() [2/2]
| const float * eu::v2::get_data_ptr |
( |
| ) |
const |
|
nodiscard |
Returns an array to the data.
◆ get_flipped_y()
| v2 eu::v2::get_flipped_y |
( |
| ) |
const |
|
nodiscard |
Returns a new vector where the sign of the y component is flipped.
◆ get_length()
| float eu::v2::get_length |
( |
| ) |
const |
|
nodiscard |
Returns the length of the vector.
◆ get_length_squared()
| float eu::v2::get_length_squared |
( |
| ) |
const |
|
nodiscard |
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()
◆ get_normalized()
| std::optional< n2 > eu::v2::get_normalized |
( |
| ) |
const |
|
nodiscard |
Changes the length to 1.
If the calculated length is zero, the vector is changed to a known value and false is returned
◆ get_rotated()
| v2 eu::v2::get_rotated |
( |
const An & | a | ) |
const |
|
nodiscard |
Assumes the vector is a point and returns it if it was rotated around (0,0).
◆ normalize()
| bool eu::v2::normalize |
( |
| ) |
|
Changes the length to 1.
If the calculated length is zero, the vector is changed to a known value and false is returned
◆ operator*=() [1/2]
| void eu::v2::operator*= |
( |
const v2 & | rhs | ) |
|
◆ operator*=() [2/2]
| void eu::v2::operator*= |
( |
float | rhs | ) |
|
◆ operator+=()
| void eu::v2::operator+= |
( |
const v2 & | rhs | ) |
|
◆ operator-()
| v2 eu::v2::operator- |
( |
| ) |
const |
◆ operator-=()
| void eu::v2::operator-= |
( |
const v2 & | rhs | ) |
|
◆ operator/=()
| void eu::v2::operator/= |
( |
float | rhs | ) |
|
The documentation for this struct was generated from the following file: