This document is for a version of USD that is under development. See this page for the current release.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
GfVec4h Class Reference

Basic type for a vector of 4 GfHalf components. More...

#include <vec4h.h>

Public Types

typedef GfHalf ScalarType
 Scalar element type and dimension.
 

Public Member Functions

 GfVec4h ()=default
 Default constructor does no initialization.
 
constexpr GfVec4h (GfHalf value)
 Initialize all elements to a single value.
 
constexpr GfVec4h (GfHalf s0, GfHalf s1, GfHalf s2, GfHalf s3)
 Initialize all elements with explicit arguments.
 
template<class Scl >
constexpr GfVec4h (Scl const *p)
 Construct with pointer to values.
 
 GfVec4h (class GfVec4d const &other)
 Construct from GfVec4d.
 
 GfVec4h (class GfVec4f const &other)
 Construct from GfVec4f.
 
 GfVec4h (class GfVec4i const &other)
 Implicitly convert from GfVec4i.
 
GfVec4hSet (GfHalf s0, GfHalf s1, GfHalf s2, GfHalf s3)
 Set all elements with passed arguments.
 
GfVec4hSet (GfHalf const *a)
 Set all elements with a pointer to data.
 
GfHalf const * data () const
 Direct data access.
 
GfHalfdata ()
 
GfHalf const * GetArray () const
 
GfHalf const & operator[] (size_t i) const
 Indexing.
 
GfHalfoperator[] (size_t i)
 
bool operator== (GfVec4h const &other) const
 Equality comparison.
 
bool operator!= (GfVec4h const &other) const
 
GF_API bool operator== (class GfVec4d const &other) const
 Equality comparison.
 
GF_API bool operator== (class GfVec4f const &other) const
 Equality comparison.
 
GF_API bool operator== (class GfVec4i const &other) const
 Equality comparison.
 
GfVec4h operator- () const
 Create a vec with negated elements.
 
GfVec4hoperator+= (GfVec4h const &other)
 Addition.
 
GfVec4hoperator-= (GfVec4h const &other)
 Subtraction.
 
GfVec4hoperator*= (double s)
 Multiplication by scalar.
 
GfVec4h operator* (double s) const
 
GfVec4hoperator/= (double s)
 Division by scalar.
 
GfVec4h operator/ (double s) const
 
GfHalf operator* (GfVec4h const &v) const
 See GfDot().
 
GfVec4h GetProjection (GfVec4h const &v) const
 Returns the projection of this onto v.
 
