28 #ifndef PXR_BASE_GF_VEC2H_H
29 #define PXR_BASE_GF_VEC2H_H
75 : _data{
value, value }
132 return Set(a[0], a[1]);
151 return _data[0] == other[0] &&
152 _data[1] == other[1];
155 return !(*
this == other);
171 return GfVec2h(-_data[0], -_data[1]);
176 _data[0] += other[0];
177 _data[1] += other[1];
186 _data[0] -= other[0];
187 _data[1] -= other[1];
213 return *
this *= (1.0 /
s);
216 return *
this * (1.0 /
s);
221 return _data[0] * v[0] + _data[1] * v[1];
229 return v * (*
this *
v);
243 return *
this * *
this;
263 *
this /= (length > eps) ? length : eps;
386 return delta.
GetLengthSq() <= tolerance * tolerance;
393 #endif // PXR_BASE_GF_VEC2H_H
GfHalf const * data() const
Direct data access.
GfVec2h()=default
Default constructor does no initialization.
GfVec2h GfCompDiv(GfVec2h const &v1, GfVec2h const &v2)
Returns component-wise quotient of vectors v1 and v2.
GfHalf GetLengthSq() const
Squared length.
constexpr GfVec2h(Scl const *p)
Construct with pointer to values.
GfVec2h & operator-=(GfVec2h const &other)
Subtraction.
GfVec2h & operator*=(double s)
Multiplication by scalar.
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the and then *wait for them to all complete We provide a helper class
friend GfVec2h operator*(double s, GfVec2h const &v)
GLsizei const GLfloat * value
GLboolean GLboolean GLboolean GLboolean a
GLuint GLsizei GLsizei * length
GfVec2h GfGetNormalized(GfVec2h const &v, GfHalf eps=0.001)
GfVec2h GfGetComplement(GfVec2h const &a, GfVec2h const &b)
bool GfIsClose(GfVec2h const &v1, GfVec2h const &v2, double tolerance)
**But if you need a result
GLfloat GLfloat GLfloat v2
GfVec2h operator*(double s) const
GfHalf GfGetLength(GfVec2h const &v)
Returns the geometric length of v.
GfVec2h GetComplement(GfVec2h const &b) const
GfVec2h operator/(double s) const
static const size_t dimension
GfVec2h & operator/=(double s)
Division by scalar.
bool operator==(GfVec2h const &other) const
Equality comparison.
friend GfVec2h operator-(GfVec2h const &l, GfVec2h const &r)
GfHalf GetLength() const
Length.
GfVec2h & Set(GfHalf const *a)
Set all elements with a pointer to data.
GfHalf GfNormalize(GfVec2h *v, GfHalf eps=0.001)
GfHalf const * GetArray() const
friend GfVec2h operator+(GfVec2h const &l, GfVec2h const &r)
GfVec2h GetNormalized(GfHalf eps=0.001) const
GfHalf const & operator[](size_t i) const
Indexing.
friend size_t hash_value(GfVec2h const &vec)
Hash.
constexpr GfVec2h(GfHalf s0, GfHalf s1)
Initialize all elements with explicit arguments.
GLint GLenum GLboolean normalized
GLboolean GLboolean GLboolean b
constexpr GfVec2h(GfHalf value)
Initialize all elements to a single value.
GfVec2h GfCompMult(GfVec2h const &v1, GfVec2h const &v2)
Returns component-wise multiplication of vectors v1 and v2.
bool operator!=(GfVec2h const &other) const
GfVec2h GetProjection(GfVec2h const &v) const
GfVec2h operator-() const
Create a vec with negated elements.
GfVec2h & Set(GfHalf s0, GfHalf s1)
Set all elements with passed arguments.
static GfVec2h Axis(size_t i)
static size_t Combine(Args &&...args)
Produce a hash code by combining the hash codes of several objects.
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
GF_API std::ostream & operator<<(std::ostream &, GfVec2h const &)
#define PXR_NAMESPACE_CLOSE_SCOPE
GfHalf & operator[](size_t i)
static GfVec2h YAxis()
Create a unit vector along the Y-axis.
static GfVec2h XAxis()
Create a unit vector along the X-axis.
GfVec2h & operator+=(GfVec2h const &other)
Addition.
GfHalf GfDot(GfVec2h const &v1, GfVec2h const &v2)
Returns the dot (inner) product of two vectors.
GfVec2h GfGetProjection(GfVec2h const &a, GfVec2h const &b)
GfHalf Normalize(GfHalf eps=0.001)
GfHalf operator*(GfVec2h const &v) const
See GfDot().
GfHalf ScalarType
Scalar element type and dimension.