![]() |
|
Basic type for a vector of 2 int components. More...
#include <vec2i.h>
Public Types | |
| typedef int | ScalarType |
| Scalar element type and dimension. | |
Public Member Functions | |
| GfVec2i ()=default | |
| GfVec2i value-initializes to zero and performs no default initialization, like float or double. | |
| constexpr | GfVec2i (int value) |
| Initialize all elements to a single value. | |
| constexpr | GfVec2i (int s0, int s1) |
| Initialize all elements with explicit arguments. | |
| template<class Scl > | |
| constexpr | GfVec2i (Scl const *p) |
| Construct with pointer to values. | |
| GfVec2i & | Set (int s0, int s1) |
| Set all elements with passed arguments. | |
| GfVec2i & | Set (int const *a) |
| Set all elements with a pointer to data. | |
| int const * | data () const |
| Direct data access. | |
| int * | data () |
| int const * | GetArray () const |
| int const & | operator[] (size_t i) const |
| Indexing. | |
| int & | operator[] (size_t i) |
| bool | operator== (GfVec2i const &other) const |
| Equality comparison. | |
| bool | operator!= (GfVec2i const &other) const |
| GF_API bool | operator== (class GfVec2d const &other) const |
| Equality comparison. | |
| GF_API bool | operator== (class GfVec2f const &other) const |
| Equality comparison. | |
| GF_API bool | operator== (class GfVec2h const &other) const |
| Equality comparison. | |
| GfVec2i | operator- () const |
| Create a vec with negated elements. | |
| GfVec2i & | operator+= (GfVec2i const &other) |
| Addition. | |
| GfVec2i & | operator-= (GfVec2i const &other) |
| Subtraction. | |
| GfVec2i & | operator*= (double s) |
| Multiplication by scalar. | |
| GfVec2i | operator* (double s) const |
| GfVec2i & | operator/= (int s) |
| Division by scalar. | |
| GfVec2i | operator/ (int s) const |
| int | operator* (GfVec2i const &v) const |
| See GfDot(). | |
| GfVec2i | GetProjection (GfVec2i const &v) const |
Returns the projection of this onto v. | |
| GfVec2i | GetComplement (GfVec2i const &b) const |
Returns the orthogonal complement of this->GetProjection(b). | |
| int | GetLengthSq () const |
| Squared length. | |
Swizzles | |
Each accessor returns a new vector built from this one's components, in the order named. For example yx() returns GfVec2i(y, x). Every permutation of 2 to 2 of the 2 components is available. Repeated components ( The results are ordinary GfVecs, so all the usual operators, GfDot() and so on apply to them. They are values, not references into this vector, so they cannot be assigned through. | |
| constexpr GfVec2i | xy () const |
| constexpr GfVec2i | yx () const |
Static Public Member Functions | |
| static GfVec2i | XAxis () |
| Create a unit vector along the X-axis. | |
| static GfVec2i | YAxis () |
| Create a unit vector along the Y-axis. | |
| static GfVec2i | Axis (size_t i) |
| Create a unit vector along the i-th axis, zero-based. | |
Public Attributes | |
Vector Components | |
The vector's components, which are also its storage. These are public and directly readable and writable. The components are contiguous and in declaration order, so For multi-component access see the swizzle accessors below, which return a new vector by value. | |
| int | x |
| int | y |
Static Public Attributes | |
| static const size_t | dimension = 2 |
Friends | |
| size_t | hash_value (GfVec2i const &vec) |
| Hash. | |
| GfVec2i | operator+ (GfVec2i const &l, GfVec2i const &r) |
| GfVec2i | operator- (GfVec2i const &l, GfVec2i const &r) |
| GfVec2i | operator* (double s, GfVec2i const &v) |
Basic type for a vector of 2 int components.
Represents a vector of 2 components of type int. It is intended to be fast and simple.
| int ScalarType |
|
default |
GfVec2i value-initializes to zero and performs no default initialization, like float or double.
|
inlineexplicitconstexpr |
|
inlineconstexpr |
|
inlineexplicitconstexpr |
|
inlinestatic |
|
inline |
Returns the orthogonal complement of this->GetProjection(b).
That is:
|
inline |
|
inline |
|
inline |
| GF_API bool operator== | ( | class GfVec2d const & | other | ) | const |
Equality comparison.
| GF_API bool operator== | ( | class GfVec2f const & | other | ) | const |
Equality comparison.
| GF_API bool operator== | ( | class GfVec2h const & | other | ) | const |
Equality comparison.
|
inline |
|
inline |
|
inline |
|
inlinestatic |
|
inlinestatic |