![]() |
nCine
2025.04.r498-9d36345
A cross-platform 2D game engine
|
A two component vector based on templates. More...
#include <Vector2.h>
Public Member Functions | |
Vector2 (T s) | |
Vector2 (T xx, T yy) | |
Vector2 (const Vector2 &other) | |
Vector2 & | operator= (const Vector2 &other) |
void | set (T xx, T yy) |
T * | data () |
const T * | data () const |
T & | operator[] (unsigned int index) |
const T & | operator[] (unsigned int index) const |
bool | operator== (const Vector2 &v) const |
Vector2 | operator- () const |
Vector2 & | operator+= (const Vector2 &v) |
Vector2 & | operator-= (const Vector2 &v) |
Vector2 & | operator*= (const Vector2 &v) |
Vector2 & | operator/= (const Vector2 &v) |
Vector2 & | operator+= (T s) |
Vector2 & | operator-= (T s) |
Vector2 & | operator*= (T s) |
Vector2 & | operator/= (T s) |
Vector2 | operator+ (const Vector2 &v) const |
Vector2 | operator- (const Vector2 &v) const |
Vector2 | operator* (const Vector2 &v) const |
Vector2 | operator/ (const Vector2 &v) const |
Vector2 | operator+ (T s) const |
Vector2 | operator- (T s) const |
Vector2 | operator* (T s) const |
Vector2 | operator/ (T s) const |
T | length () const |
T | sqrLength () const |
Vector2 | normalized () const |
Vector2 & | normalize () |
template<class S > | |
Vector2< T > | convertType (const Vector2< S > &other) |
Static Public Member Functions | |
template<class S > | |
static Vector2 | convertType (const Vector2< S > &other) |
Public Attributes | |
T | x |
T | y |
Static Public Attributes | |
static const Vector2 | Zero |
A vector with all zero elements. | |
static const Vector2 | XAxis |
A unit vector on the X axis. | |
static const Vector2 | YAxis |
A unit vector on the Y axis. | |
Friends | |
template<class S > | |
Vector2< S > | operator* (S s, const Vector2< S > &v) |
template<class S > | |
S | dot (const Vector2< S > &v1, const Vector2< S > &v2) |
A two component vector based on templates.