Vector of two elements of type 'float'. More...
#include <helios_vector_types.h>
Public Member Functions | |
vec2 | normalize () |
Normalize vector components such that the magnitude is unity. | |
float | magnitude () const |
Compute the vector magnitude. | |
constexpr | vec2 () |
Default constructor. | |
vec2 (const std::vector< float > &v) | |
Initialize vec2 using a vector of floats. | |
constexpr | vec2 (const float v[2]) |
Initialize vec2 using an array of floats. | |
constexpr | vec2 (float v0, float v1) |
Initialize vec2 using two floats. | |
constexpr float | operator* (const vec2 &a) const noexcept |
Dot (scalar) product of two vec2 vectors. | |
constexpr vec2 | operator+ (const vec2 &a) const noexcept |
Sum of two vec2 vectors. | |
vec2 & | operator+= (const vec2 &a) noexcept |
Increment vec2 vector. | |
vec2 & | operator-= (const vec2 &a) noexcept |
Decrement vec2 vector. | |
vec2 & | operator*= (float a) noexcept |
Multiplication assignment operator for vec2 vector. | |
vec2 & | operator/= (float a) noexcept |
Division assignment operator for vec2 vector. | |
constexpr vec2 | operator- (const vec2 &a) const noexcept |
Difference of two vec2 vectors noexcept. | |
constexpr vec2 | operator* (float a) const noexcept |
Multiply each element by scalar (scalar is multiplied on right: vec2*a) | |
vec2 | operator/ (float a) const noexcept |
Divide each element by scalar (scalar is divided on right: vec2/a) | |
constexpr vec2 | operator+ (float a) const noexcept |
Add a scalar to each element (scalar is added on right: vec2+a) | |
constexpr vec2 | operator- (float a) const noexcept |
Subtract a scalar from each element (scalar is subtracted on right: vec2-a) | |
constexpr bool | operator== (const vec2 &a) const noexcept |
check for equality of two vec2 vectors | |
constexpr bool | operator!= (const vec2 &a) const noexcept |
check for inequality of two vec2 vectors | |
constexpr vec2 | operator- () const noexcept |
Multiply each element by -1. | |
Data Fields | |
float | x |
First element in vector. | |
float | y |
Second element in vector. | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const helios::vec2 &vec) |
Write vec2 to output stream. | |
Vector of two elements of type 'float'.
Definition at line 692 of file helios_vector_types.h.
|
inlineconstexpr |
|
inlineexplicit |
Initialize vec2 using a vector of floats.
Definition at line 727 of file helios_vector_types.h.
|
inlineexplicitconstexpr |
Initialize vec2 using an array of floats.
Definition at line 735 of file helios_vector_types.h.
|
inlineconstexpr |
Initialize vec2 using two floats.
Definition at line 739 of file helios_vector_types.h.
|
inline |
Compute the vector magnitude.
Definition at line 715 of file helios_vector_types.h.
|
inline |
Normalize vector components such that the magnitude is unity.
Definition at line 701 of file helios_vector_types.h.
|
constexprnoexcept |
check for inequality of two vec2 vectors
Definition at line 869 of file helios_vector_types.h.
|
constexprnoexcept |
Dot (scalar) product of two vec2 vectors.
Definition at line 800 of file helios_vector_types.h.
|
constexprnoexcept |
Multiply each element by scalar (scalar is multiplied on right: vec2*a)
Definition at line 852 of file helios_vector_types.h.
|
inlinenoexcept |
Multiplication assignment operator for vec2 vector.
Definition at line 820 of file helios_vector_types.h.
Sum of two vec2 vectors.
Definition at line 804 of file helios_vector_types.h.
|
constexprnoexcept |
Add a scalar to each element (scalar is added on right: vec2+a)
Definition at line 832 of file helios_vector_types.h.
Increment vec2 vector.
Definition at line 808 of file helios_vector_types.h.
|
constexprnoexcept |
Multiply each element by -1.
Definition at line 873 of file helios_vector_types.h.
Difference of two vec2 vectors noexcept.
Definition at line 840 of file helios_vector_types.h.
|
constexprnoexcept |
Subtract a scalar from each element (scalar is subtracted on right: vec2-a)
Definition at line 844 of file helios_vector_types.h.
Decrement vec2 vector.
Definition at line 814 of file helios_vector_types.h.
|
inlinenoexcept |
Divide each element by scalar (scalar is divided on right: vec2/a)
Definition at line 860 of file helios_vector_types.h.
|
inlinenoexcept |
Division assignment operator for vec2 vector.
Definition at line 826 of file helios_vector_types.h.
|
constexprnoexcept |
check for equality of two vec2 vectors
Definition at line 865 of file helios_vector_types.h.
|
friend |
Write vec2 to output stream.
Definition at line 772 of file helios_vector_types.h.
float helios::vec2::x |
First element in vector.
Definition at line 696 of file helios_vector_types.h.
float helios::vec2::y |
Second element in vector.
Definition at line 698 of file helios_vector_types.h.