28 #ifndef PXR_BASE_GF_VEC4H_H
29 #define PXR_BASE_GF_VEC4H_H
81 : _data{ s0, s1, s2, s3 }
88 : _data{ p[0], p[1], p[2], p[3] }
146 return Set(a[0], a[1], a[2], a[3]);
165 return _data[0] == other[0] &&
166 _data[1] == other[1] &&
167 _data[2] == other[2] &&
168 _data[3] == other[3];
171 return !(*
this == other);
187 return GfVec4h(-_data[0], -_data[1], -_data[2], -_data[3]);
192 _data[0] += other[0];
193 _data[1] += other[1];
194 _data[2] += other[2];
195 _data[3] += other[3];
204 _data[0] -= other[0];
205 _data[1] -= other[1];
206 _data[2] -= other[2];
207 _data[3] -= other[3];
235 return *
this *= (1.0 /
s);
238 return *
this * (1.0 /
s);
243 return _data[0] * v[0] + _data[1] * v[1] + _data[2] * v[2] + _data[3] * v[3];
251 return v * (*
this *
v);
265 return *
this * *
this;
285 *
this /= (length > eps) ? length : eps;
418 return delta.
GetLengthSq() <= tolerance * tolerance;
425 #endif // PXR_BASE_GF_VEC4H_H
GfHalf GetLengthSq() const
Squared length.
static const size_t dimension
GfVec4h & operator-=(GfVec4h const &other)
Subtraction.
GfHalf & operator[](size_t i)
GfVec4h GfGetNormalized(GfVec4h const &v, GfHalf eps=0.001)
constexpr GfVec4h(GfHalf value)
Initialize all elements to a single value.
*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
constexpr GfVec4h(Scl const *p)
Construct with pointer to values.
GLsizei const GLfloat * value
friend GfVec4h operator+(GfVec4h const &l, GfVec4h const &r)
GfVec4h GetNormalized(GfHalf eps=0.001) const
GfHalf ScalarType
Scalar element type and dimension.
GfVec4h & Set(GfHalf const *a)
Set all elements with a pointer to data.
GfVec4h GfGetProjection(GfVec4h const &a, GfVec4h const &b)
GfVec4h & Set(GfHalf s0, GfHalf s1, GfHalf s2, GfHalf s3)
Set all elements with passed arguments.
GLboolean GLboolean GLboolean GLboolean a
static GfVec4h YAxis()
Create a unit vector along the Y-axis.
GfVec4h operator*(double s) const
GLuint GLsizei GLsizei * length
GfVec4h GfCompDiv(GfVec4h const &v1, GfVec4h const &v2)
Returns component-wise quotient of vectors v1 and v2.
**But if you need a result
friend GfVec4h operator*(double s, GfVec4h const &v)
GLfloat GLfloat GLfloat v2
GfHalf Normalize(GfHalf eps=0.001)
GfHalf operator*(GfVec4h const &v) const
See GfDot().
GfHalf GetLength() const
Length.
friend size_t hash_value(GfVec4h const &vec)
Hash.
GfVec4h()=default
Default constructor does no initialization.
GfHalf GfGetLength(GfVec4h const &v)
Returns the geometric length of v.
GfHalf const * data() const
Direct data access.
GfVec4h & operator+=(GfVec4h const &other)
Addition.
bool operator!=(GfVec4h const &other) const
GfVec4h GfCompMult(GfVec4h const &v1, GfVec4h const &v2)
Returns component-wise multiplication of vectors v1 and v2.
GfVec4h operator-() const
Create a vec with negated elements.
GfVec4h operator/(double s) const
GfVec4h & operator*=(double s)
Multiplication by scalar.
GfHalf const * GetArray() const
GLint GLenum GLboolean normalized
GfVec4h & operator/=(double s)
Division by scalar.
GfHalf GfDot(GfVec4h const &v1, GfVec4h const &v2)
Returns the dot (inner) product of two vectors.
GLboolean GLboolean GLboolean b
GfVec4h GetProjection(GfVec4h const &v) const
static GfVec4h WAxis()
Create a unit vector along the W-axis.
GfVec4h GfGetComplement(GfVec4h const &a, GfVec4h const &b)
friend GfVec4h operator-(GfVec4h const &l, GfVec4h const &r)
static size_t Combine(Args &&...args)
Produce a hash code by combining the hash codes of several objects.
bool operator==(GfVec4h const &other) const
Equality comparison.
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
GfVec4h GetComplement(GfVec4h const &b) const
#define PXR_NAMESPACE_CLOSE_SCOPE
static GfVec4h Axis(size_t i)
GfHalf GfNormalize(GfVec4h *v, GfHalf eps=0.001)
static GfVec4h ZAxis()
Create a unit vector along the Z-axis.
bool GfIsClose(GfVec4h const &v1, GfVec4h const &v2, double tolerance)
GF_API std::ostream & operator<<(std::ostream &, GfVec4h const &)
constexpr GfVec4h(GfHalf s0, GfHalf s1, GfHalf s2, GfHalf s3)
Initialize all elements with explicit arguments.
static GfVec4h XAxis()
Create a unit vector along the X-axis.
GfHalf const & operator[](size_t i) const
Indexing.