Two-dimensional float vector with common arithmetic helpers. More...
#include <mxvk/include/mxvk/mxvk_math.h>
Public Member Functions | |
| float | Cos (const vec2D &v) const |
| Compute the cosine of the angle between this vector and another vector. | |
| float | Cos (const vec2D &v) const |
| Compute the cosine of the angle between this vector and another vector. | |
| constexpr float | DotProduct (const vec2D &v) const |
| Compute the dot product with another vector. | |
| float | DotProduct (const vec2D &v) const |
| Compute the dot product with another vector. | |
| float | Length () const |
| Compute the Euclidean length of this vector. | |
| float | Length () const |
| Compute the Euclidean length of this vector. | |
| void | Normalize () |
| Normalize this vector in place, or reset it to zero if it is too short. | |
| void | Normalize () |
| Normalize this vector in place, or reset it to zero if it is too short. | |
| void | Normalize (vec2D &v) const |
Write a normalized copy of this vector to v. | |
| void | Normalize (vec2D &v) const |
Write a normalized copy of this vector to v. | |
| constexpr vec2D | operator* (float k) const |
| Scale this vector by a scalar. | |
| vec2D | operator* (float k) const |
| Scale this vector by a scalar. | |
| constexpr vec2D | operator+ (const vec2D &v) const |
| Add two vectors component-wise. | |
| vec2D | operator+ (const vec2D &v) const |
| Add two vectors component-wise. | |
| vec2D & | operator+= (const vec2D &v) |
| Add another vector to this vector. | |
| vec2D & | operator+= (const vec2D &v) |
| Add another vector to this vector. | |
| constexpr vec2D | operator- (const vec2D &v) const |
| Subtract two vectors component-wise. | |
| vec2D | operator- (const vec2D &v) const |
| Subtract two vectors component-wise. | |
| vec2D & | operator-= (const vec2D &v) |
| Subtract another vector from this vector. | |
| vec2D & | operator-= (const vec2D &v) |
| Subtract another vector from this vector. | |
| vec2D & | operator= (const vec2D &)=default |
| vec2D & | operator= (const vec2D &)=default |
| std::string | Print (const std::string &name="v") const |
| Format this vector as a named angle-bracket tuple. | |
| std::string | Print (const std::string &name="v") const |
| Format this vector as a named angle-bracket tuple. | |
| vec2D | Scale (float k) const |
| Return a scaled copy of this vector. | |
| vec2D | Scale (float k) const |
| Return a scaled copy of this vector. | |
| void | ScaleThis (float k) |
| Scale this vector in place. | |
| void | ScaleThis (float k) |
| Scale this vector in place. | |
| void | Set (float x_value, float y_value) |
| Set both vector coordinates. | |
| void | Set (float x_value, float y_value) |
| Set both vector coordinates. | |
| constexpr | vec2D () |
| Construct the zero vector. | |
| constexpr | vec2D () |
| Construct the zero vector. | |
| constexpr | vec2D (float x_value, float y_value) |
| Construct a vector from explicit coordinates. | |
| constexpr | vec2D (float x_value, float y_value) |
| Construct a vector from explicit coordinates. | |
Public Attributes | |
| float | x = 0.0f |
| X coordinate. | |
| float | y = 0.0f |
| Y coordinate. | |
Two-dimensional float vector with common arithmetic helpers.
Definition at line 177 of file mxvk_math.h.
|
inlineconstexpr |
|
inlineconstexpr |
Construct a vector from explicit coordinates.
Definition at line 189 of file mxvk_math.h.
|
inlineconstexpr |
Construct the zero vector.
Definition at line 202 of file mxvk_math_eigen.hpp.
|
inlineconstexpr |
Construct a vector from explicit coordinates.
Definition at line 205 of file mxvk_math_eigen.hpp.
|
inlinenodiscard |
Compute the cosine of the angle between this vector and another vector.
Definition at line 267 of file mxvk_math.h.
|
inlinenodiscard |
Compute the cosine of the angle between this vector and another vector.
Definition at line 279 of file mxvk_math_eigen.hpp.
|
inlinenodiscardconstexpr |
Compute the dot product with another vector.
Definition at line 240 of file mxvk_math.h.
|
inlinenodiscard |
Compute the dot product with another vector.
Definition at line 253 of file mxvk_math_eigen.hpp.
|
inlinenodiscard |
Compute the Euclidean length of this vector.
Definition at line 245 of file mxvk_math.h.
|
inlinenodiscard |
Compute the Euclidean length of this vector.
Definition at line 258 of file mxvk_math_eigen.hpp.
|
inline |
Normalize this vector in place, or reset it to zero if it is too short.
Definition at line 250 of file mxvk_math.h.
|
inline |
Normalize this vector in place, or reset it to zero if it is too short.
Definition at line 263 of file mxvk_math_eigen.hpp.
|
inline |
Write a normalized copy of this vector to v.
Definition at line 261 of file mxvk_math.h.
|
inline |
Write a normalized copy of this vector to v.
Definition at line 273 of file mxvk_math_eigen.hpp.
|
inlinenodiscardconstexpr |
Scale this vector by a scalar.
Definition at line 224 of file mxvk_math.h.
|
inlinenodiscard |
Scale this vector by a scalar.
Definition at line 238 of file mxvk_math_eigen.hpp.
Add two vectors component-wise.
Definition at line 200 of file mxvk_math.h.
Add two vectors component-wise.
Definition at line 216 of file mxvk_math_eigen.hpp.
Add another vector to this vector.
Definition at line 205 of file mxvk_math.h.
Add another vector to this vector.
Definition at line 221 of file mxvk_math_eigen.hpp.
Subtract two vectors component-wise.
Definition at line 212 of file mxvk_math.h.
Subtract two vectors component-wise.
Definition at line 227 of file mxvk_math_eigen.hpp.
Subtract another vector from this vector.
Definition at line 217 of file mxvk_math.h.
Subtract another vector from this vector.
Definition at line 232 of file mxvk_math_eigen.hpp.
|
inlinenodiscard |
Format this vector as a named angle-bracket tuple.
Definition at line 273 of file mxvk_math.h.
|
inlinenodiscard |
Format this vector as a named angle-bracket tuple.
Definition at line 285 of file mxvk_math_eigen.hpp.
|
inlinenodiscard |
Return a scaled copy of this vector.
Definition at line 229 of file mxvk_math.h.
|
inlinenodiscard |
Return a scaled copy of this vector.
Definition at line 243 of file mxvk_math_eigen.hpp.
|
inline |
Scale this vector in place.
Definition at line 234 of file mxvk_math.h.
|
inline |
Scale this vector in place.
Definition at line 248 of file mxvk_math_eigen.hpp.
|
inline |
Set both vector coordinates.
Definition at line 192 of file mxvk_math.h.
|
inline |
Set both vector coordinates.
Definition at line 208 of file mxvk_math_eigen.hpp.
| float mxvk::vec2D::x = 0.0f |
X coordinate.
Definition at line 180 of file mxvk_math.h.
| float mxvk::vec2D::y = 0.0f |
Y coordinate.
Definition at line 183 of file mxvk_math.h.