2D Vector Class More...
#include <SGVec2.hxx>
Public Member Functions | |
SGVec2 (void) | |
Default constructor. | |
SGVec2 (T x, T y) | |
Constructor. Initialize by the given values. | |
SGVec2 (const T *d) | |
Constructor. | |
const T & | operator() (unsigned i) const |
Access by index, the index is unchecked. | |
T & | operator() (unsigned i) |
Access by index, the index is unchecked. | |
const T & | operator[] (unsigned i) const |
Access raw data by index, the index is unchecked. | |
T & | operator[] (unsigned i) |
Access raw data by index, the index is unchecked. | |
const T & | x (void) const |
Access the x component. | |
T & | x (void) |
Access the x component. | |
const T & | y (void) const |
Access the y component. | |
T & | y (void) |
Access the y component. | |
const T(& | data (void) const)[2] |
Access raw data. | |
T(& | data (void))[2] |
Access raw data. | |
SGVec2 & | operator+= (const SGVec2 &v) |
Inplace addition. | |
SGVec2 & | operator-= (const SGVec2 &v) |
Inplace subtraction. | |
template<typename S > | |
SGVec2 & | operator*= (S s) |
Inplace scalar multiplication. | |
template<typename S > | |
SGVec2 & | operator/= (S s) |
Inplace scalar multiplication by 1/s. | |
Static Public Member Functions | |
static SGVec2 | zeros (void) |
Return an all zero vector. | |
static SGVec2 | e1 (void) |
Return unit vectors. |
2D Vector Class
Definition at line 28 of file SGVec2.hxx.
Default constructor.
Does not initialize at all. If you need them zero initialized, use SGVec2::zeros()
Initialize with nans in the debug build, that will guarantee to have a fast uninitialized default constructor in the release but shows up uninitialized values in the debug build very fast ...
Definition at line 34 of file SGVec2.hxx.
Constructor.
Initialize by the content of a plain array, make sure it has at least 2 elements
Definition at line 49 of file SGVec2.hxx.