|
| Vec2 ()=default |
| Default constructor leaves garbage in contents.
|
|
template<typename S > |
| Vec2 (const Vec2< S > &b) |
| Copy constructor supports type conversion.
|
|
| Vec2 (T a) |
| Constructor that sets all components to a single value.
|
|
| Vec2 (T a, T b) |
| Constructor that sets separate components.
|
|
template<typename S > |
| Vec2 (S *v) |
| Constructor from an array of 2 numbers.
|
|
template<typename S > |
| Vec2 (const S *v) |
|
| operator Vec2< fdk::half > () const |
| Returns value as a specific type:
|
|
| operator Vec2< float > () const |
|
| operator Vec2< double > () const |
|
| operator Vec2< int > () const |
|
Vec2< fdk::half > | asVec2h () const |
|
Vec2< float > | asVec2f () const |
|
Vec2< double > | asVec2d () const |
|
Vec2< int > | asVec2i () const |
|
T & | operator[] (int n) |
|
const T & | operator[] (int n) const |
|
T * | array () |
| Returns a pointer to the first element.
|
|
const T * | array () const |
|
void | set (T d) |
| Set all components to a single value.
|
|
void | set (T a, T b) |
| Set all components.
|
|
void | setToZero () |
| Set components to 0.
|
|
void | setToOne () |
| Set components to 1.
|
|
void | clear () |
| Type-specific clear. Sets all components to 0.
|
|
void | append (fdk::Hash &hash) const |
| Add this to a fdk::Hash object.
|
|
template<typename S > |
Vec2 | operator* (const Mat4< S > &m) const |
|
template<typename S > |
Vec2 & | operator*= (const Mat4< S > &m) |
|
template<typename S , std::enable_if_t< fdk::is_arithmetic< S >, bool > = true> |
Vec2 | operator* (S d) const |
|
Vec2 | operator* (const Vec2 &v) const |
|
template<typename S , std::enable_if_t< fdk::is_arithmetic< S >, bool > = true> |
Vec2 & | operator*= (S d) |
|
Vec2 & | operator*= (const Vec2 &v) |
|
template<typename S , std::enable_if_t< fdk::is_arithmetic< S >, bool > = true> |
Vec2 | operator/ (S d) const |
|
Vec2 | operator/ (const Vec2 &v) const |
|
template<typename S , std::enable_if_t< fdk::is_arithmetic< S >, bool > = true> |
Vec2 & | operator/= (S d) |
|
Vec2 & | operator/= (const Vec2 &v) |
|
template<typename S , std::enable_if_t< fdk::is_arithmetic< S >, bool > = true> |
Vec2 | operator+ (S d) const |
|
Vec2 | operator+ (const Vec2 &v) const |
|
template<typename S , std::enable_if_t< fdk::is_arithmetic< S >, bool > = true> |
Vec2 & | operator+= (S d) |
|
Vec2 & | operator+= (const Vec2 &v) |
|
template<typename S , std::enable_if_t< fdk::is_arithmetic< S >, bool > = true> |
Vec2 | operator- (S d) const |
|
Vec2 | operator- (const Vec2 &v) const |
|
template<typename S , std::enable_if_t< fdk::is_arithmetic< S >, bool > = true> |
Vec2 & | operator-= (S d) |
|
Vec2 & | operator-= (const Vec2 &v) |
|
Vec2 | operator- () const |
|
void | negate () |
|
bool | operator== (const Vec2 &v) const |
|
bool | operator!= (const Vec2 &v) const |
|
bool | operator== (T d) const |
|
bool | operator!= (T d) const |
|
bool | operator< (const Vec2 &v) const |
| Fairly arbitrary operator so you can store these in ordered arrays.
|
|
T | length () const |
| Also known as the absolute value or magnitude of the vector.
|
|
T | lengthSquared () const |
| Same as this dot this, length() squared.
|
|
T | distanceBetween (const Vec2 &v) const |
| Same as (this-v).length()
|
|
T | distanceSquared (const Vec2 &v) const |
| Same as (this-v).lengthSquared()
|
|
T | dot (const Vec2 &v) const |
| Dot product.
|
|
T | cross (const Vec2 &v) const |
| Returns the Z component of the cross product, Ux * Vy - Uy * Vx.
|
|
T | normalize () |
| Change the vector to be unit length. Returns the original length.
|
|
Vec2 | normalized () const |
|
Vec2 | inverted () const |
|
template<typename S > |
Vec2 | clamped (S min, S max) const |
|
Vec2 | clamped () const |
|
T | minimumComponent () const |
| Returns the minimum element.
|
|
Vec2 | minimum (const Vec2 &v) const |
|
T | maximumComponent () const |
| Returns the maximum element.
|
|
Vec2 | maximum (const Vec2 &v) const |
|
T | largestAxis () const |
| Returns the absolute value of the largest element.
|
|
template<typename S > |
Vec2< T > | interpolateTo (const Vec2< T > &b, S t) const |
| Linear-interpolate between this Vec2 and another at t, where t=0..1.
|
|
template<typename S > |
Vec2< T > | lerpClampedTo (const Vec2< T > &b, S t) const |
|
template<typename S > |
Vec2< T > | lerpUnclampedTo (const Vec2< T > &b, S t) const |
|
bool | isZero () const |
|
bool | notZero () const |
|
bool | greaterThanZero () const |
|
void | roundIfNearlyZero (T threshold=std::numeric_limits< T >::epsilon()) |
| Round off each element if nearly one or zero within the type's epsilon default or user-provided threshold.
|
|
void | roundIfNearlyOne (T threshold=std::numeric_limits< T >::epsilon()) |
|
template<typename S > |
Vec2< T > | operator* (const Mat4< S > &m) const |
|
template<typename S > |
Vec2< T > & | operator*= (const Mat4< S > &m) |
|
template<typename S , std::enable_if_t< fdk::is_arithmetic< S >, bool > > |
Vec2< T > & | operator*= (S d) |
|
template<typename S , std::enable_if_t< fdk::is_arithmetic< S >, bool > > |
Vec2< T > & | operator/= (S d) |
|
template<typename S , std::enable_if_t< fdk::is_arithmetic< S >, bool > > |
Vec2< T > & | operator+= (S d) |
|
template<typename S , std::enable_if_t< fdk::is_arithmetic< S >, bool > > |
Vec2< T > & | operator-= (S d) |
|