28 #ifndef PXR_BASE_GF_VEC3H_H
29 #define PXR_BASE_GF_VEC3H_H
88 : _data{ p[0], p[1], p[2] }
139 return Set(a[0], a[1], a[2]);
158 return _data[0] == other[0] &&
159 _data[1] == other[1] &&
160 _data[2] == other[2];
163 return !(*
this == other);
179 return GfVec3h(-_data[0], -_data[1], -_data[2]);
184 _data[0] += other[0];
185 _data[1] += other[1];
186 _data[2] += other[2];
195 _data[0] -= other[0];
196 _data[1] -= other[1];
197 _data[2] -= other[2];
224 return *
this *= (1.0 /
s);
227 return *
this * (1.0 /
s);
232 return _data[0] * v[0] + _data[1] * v[1] + _data[2] * v[2];
240 return v * (*
this *
v);
254 return *
this * *
this;
274 *
this /= (length > eps) ? length : eps;
305 GfHalf eps = 0.001)
const;
425 return delta.
GetLengthSq() <= tolerance * tolerance;
444 v1[1] * v2[2] - v1[2] * v2[1],
445 v1[2] * v2[0] - v1[0] * v2[2],
446 v1[0] * v2[1] - v1[1] * v2[0]);
465 #endif // PXR_BASE_GF_VEC3H_H
GfVec3h GfCross(GfVec3h const &v1, GfVec3h const &v2)
Returns the cross product of v1 and v2.
GfHalf GfGetLength(GfVec3h const &v)
Returns the geometric length of v.
GfVec3h operator/(double s) const
GfHalf & operator[](size_t i)
GfHalf GetLength() const
Length.
*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
GfVec3h GetProjection(GfVec3h const &v) const
static const size_t dimension
GfHalf const * GetArray() const
GfHalf GetLengthSq() const
Squared length.
GfVec3h GetNormalized(GfHalf eps=0.001) const
GfVec3h operator*(double s) const
GLsizei const GLfloat * value
GfHalf const & operator[](size_t i) const
Indexing.
GfHalf Normalize(GfHalf eps=0.001)
GLboolean GLboolean GLboolean GLboolean a
GfVec3h & operator*=(double s)
Multiplication by scalar.
constexpr GfVec3h(GfHalf value)
Initialize all elements to a single value.
GLuint GLsizei GLsizei * length
GfHalf GfDot(GfVec3h const &v1, GfVec3h const &v2)
Returns the dot (inner) product of two vectors.
GfHalf ScalarType
Scalar element type and dimension.
**But if you need a result
GLfloat GLfloat GLfloat v2
GfVec3h & operator+=(GfVec3h const &other)
Addition.
GfVec3h & operator-=(GfVec3h const &other)
Subtraction.
GF_API bool GfOrthogonalizeBasis(GfVec3h *tx, GfVec3h *ty, GfVec3h *tz, bool normalize, double eps=GF_MIN_ORTHO_TOLERANCE)
GfVec3h operator-() const
Create a vec with negated elements.
static GfVec3h ZAxis()
Create a unit vector along the Z-axis.
static GfVec3h XAxis()
Create a unit vector along the X-axis.
constexpr GfVec3h(GfHalf s0, GfHalf s1, GfHalf s2)
Initialize all elements with explicit arguments.
GF_API void BuildOrthonormalFrame(GfVec3h *v1, GfVec3h *v2, GfHalf eps=0.001) const
GfVec3h & Set(GfHalf const *a)
Set all elements with a pointer to data.
GfVec3h GetComplement(GfVec3h const &b) const
GF_API std::ostream & operator<<(std::ostream &, GfVec3h const &)
GfVec3h GfCompDiv(GfVec3h const &v1, GfVec3h const &v2)
Returns component-wise quotient of vectors v1 and v2.
GfVec3h GfGetComplement(GfVec3h const &a, GfVec3h const &b)
static GfVec3h YAxis()
Create a unit vector along the Y-axis.
GLfloat GLfloat GLfloat alpha
friend GfVec3h operator+(GfVec3h const &l, GfVec3h const &r)
GfVec3h & operator/=(double s)
Division by scalar.
GLint GLenum GLboolean normalized
GLboolean GLboolean GLboolean b
GfHalf const * data() const
Direct data access.
GF_API void GfBuildOrthonormalFrame(GfVec3h const &v0, GfVec3h *v1, GfVec3h *v2, GfHalf eps=0.001)
GF_API GfVec3h GfSlerp(double alpha, GfVec3h const &v0, GfVec3h const &v1)
Spherical linear interpolation in three dimensions.
friend size_t hash_value(GfVec3h const &vec)
Hash.
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
bool GfIsClose(GfVec3h const &v1, GfVec3h const &v2, double tolerance)
GfVec3h operator^(GfVec3h const &v1, GfVec3h const &v2)
#define PXR_NAMESPACE_CLOSE_SCOPE
GfVec3h GfGetProjection(GfVec3h const &a, GfVec3h const &b)
GfHalf GfNormalize(GfVec3h *v, GfHalf eps=0.001)
GfVec3h GfGetNormalized(GfVec3h const &v, GfHalf eps=0.001)
bool operator==(GfVec3h const &other) const
Equality comparison.
constexpr GfVec3h(Scl const *p)
Construct with pointer to values.
GfVec3h()=default
Default constructor does no initialization.
friend GfVec3h operator-(GfVec3h const &l, GfVec3h const &r)
GfHalf operator*(GfVec3h const &v) const
See GfDot().
static GF_API bool OrthogonalizeBasis(GfVec3h *tx, GfVec3h *ty, GfVec3h *tz, const bool normalize, double eps=GF_MIN_ORTHO_TOLERANCE)
bool operator!=(GfVec3h const &other) const
GfVec3h & Set(GfHalf s0, GfHalf s1, GfHalf s2)
Set all elements with passed arguments.
GfVec3h GfCompMult(GfVec3h const &v1, GfVec3h const &v2)
Returns component-wise multiplication of vectors v1 and v2.
#define GF_MIN_ORTHO_TOLERANCE
friend GfVec3h operator*(double s, GfVec3h const &v)
constexpr T normalize(UT_FixedVector< T, D > &a) noexcept
static GfVec3h Axis(size_t i)