GfVec4h GetComplement (GfVec4h 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.
 
GfVec4h GetNormalized (GfHalf eps=0.001) const
 

Static Public Member Functions

static GfVec4h XAxis ()
 Create a unit vector along the X-axis.
 
static GfVec4h YAxis ()
 Create a unit vector along the Y-axis.
 
static GfVec4h ZAxis ()
 Create a unit vector along the Z-axis.
 
static GfVec4h WAxis ()
 Create a unit vector along the W-axis.
 
static GfVec4h Axis (size_t i)
 Create a unit vector along the i-th axis, zero-based.
 

Static Public Attributes

static const size_t dimension = 4
 

Friends

size_t hash_value (GfVec4h const &vec)
 Hash.
 
GfVec4h operator+ (GfVec4h const &l, GfVec4h const &r)
 
GfVec4h operator- (GfVec4h const &l, GfVec4h const &r)
 
GfVec4h operator* (double s, GfVec4h const &v)
 

Detailed Description

Basic type for a vector of 4 GfHalf components.

Represents a vector of 4 components of type GfHalf. It is intended to be fast and simple.

Definition at line 46 of file vec4h.h.

Member Typedef Documentation

◆ ScalarType

typedef GfHalf ScalarType

Scalar element type and dimension.

Definition at line 50 of file vec4h.h.

Constructor & Destructor Documentation

◆ GfVec4h() [1/7]

GfVec4h ( )
default

Default constructor does no initialization.

◆ GfVec4h() [2/7]

constexpr GfVec4h ( GfHalf  value)
inlineexplicitconstexpr

Initialize all elements to a single value.

Definition at line 57 of file vec4h.h.

◆ GfVec4h() [3/7]

constexpr GfVec4h ( GfHalf  s0,
GfHalf  s1,
GfHalf  s2,
GfHalf  s3 
)
inlineconstexpr

Initialize all elements with explicit arguments.

Definition at line 63 of file vec4h.h.

◆ GfVec4h() [4/7]

constexpr GfVec4h ( Scl const *  p)
inlineexplicitconstexpr

Construct with pointer to values.

Definition at line 70 of file vec4h.h.

◆ GfVec4h() [5/7]

GfVec4h ( class GfVec4d const &  other)
inlineexplicit

Construct from GfVec4d.

Definition at line 297 of file vec4h.h.

◆ GfVec4h() [6/7]

GfVec4h ( class GfVec4f const &  other)
inlineexplicit

Construct from GfVec4f.

Definition at line 305 of file vec4h.h.

◆ GfVec4h() [7/7]

GfVec4h ( class GfVec4i const &  other)
inline

Implicitly convert from GfVec4i.

Definition at line 313 of file vec4h.h.

Member Function Documentation

◆ Axis()

static GfVec4h Axis ( size_t  i)
inlinestatic

Create a unit vector along the i-th axis, zero-based.

Return the zero vector if i is greater than or equal to 4.

Definition at line 111 of file vec4h.h.

◆ data() [1/2]

GfHalf * data ( )
inline

Definition at line 134 of file vec4h.h.

◆ data() [2/2]

GfHalf const * data ( ) const
inline

Direct data access.

Definition at line 133 of file vec4h.h.

◆ GetArray()

GfHalf const * GetArray ( ) const
inline

Definition at line 135 of file vec4h.h.

◆ GetComplement()

GfVec4h GetComplement ( GfVec4h const &  b) const
inline

Returns the orthogonal complement of this->GetProjection(b).

That is:

*this - this->GetProjection(b)
GfVec4h GetProjection(GfVec4h const &v) const
Returns the projection of this onto v.
Definition: vec4h.h:233

Definition at line 242 of file vec4h.h.

◆ GetLength()

GfHalf GetLength ( ) const
inline

Length.

Definition at line 252 of file vec4h.h.

◆ GetLengthSq()

GfHalf GetLengthSq ( ) const
inline

Squared length.

Definition at line 247 of file vec4h.h.

◆ GetNormalized()

GfVec4h GetNormalized ( GfHalf  eps = 0.001) const
inline

Definition at line 272 of file vec4h.h.

◆ GetProjection()

GfVec4h GetProjection ( GfVec4h const &  v) const
inline

Returns the projection of this onto v.

That is:

v * (*this * v)

Definition at line 233 of file vec4h.h.

◆ Normalize()

GfHalf Normalize ( GfHalf  eps = 0.001)
inline

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().

Definition at line 264 of file vec4h.h.

◆ operator!=()

bool operator!= ( GfVec4h const &  other) const
inline

Definition at line 153 of file vec4h.h.

◆ operator*() [1/2]

GfVec4h operator* ( double  s) const
inline

Definition at line 205 of file vec4h.h.

◆ operator*() [2/2]

GfHalf operator* ( GfVec4h const &  v) const
inline

See GfDot().

Definition at line 225 of file vec4h.h.

◆ operator*=()

GfVec4h & operator*= ( double  s)
inline

Multiplication by scalar.

Definition at line 198 of file vec4h.h.

◆ operator+=()

GfVec4h & operator+= ( GfVec4h const &  other)
inline

Addition.

Definition at line 174 of file vec4h.h.

◆ operator-()

GfVec4h operator- ( ) const
inline

Create a vec with negated elements.

Definition at line 169 of file vec4h.h.

◆ operator-=()

GfVec4h & operator-= ( GfVec4h const &  other)
inline

Subtraction.

Definition at line 186 of file vec4h.h.

◆ operator/()

GfVec4h operator/ ( double  s) const
inline

Definition at line 220 of file vec4h.h.

◆ operator/=()

GfVec4h & operator/= ( double  s)
inline

Division by scalar.

Definition at line 214 of file vec4h.h.

◆ operator==() [1/4]

GF_API bool operator== ( class GfVec4d const &  other) const

Equality comparison.

◆ operator==() [2/4]

GF_API bool operator== ( class GfVec4f const &  other) const

Equality comparison.

◆ operator==() [3/4]

GF_API bool operator== ( class GfVec4i const &  other) const

Equality comparison.

◆ operator==() [4/4]

bool operator== ( GfVec4h const &  other) const
inline

Equality comparison.

Definition at line 147 of file vec4h.h.

◆ operator[]() [1/2]

GfHalf & operator[] ( size_t  i)
inline

Definition at line 139 of file vec4h.h.

◆ operator[]() [2/2]

GfHalf const & operator[] ( size_t  i) const
inline

Indexing.

Definition at line 138 of file vec4h.h.

◆ Set() [1/2]

GfVec4h & Set ( GfHalf const *  a)
inline

Set all elements with a pointer to data.

Definition at line 128 of file vec4h.h.

◆ Set() [2/2]

GfVec4h & Set ( GfHalf  s0,
GfHalf  s1,
GfHalf  s2,
GfHalf  s3 
)
inline

Set all elements with passed arguments.

Definition at line 119 of file vec4h.h.

◆ WAxis()

static GfVec4h WAxis ( )
inlinestatic

Create a unit vector along the W-axis.

Definition at line 103 of file vec4h.h.

◆ XAxis()

static GfVec4h XAxis ( )
inlinestatic

Create a unit vector along the X-axis.

Definition at line 85 of file vec4h.h.

◆ YAxis()

static GfVec4h YAxis ( )
inlinestatic

Create a unit vector along the Y-axis.

Definition at line 91 of file vec4h.h.

◆ ZAxis()

static GfVec4h ZAxis ( )
inlinestatic

Create a unit vector along the Z-axis.

Definition at line 97 of file vec4h.h.

Friends And Related Function Documentation

◆ hash_value

size_t hash_value ( GfVec4h const &  vec)
friend

Hash.

Definition at line 142 of file vec4h.h.

◆ operator*

GfVec4h operator* ( double  s,
GfVec4h const &  v 
)
friend

Definition at line 208 of file vec4h.h.

◆ operator+

GfVec4h operator+ ( GfVec4h const &  l,
GfVec4h const &  r 
)
friend

Definition at line 181 of file vec4h.h.

◆ operator-

GfVec4h operator- ( GfVec4h const &  l,
GfVec4h const &  r 
)
friend

Definition at line 193 of file vec4h.h.

Member Data Documentation

◆ dimension

const size_t dimension = 4
static

Definition at line 51 of file vec4h.h.


The documentation for this class was generated from the following file: