|
|
double | angle (void) const |
| | Returns atan2(y/x) |
| |
|
template<typename S > |
| Nimble::Vector2T< S > | cast () const |
| | Cast the vector to another type. |
| |
|
Vector2T & | clamp (T low, T high) |
| | Clamps both components to the range [low, high]. |
| |
|
Vector2T & | clampUnit (void) |
| | Clamps both components to the range [0,1]. |
| |
|
void | clear (void) |
| | Fill the vector with zeroes. |
| |
|
T * | data () |
| | Returns a pointer to the first element. |
| |
|
const T * | data () const |
| | Returns a pointer to the first element. |
| |
|
Vector2T & | descale (const Vector2T &v) |
| | Scales the vector with inverse of v. |
| |
|
T & | get (size_t i) |
| | Returns the ith component. |
| |
|
const T & | get (size_t i) const |
| | Returns the ith component. |
| |
| bool | isFinite () const |
| | Check that vector elements are finite. More... |
| |
|
bool | isOne (void) const |
| | Checks if both components are one. |
| |
|
bool | isZero (void) const |
| | Checks if both components are zero. |
| |
|
Decltype< T, float >::mul | length () const |
| | Returns the length of the vector. |
| |
|
T | lengthSqr (void) const |
| | Returns the squared length of the vector. |
| |
|
Vector2T & | limitLength (T len) |
| | Normalizes the vector to the given length if it is longer. |
| |
|
Vector2T< T > & | make (T cx, T cy) |
| | Set the vector to given values. |
| |
|
Vector2T< T > & | make (T xy) |
| | Set both components to the given value. |
| |
|
T | maximum (void) const |
| | Returns the larger component. |
| |
|
T | minimum (void) const |
| | Returns the smaller component. |
| |
|
Vector2T & | negate (void) |
| | Negates the vector. |
| |
| Vector2T & | normalize (T len=T(1)) |
| | Normalizes the vector to the given length. More... |
| |
| Vector2T | normalized (T len=T(1)) const |
| | Get a vector normalized to given length. More... |
| |
|
bool | operator!= (const Vector2T &src) const |
| | Compares if two vectors differ. |
| |
|
Vector2T & | operator*= (T s) |
| | Multiplies a vector with a scalar. |
| |
|
Vector2T & | operator+= (const Vector2T &v) |
| | Adds two vectors. |
| |
|
Vector2T | operator- () const |
| | Returns the negation of a vector. |
| |
|
Vector2T & | operator-= (const Vector2T &v) |
| | Subtracts two vectors. |
| |
|
Vector2T | operator/ (T s) const |
| | Divide a vector by scalar. |
| |
|
Vector2T & | operator/= (T s) |
| | Divides a vector with a scalar. |
| |
| bool | operator< (const Vector2T< T > &v2) const |
| | Less-than operator, with arbitrary internal logic. More... |
| |
|
bool | operator== (const Vector2T &src) const |
| | Compares if two vectors are equal. |
| |
|
const T & | operator[] (size_t i) const |
| | Returns the ith component. |
| |
|
T & | operator[] (size_t i) |
| | Returns the ith component. |
| |
|
Vector2T | perpendicular () const |
| | Returns a perpendicular vector. |
| |
|
Vector2T & | rotate (double s, double c) |
| | Rotates the vector given the sine and cosine of the rotation angle. |
| |
|
Vector2T & | rotate (double angle) |
| | Rotate the vector by given radians. |
| |
|
Vector2T & | scale (const Vector2T &v) |
| | Scales the vector. |
| |
|
Vector2T & | scale (const T &xs, const T &ys) |
| | Scales the vector. |
| |
|
void | set (size_t i, T v) |
| | Sets the ith component. |
| |
|
Vector2T | shuffle (int i1=1, int i2=0) const |
| | Returns a vector with components reordered. |
| |
|
T | sum (void) const |
| | Returns the sum of components. |
| |
| | Vector2T () |
| | Default constructor, does not initialize the values. More... |
| |
|
| Vector2T (T cx, T cy) |
| | Constructs a vector initializing it to given values. |
| |
| | Vector2T (const SizeT< T > &s) |
| | Constructs vector from the size. More... |
| |
template<typename T>
class Nimble::Vector2T< T >
Two-dimensional vector class for 2D mathematics.
Like all classed in Nimble Vector2T has been optimized for speed. In general, there are no safety checks in any functions.