![]() |
|
Basic type for a vector of 2 GfHalf components. More...
#include <vec2h.h>
Public Types | |
| typedef GfHalf | ScalarType |
| Scalar element type and dimension. | |
Public Member Functions | |
| GfVec2h ()=default | |
| GfVec2h value-initializes to zero and performs no default initialization, like float or double. | |
| constexpr | GfVec2h (GfHalf value) |
| Initialize all elements to a single value. | |
| constexpr | GfVec2h (GfHalf s0, GfHalf s1) |
| Initialize all elements with explicit arguments. | |
| template<class Scl > | |
| constexpr | GfVec2h (Scl const *p) |
| Construct with pointer to values. | |
| GfVec2h (class GfVec2d const &other) | |
| Construct from GfVec2d. | |
| GfVec2h (class GfVec2f const &other) | |
| Construct from GfVec2f. | |
| GfVec2h (class GfVec2i const &other) | |
| Implicitly convert from GfVec2i. | |
| GfVec2h & | Set (GfHalf s0, GfHalf s1) |
| Set all elements with passed arguments. | |
| GfVec2h & | Set (GfHalf const *a) |
| Set all elements with a pointer to data. | |
| GfHalf const * | data () const |
| Direct data access. | |
| GfHalf * | data () |
| GfHalf const * | GetArray () const |
| GfHalf const & | operator[] (size_t i) const |
| Indexing. | |
| GfHalf & | operator[] (size_t i) |
| bool | operator== (GfVec2h const &other) const |
| Equality comparison. | |
| bool | operator!= (GfVec2h 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 GfVec2i const &other) const |
| Equality comparison. | |
| GfVec2h | operator- () const |
| Create a vec with negated elements. | |
| GfVec2h & | operator+= (GfVec2h const &other) |
| Addition. | |
| GfVec2h & | operator-= (GfVec2h const &other) |
| Subtraction. | |
| GfVec2h & | operator*= (double s) |
| Multiplication by scalar. | |
| GfVec2h | operator* (double s) const |
| GfVec2h & | operator/= (double s) |
| Division by scalar. | |
| GfVec2h | operator/ (double s) const |
| GfHalf | operator* (GfVec2h const &v) const |
| See GfDot(). | |
| GfVec2h | GetProjection (GfVec2h const &v) const |
Returns the projection of this onto v. | |
| GfVec2h | GetComplement (GfVec2h const &b) const |
Returns the orthogonal complement of this->GetProjection(b). | |
| GfHalf | GetLengthSq () const |
| Squared length. | |
| GfHalf | GetLength () const |
| Length. | |
| GfHalf | Normalize (GfHalf eps=0.001) |
| Normalizes the vector in place to unit length, returning the length before normalization. | |
| GfVec2h | GetNormalized (GfHalf eps=0.001) const |
Swizzles | |
Each accessor returns a new vector built from this one's components, in the order named. For example yx() returns GfVec2h(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 GfVec2h | xy () const |
| constexpr GfVec2h | yx () const |
Static Public Member Functions | |
| static GfVec2h | XAxis () |
| Create a unit vector along the X-axis. | |
| static GfVec2h | YAxis () |
| Create a unit vector along the Y-axis. | |
| static GfVec2h | 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. | |
| GfHalf | x |
| GfHalf | y |
Static Public Attributes | |
| static const size_t | dimension = 2 |
Friends | |
| size_t | hash_value (GfVec2h const &vec) |
| Hash. | |
| GfVec2h | operator+ (GfVec2h const &l, GfVec2h const &r) |
| GfVec2h | operator- (GfVec2h const &l, GfVec2h const &r) |
| GfVec2h | operator* (double s, GfVec2h const &v) |
Basic type for a vector of 2 GfHalf components.
Represents a vector of 2 components of type GfHalf. It is intended to be fast and simple.
|
default |
GfVec2h value-initializes to zero and performs no default initialization, like float or double.
|
inlineexplicitconstexpr |
|
inlinestatic |
|
inline |
Returns the orthogonal complement of this->GetProjection(b).
That is:
Normalizes the vector in place to unit length, returning the length before normalization.
If the length of the vector is smaller than eps, then the vector is set to vector/eps. The original length of the vector is returned. See also GfNormalize().
|
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 GfVec2i const & | other | ) | const |
Equality comparison.
|
inline |
|
inline |
|
inlinestatic |
|
inlinestatic |