Three-dimensional float vector with arithmetic, dot, and cross-product helpers. More...
#include <mxvk/include/mxvk/mxvk_math.h>
Public Member Functions | |
| float | Cos (const vec3D &v) const |
| Compute the cosine of the angle between this vector and another vector. | |
| float | Cos (const vec3D &v) const |
| Compute the cosine of the angle between this vector and another vector. | |
| constexpr vec3D | CrossProduct (const vec3D &v) const |
| Compute the right-handed cross product with another vector. | |
| vec3D | CrossProduct (const vec3D &v) const |
| Compute the right-handed cross product with another vector. | |
| constexpr float | DotProduct (const vec3D &v) const |
| Compute the dot product with another vector. | |
| float | DotProduct (const vec3D &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 (vec3D &v) const |
Write a normalized copy of this vector to v. | |
| void | Normalize (vec3D &v) const |
Write a normalized copy of this vector to v. | |
| constexpr vec3D | operator* (float k) const |
| Scale this vector by a scalar. | |
| vec3D | operator* (float k) const |
| Scale this vector by a scalar. | |
| constexpr vec3D | operator+ (const vec3D &v) const |
| Add two vectors component-wise. | |
| vec3D | operator+ (const vec3D &v) const |
| Add two vectors component-wise. | |
| vec3D & | operator+= (const vec3D &v) |
| Add another vector to this vector. | |
| vec3D & | operator+= (const vec3D &v) |
| Add another vector to this vector. | |
| constexpr vec3D | operator- (const vec3D &v) const |
| Subtract two vectors component-wise. | |
| vec3D | operator- (const vec3D &v) const |
| Subtract two vectors component-wise. | |
| vec3D & | operator-= (const vec3D &v) |
| Subtract another vector from this vector. | |
| vec3D & | operator-= (const vec3D &v) |
| Subtract another vector from this vector. | |
| vec3D & | operator= (const vec3D &)=default |
| vec3D & | operator= (const vec3D &)=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. | |
| vec3D | Scale (float k) const |
| Return a scaled copy of this vector. | |
| vec3D | 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, float z_value) |
| Set all vector coordinates. | |
| void | Set (float x_value, float y_value, float z_value) |
| Set all vector coordinates. | |
| constexpr | vec3D () |
| Construct the zero vector. | |
| constexpr | vec3D () |
| Construct the zero vector. | |
| constexpr | vec3D (float x_value, float y_value, float z_value) |
| Construct a vector from explicit coordinates. | |
| constexpr | vec3D (float x_value, float y_value, float z_value) |
| Construct a vector from explicit coordinates. | |
Public Attributes | |
| float | x = 0.0f |
| X coordinate. | |
| float | y = 0.0f |
| Y coordinate. | |
| float | z = 0.0f |
| Z coordinate. | |
Three-dimensional float vector with arithmetic, dot, and cross-product helpers.
Definition at line 256 of file mxvk_math.h.
|
inlineconstexpr |
|
inlineconstexpr |
Construct a vector from explicit coordinates.
Definition at line 271 of file mxvk_math.h.
|
inlineconstexpr |
Construct the zero vector.
Definition at line 285 of file mxvk_math_eigen.hpp.
|
inlineconstexpr |
Construct a vector from explicit coordinates.
Definition at line 288 of file mxvk_math_eigen.hpp.
|
inlinenodiscard |
Compute the cosine of the angle between this vector and another vector.
Definition at line 343 of file mxvk_math.h.
|
inlinenodiscard |
Compute the cosine of the angle between this vector and another vector.
Definition at line 352 of file mxvk_math_eigen.hpp.
Compute the right-handed cross product with another vector.
Definition at line 330 of file mxvk_math_eigen.hpp.
|
inlinenodiscardconstexpr |
Compute the dot product with another vector.
Definition at line 318 of file mxvk_math.h.
|
inlinenodiscard |
Compute the dot product with another vector.
Definition at line 327 of file mxvk_math_eigen.hpp.
|
inlinenodiscard |
|
inlinenodiscard |
Compute the Euclidean length of this vector.
Definition at line 333 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 327 of file mxvk_math.h.
|
inline |
Normalize this vector in place, or reset it to zero if it is too short.
Definition at line 336 of file mxvk_math_eigen.hpp.
|
inline |
Write a normalized copy of this vector to v.
Definition at line 337 of file mxvk_math.h.
|
inline |
Write a normalized copy of this vector to v.
Definition at line 346 of file mxvk_math_eigen.hpp.
|
inlinenodiscardconstexpr |
Scale this vector by a scalar.
Definition at line 305 of file mxvk_math.h.
|
inlinenodiscard |
Scale this vector by a scalar.
Definition at line 318 of file mxvk_math_eigen.hpp.
Add two vectors component-wise.
Definition at line 283 of file mxvk_math.h.
Add two vectors component-wise.
Definition at line 300 of file mxvk_math_eigen.hpp.
Add another vector to this vector.
Definition at line 286 of file mxvk_math.h.
Add another vector to this vector.
Definition at line 303 of file mxvk_math_eigen.hpp.
Subtract two vectors component-wise.
Definition at line 294 of file mxvk_math.h.
Subtract two vectors component-wise.
Definition at line 309 of file mxvk_math_eigen.hpp.
Subtract another vector from this vector.
Definition at line 297 of file mxvk_math.h.
Subtract another vector from this vector.
Definition at line 312 of file mxvk_math_eigen.hpp.
|
inlinenodiscard |
Format this vector as a named angle-bracket tuple.
Definition at line 349 of file mxvk_math.h.
|
inlinenodiscard |
Format this vector as a named angle-bracket tuple.
Definition at line 358 of file mxvk_math_eigen.hpp.
|
inlinenodiscard |
Return a scaled copy of this vector.
Definition at line 308 of file mxvk_math.h.
|
inlinenodiscard |
Return a scaled copy of this vector.
Definition at line 321 of file mxvk_math_eigen.hpp.
|
inline |
Scale this vector in place.
Definition at line 311 of file mxvk_math.h.
|
inline |
Scale this vector in place.
Definition at line 324 of file mxvk_math_eigen.hpp.
|
inline |
Set all vector coordinates.
Definition at line 274 of file mxvk_math.h.
|
inline |
Set all vector coordinates.
Definition at line 291 of file mxvk_math_eigen.hpp.
| float mxvk::vec3D::x = 0.0f |
X coordinate.
Definition at line 259 of file mxvk_math.h.
| float mxvk::vec3D::y = 0.0f |
Y coordinate.
Definition at line 262 of file mxvk_math.h.
| float mxvk::vec3D::z = 0.0f |
Z coordinate.
Definition at line 265 of file mxvk_math.h.