Public Methods |
| | Vec2 () |
| | Vec2 (float x, float y) |
| const bool | operator== (const Vec2 &v) const |
| const bool | operator!= (const Vec2 &v) const |
| const bool | operator< (const Vec2 &v) const |
| float * | ptr () |
| const float * | ptr () const |
| void | set (float x, float y) |
| float & | operator[] (int i) |
| const float | operator[] (int i) const |
| float & | x () |
| float & | y () |
| const float | x () const |
| const float | y () const |
| const bool | valid () const |
| const bool | isNaN () const |
| const float | operator * (const Vec2 &rhs) const |
| | dot product
|
| const Vec2 | operator * (const float &rhs) const |
| | multiply by scalar
|
| Vec2 & | operator *= (const float &rhs) |
| | unary multiply by scalar
|
| const Vec2 | operator/ (const float &rhs) const |
| | divide by scalar
|
| Vec2 & | operator/= (const float &rhs) |
| | unary divide by scalar
|
| const Vec2 | operator+ (const Vec2 &rhs) const |
| | binary vector add
|
| Vec2 & | operator+= (const Vec2 &rhs) |
| | unary vector add.
|
| const Vec2 | operator- (const Vec2 &rhs) const |
| | binary vector subtract
|
| Vec2 & | operator-= (const Vec2 &rhs) |
| | unary vector subtract
|
| const Vec2 | operator- () const |
| | negation operator. Returns the negative of the Vec2
|
| const float | length () const |
| | Length of the vector = sqrt( vec . vec ).
|
| const float | length2 (void) const |
| | Length squared of the vector = vec . vec.
|
| const float | normalize () |
| | normalize the vector so that it has length unity returns the previous length of the vector
|
Public Attributes |
| float | _v [2] |
Friends |
| std::ostream & | operator<< (std::ostream &output, const Vec2 &vec) |