|
| | Vec2 () |
| | Trivial constructor, the vector is NOT initialized. More...
|
| |
| | Vec2 (T val) |
| | Construct a vector all of whose components have the given value. More...
|
| |
| | Vec2 (T x, T y) |
| | Constructor with two arguments, e.g. Vec2f v(1,2,3);. More...
|
| |
| template<typename Source > |
| | Vec2 (Source *a) |
| | Constructor with array argument, e.g. float a[2]; Vec2f v(a);. More...
|
| |
| template<typename Source > |
| | Vec2 (const Tuple< 2, Source > &t) |
| | Conversion constructor. More...
|
| |
| template<typename Other > |
| | Vec2 (Other val, typename std::enable_if< std::is_arithmetic< Other >::value, Conversion >::type=Conversion{}) |
| | Construct a vector all of whose components have the given value, which may be of an arithmetic type different from this vector's value type. More...
|
| |
| T & | x () |
| | Reference to the component, e.g. v.x() = 4.5f;. More...
|
| |
| T & | y () |
| |
| T | x () const |
| | Get the component, e.g. float f = v.y();. More...
|
| |
| T | y () const |
| |
| T & | operator() (int i) |
| | Alternative indexed reference to the elements. More...
|
| |
| T | operator() (int i) const |
| | Alternative indexed constant reference to the elements,. More...
|
| |
| T * | asPointer () |
| |
| const T * | asPointer () const |
| |
| const Vec2< T > & | init (T x=0, T y=0) |
| |
| const Vec2< T > & | setZero () |
| | Set "this" vector to zero. More...
|
| |
| template<typename Source > |
| const Vec2< T > & | operator= (const Vec2< Source > &v) |
| | Assignment operator. More...
|
| |
| bool | operator== (const Vec2< T > &v) const |
| | Equality operator, does exact floating point comparisons. More...
|
| |
| bool | operator!= (const Vec2< T > &v) const |
| | Inequality operator, does exact floating point comparisons. More...
|
| |
| bool | eq (const Vec2< T > &v, T eps=static_cast< T >(1.0e-7)) const |
| | Test if "this" vector is equivalent to vector v with tolerance of eps. More...
|
| |
| Vec2< T > | operator- () const |
| | Negation operator, for e.g. v1 = -v2;. More...
|
| |
| template<typename T0 , typename T1 > |
| const Vec2< T > & | add (const Vec2< T0 > &v1, const Vec2< T1 > &v2) |
| |
| template<typename T0 , typename T1 > |
| const Vec2< T > & | sub (const Vec2< T0 > &v1, const Vec2< T1 > &v2) |
| |
| template<typename T0 , typename T1 > |
| const Vec2< T > & | scale (T0 scalar, const Vec2< T1 > &v) |
| |
| template<typename T0 , typename T1 > |
| const Vec2< T > & | div (T0 scalar, const Vec2< T1 > &v) |
| |
| T | dot (const Vec2< T > &v) const |
| | Dot product. More...
|
| |
| T | length () const |
| | Length of the vector. More...
|
| |
| T | lengthSqr () const |
| |
| const Vec2< T > & | exp () |
| |
| const Vec2< T > & | log () |
| |
| T | sum () const |
| | Return the sum of all the vector components. More...
|
| |
| T | product () const |
| | Return the product of all the vector components. More...
|
| |
| bool | normalize (T eps=1.0e-8) |
| | this = normalized this More...
|
| |
| Vec2< T > | unit (T eps=0) const |
| | return normalized this, throws if null vector More...
|
| |
| Vec2< T > | unit (T eps, T &len) const |
| | return normalized this and length, throws if null vector More...
|
| |
| Vec2< T > | unitSafe () const |
| | return normalized this, or (1, 0) if this is null vector More...
|
| |
| template<typename S > |
| const Vec2< T > & | operator*= (S scalar) |
| | Returns v, where for . More...
|
| |
| template<typename S > |
| const Vec2< T > & | operator*= (const Vec2< S > &v1) |
| | Returns v0, where for . More...
|
| |
| template<typename S > |
| const Vec2< T > & | operator/= (S scalar) |
| | Returns v, where for . More...
|
| |
| template<typename S > |
| const Vec2< T > & | operator/= (const Vec2< S > &v1) |
| | Returns v0, where for . More...
|
| |
| template<typename S > |
| const Vec2< T > & | operator+= (S scalar) |
| | Returns v, where for . More...
|
| |
| template<typename S > |
| const Vec2< T > & | operator+= (const Vec2< S > &v1) |
| | Returns v0, where for . More...
|
| |
| template<typename S > |
| const Vec2< T > & | operator-= (S scalar) |
| | Returns v, where for . More...
|
| |
| template<typename S > |
| const Vec2< T > & | operator-= (const Vec2< S > &v1) |
| | Returns v0, where for . More...
|
| |
| T | component (const Vec2< T > &onto, T eps=1.0e-8) const |
| |
| Vec2< T > | projection (const Vec2< T > &onto, T eps=1.0e-8) const |
| |
| Vec2< T > | getArbPerpendicular () const |
| |
| T | operator[] (int i) const |
| |
| T & | operator[] (int i) |
| |
| std::string | str () const |
| |
| void | write (std::ostream &os) const |
| |
| void | read (std::istream &is) |
| |
| bool | isNan () const |
| | True if a Nan is present in this tuple. More...
|
| |
| bool | isInfinite () const |
| | True if an Inf is present in this tuple. More...
|
| |
| bool | isFinite () const |
| | True if no Nan or Inf values are present. More...
|
| |
| bool | isZero () const |
| | True if all elements are exactly zero. More...
|
| |
|
These are mostly for backwards compability with functions that take old-style Vs (which are just arrays).
|
| void | toV (S *v) const |
| | Copies this tuple into an array of a compatible type. More...
|
| |
| value_type * | asV () |
| | Exposes the internal array. Be careful when using this function. More...
|
| |
| value_type const * | asV () const |
| | Exposes the internal array. Be careful when using this function. More...
|
| |