|
| Vector2 () |
| Default constructor, no data initialization.
|
|
constexpr | Vector2 (const Vector2< T > &v) |
| Copy constructor.
|
|
constexpr | Vector2 (const T &x, const T &y) |
| Explicit constructor, from two components.
|
|
constexpr | Vector2 (const T &t) |
| Explicit contructor, each component is given value t.
|
|
constexpr const Vector2< T > & | operator= (const Vector2< T > &in) |
|
constexpr const T & | x () const |
| X component access.
|
|
constexpr const T & | y () const |
| Y component access.
|
|
constexpr const T & | dof (unsigned u) const |
| Access to degree of freedom u (0-1).
|
|
T & | rx () |
| Reference access to x-component.
|
|
T & | ry () |
| Reference access to y-component.
|
|
T & | rdof (unsigned u) |
| Reference accesss to degree-of-freedom u (0-1).
|
|
constexpr const T & | operator[] (unsigned u) const |
| Allow array like access by degree of freedom (0-1)
|
|
T & | operator[] (unsigned u) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
template<std::size_t N> |
constexpr decltype(auto) | get () const |
|
constexpr T | fsum () const |
| Manhattan norm.
|
|
constexpr T | sum () const |
| Sum of components.
|
|
constexpr T | mag2 () const |
| Square of the magnitude, or the dot product with itself.
|
|
constexpr T | mag () const |
| The magnitude.
|
|
constexpr T | area () const |
| Size of rectangle represented by x*y - can be negative.
|
|
constexpr T | volume () const |
| Volume of the rectangle assuming unit depth – same as area(), provided for 2D/3D compile compatibility with Cube.
|
|
constexpr T | spread () const |
| Assumes vector is being used to store a 1D extent– Returns max-min. (y-x).
|
|
constexpr Vector2< T > | unit () const |
| Unit vector - be sure vector is nonzero.
|
|
constexpr Vector2< T > | abs () const |
| Returns vector of absolute values of components.
|
|
constexpr void | fill (const T &d) |
| Fills all three components with value d.
|
|
constexpr T | maxComp () const |
| Returns the maximum component.
|
|
constexpr T | minComp () const |
| Returns the minimum component.
|
|
constexpr unsigned | maxCompIndex () const |
| Returns the max component index.
|
|
constexpr unsigned | minCompIndex () const |
| Returns the min component index.
|
|
constexpr const Vector2< T > & | safeDivE (const Vector2< T > &v) |
| "Safe" division operation - checks for zero and overflow.
|
|
constexpr const Vector2< T > | safeDiv (const Vector2< T > &v) |
| "Safe" division operation - checks for zero and overflow.
|
|
constexpr bool | operator== (const Vector2< T > &v) const |
| Comparison operator - no tolerance is used.
|
|
constexpr bool | operator!= (const Vector2< T > &v) const |
| Comparison operator - no tolerance is used.
|
|
constexpr bool | operator< (const Vector2< T > &v) const |
| Comparison operator, based on magnitude.
|
|
constexpr bool | operator> (const Vector2< T > &v) const |
| Comparison operator, based on magnitude.
|
|
constexpr const Vector2< T > & | operator+= (const Vector2< T > &v) |
| In place mathematical operators using vectors and scalars – Note that * and / of Vector2 types are done on a component basis.
|
|
constexpr const Vector2< T > & | operator-= (const Vector2< T > &v) |
| In place mathematical operators using vectors and scalars – Note that * and / of Vector2 types are done on a component basis.
|
|
constexpr const Vector2< T > & | operator*= (const Vector2< T > &v) |
| In place mathematical operators using vectors and scalars – Note that * and / of Vector2 types are done on a component basis.
|
|
constexpr const Vector2< T > & | operator*= (const T &t) |
| In place mathematical operators using vectors and scalars – Note that * and / of Vector2 types are done on a component basis.
|
|
constexpr const Vector2< T > & | operator/= (const Vector2< T > &v) |
| In place mathematical operators using vectors and scalars – Note that * and / of Vector2 types are done on a component basis.
|
|
constexpr const Vector2< T > & | operator/= (const T &t) |
| In place mathematical operators using vectors and scalars – Note that * and / of Vector2 types are done on a component basis.
|
|
constexpr Vector2< T > | operator+ (const Vector2< T > &v) const |
| Binary mathematical operators using vectors and scalars – Note that * and / of Vector2 types are done on a component basis.
|
|
constexpr Vector2< T > | operator- (const Vector2< T > &v) const |
| Binary mathematical operators using vectors and scalars – Note that * and / of Vector2 types are done on a component basis.
|
|
constexpr Vector2< T > | operator* (const Vector2< T > &v) const |
| Binary mathematical operators using vectors and scalars – Note that * and / of Vector2 types are done on a component basis.
|
|
constexpr Vector2< T > | operator* (const T &t) const |
| Binary mathematical operators using vectors and scalars – Note that * and / of Vector2 types are done on a component basis.
|
|
constexpr Vector2< T > | operator/ (const Vector2< T > &v) const |
| Binary mathematical operators using vectors and scalars – Note that * and / of Vector2 types are done on a component basis.
|
|
constexpr Vector2< T > | operator/ (const T &t) const |
| Binary mathematical operators using vectors and scalars – Note that * and / of Vector2 types are done on a component basis.
|
|
constexpr T | operator| (const Vector2< T > &v) const |
| Dot Product.
|
|
constexpr const Vector2< T > & | expandToInclude (const T &t) |
| Expands 1D range to include value t.
|
|
constexpr const Vector2< T > & | expandToInclude (const Vector2< T > &v) |
| Expands 1D range to include 1D range v.
|
|
constexpr Vector2< T > | expandedToInclude (const T &t) const |
| Returns 1D range expanded to include value t;.
|
|
constexpr Vector2< T > | expandedToInclude (const Vector2< T > &v) const |
| Returns 1D range expanded to include 1D range v.
|
|
constexpr bool | contains (const T &t) const |
| True if value t falls inside this 1D range (inclusive).
|
|
template<class T>
class Vector2< T >
2D vector utility class.