NGL
6.5
The NCCA Graphics Library
|
simple Vec2 encapsulates a 3 float object like glsl Vec2 but not maths use the Vec2 class for maths and the asVec2 to return a Vec2 More...
#include <Vec2.h>
Public Member Functions | |
void | set (Real _x, Real _y) noexcept |
sets the Vec2 component from 3 values More... | |
void | set (const Vec2 &_v) noexcept |
set from another Vec2 More... | |
void | set (const Vec4 &_v) noexcept |
set from another Vector More... | |
void | set (const Vec2 *_v) noexcept |
set from another Vec2 More... | |
Vec2 (const Vec2 &_v) noexcept | |
copy ctor More... | |
Vec2 (Real _x=0.0, Real _y=0.0) noexcept | |
initialise the constructor from 3 or 4 Real More... | |
Vec2 (Real _x) noexcept | |
ctor using a single float all components are set to the value _x More... | |
void | null () noexcept |
clears the Vec2 to 0,0,0 More... | |
Real & | operator[] (int _i) noexcept |
[] index operator to access the index component of the Vec2 More... | |
const Real & | operator[] (int _i) const noexcept |
[] index operator to access the index component of the Vec2 More... | |
void | operator+= (const Vec2 &_v) noexcept |
+= operator add Vec2 v to current Vec2 More... | |
void | operator-= (const Vec2 &_v) noexcept |
-= operator this-=v More... | |
Vec2 | operator* (const Real &_i) const noexcept |
this * i for each element More... | |
Real | length () const noexcept |
returns the length of the vector More... | |
Real | lengthSquared () const noexcept |
returns the length squared of the vector (no sqrt so quicker) More... | |
Vec2 | operator+ (const Vec2 &_v) const noexcept |
| |
Vec2 | operator/ (Real _v) const noexcept |
divide Vec2 components by a scalar More... | |
void | operator/= (Real _v) noexcept |
divide this Vec2 components by a scalar More... | |
void | operator*= (Real _v) noexcept |
multiply this Vec2 components by a scalar More... | |
Vec2 | operator- (const Vec2 &_v) const noexcept |
subtraction operator subtract vevtor-Vec2 More... | |
Vec2 | operator* (const Vec2 &_v) const noexcept |
| |
Vec2 & | operator= (const Vec2 &_v) noexcept |
assignment operator set the current Vec2 to rhs More... | |
Vec2 | operator- () const noexcept |
negate the Vec2 components More... | |
bool | operator== (const Vec2 &_v) const noexcept |
check for equality uses FCompare (from Util.h) as float values More... | |
bool | operator!= (const Vec2 &_v) const noexcept |
not equal check More... | |
Vec2 | operator/ (const Vec2 &_v) const noexcept |
\ operator div Vec2/Vec2 More... | |
Vec2 | operator* (Real _i) const noexcept |
this * i for each element More... | |
void | normalize () noexcept |
Normalize the vector using . More... | |
Real | dot (const Vec2 &_b) const noexcept |
return this dotted with _b More... | |
Real * | openGL () noexcept |
accesor to the m_openGL matrix returns the address of the 0th element More... | |
Public Attributes | |
Real | m_x |
x component of the Vec2 More... | |
Real | m_y |
y component of the Vec2 More... | |
std::array< Real, 2 > | m_openGL |
array of four floats mapped to the x,y,z,w components of the Vec2 useful for openGL fv data types this is mapped as a union to the following m_x == m_openGL[0] m_y == m_openGL[1] More... | |
simple Vec2 encapsulates a 3 float object like glsl Vec2 but not maths use the Vec2 class for maths and the asVec2 to return a Vec2
|
inlinenoexcept |
|
inlinenoexcept |
|
noexcept |
|
noexcept |
|
noexcept |
Normalize the vector using
.
Definition at line 164 of file Vec2.cpp.
References m_x, m_y, and NGL_ASSERT.
|
noexcept |
|
inlinenoexcept |
|
noexcept |
|
noexcept |
|
noexcept |
[] index operator to access the index component of the Vec2
Definition at line 56 of file Vec2.cpp.
References m_x, and NGL_ASSERT.
[] index operator to access the index component of the Vec2
Definition at line 116 of file Vec2.h.
References ngl::operator*(), and ngl::operator==().
set from another Vector
[in] | _v | the Vec2 to set from |
std::array<Real,2> ngl::Vec2::m_openGL |
Real ngl::Vec2::m_x |
x component of the Vec2