|
Libprimis
Imprimis' 3D destroyable world engine
|
two dimensional Cartesian vector object More...
#include <geom.h>
Public Member Functions | |
| vec2 (float x, float y) | |
| vec2 (const vec &v) | |
| vec2 (const vec4< float > &v) | |
| float & | operator[] (int i) |
| float | operator[] (int i) const |
| bool | operator== (const vec2 &o) const |
| bool | operator!= (const vec2 &o) const |
| const float * | data () const |
| bool | iszero () const |
| float | dot (const vec2 &o) const |
| float | squaredlen () const |
| float | magnitude () const |
| vec2 & | normalize () |
| vec2 & | safenormalize () |
| float | cross (const vec2 &o) const |
| float | squaredist (const vec2 &e) const |
| float | dist (const vec2 &e) const |
| vec2 & | mul (float f) |
| vec2 & | mul (const vec2 &o) |
| vec2 & | square () |
| vec2 & | div (float f) |
| vec2 & | div (const vec2 &o) |
| vec2 & | recip () |
| vec2 & | add (float f) |
| vec2 & | add (const vec2 &o) |
| vec2 & | sub (float f) |
| vec2 & | sub (const vec2 &o) |
| vec2 & | neg () |
| vec2 & | min (const vec2 &o) |
| vec2 & | max (const vec2 &o) |
| vec2 & | min (float f) |
| vec2 & | max (float f) |
| vec2 & | abs () |
| vec2 & | clamp (float l, float h) |
| vec2 & | reflect (const vec2 &n) |
| vec2 & | lerp (const vec2 &b, float t) |
| Linearly interpolates between another vec2 according to scale t. | |
| vec2 & | lerp (const vec2 &a, const vec2 &b, float t) |
| Linearly interpolates between two other vec2s according to scale t. | |
| vec2 & | avg (const vec2 &b) |
| vec2 | operator+ (const vec2 &v2) const |
| vec2 | operator- (const vec2 &v2) const |
| vec2 | operator- () const |
| template<typename T> | |
| vec2 | operator* (const T &n) |
| vec2 | operator* (const vec2 &v2) |
| template<typename T> | |
| vec2 | operator/ (const T &n) |
| vec2 | operator/ (const vec2 &v2) |
| template<class B> | |
| vec2 & | madd (const vec2 &a, const B &b) |
| template<class B> | |
| vec2 & | msub (const vec2 &a, const B &b) |
| vec2 & | rotate_around_z (float c, float s) |
| vec2 & | rotate_around_z (float angle) |
| vec2 & | rotate_around_z (const vec2 &sc) |
Public Attributes | |
| float | x |
| float | y |
two dimensional Cartesian vector object
This object represents a two-dimensional location or vector in Cartesian space, consisting of the x and y axes. Many operators and utility functions corresponding to operations on the 2D plane are defined.
Linearly interpolates between two other vec2s according to scale t.
If 0 < t < 1 then the matrix will be t% of the way between this and to. Values outside 0..1 imply a linear extrapolation.