HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GfVec4h Class Reference

#include <vec4h.h>

Public Types

typedef GfHalf ScalarType
 Scalar element type and dimension. More...
 

Public Member Functions

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

Static Public Member Functions

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

Static Public Attributes

static const size_t dimension = 4
 

Friends

size_t hash_value (GfVec4h const &vec)
 Hash. More...
 
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 63 of file vec4h.h.

Member Typedef Documentation

Scalar element type and dimension.

Definition at line 67 of file vec4h.h.

Constructor & Destructor Documentation

GfVec4h::GfVec4h ( )
default

Default constructor does no initialization.

constexpr GfVec4h::GfVec4h ( GfHalf  value)
inlineexplicit

Initialize all elements to a single value.

Definition at line 74 of file vec4h.h.

constexpr GfVec4h::GfVec4h ( GfHalf  s0,
GfHalf  s1,
GfHalf  s2,
GfHalf  s3 
)
inline

Initialize all elements with explicit arguments.

Definition at line 80 of file vec4h.h.

template<class Scl >
constexpr GfVec4h::GfVec4h ( Scl const *  p)
inlineexplicit

Construct with pointer to values.

Definition at line 87 of file vec4h.h.

PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE GfVec4h::GfVec4h ( class GfVec4d const &  other)
inlineexplicit

Construct from GfVec4d.

Definition at line 314 of file vec4h.h.

GfVec4h::GfVec4h ( class GfVec4f const &  other)
inlineexplicit

Construct from GfVec4f.

Definition at line 322 of file vec4h.h.

GfVec4h::GfVec4h ( class GfVec4i const &  other)
inline

Implicitly convert from GfVec4i.

Definition at line 330 of file vec4h.h.

Member Function Documentation

static GfVec4h 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 128 of file vec4h.h.

GfHalf const* GfVec4h::data ( ) const
inline

Direct data access.

Definition at line 150 of file vec4h.h.

GfHalf* GfVec4h::data ( )
inline

Definition at line 151 of file vec4h.h.

GfHalf const* GfVec4h::GetArray ( ) const
inline

Definition at line 152 of file vec4h.h.

GfVec4h GfVec4h::GetComplement ( GfVec4h const &  b) const
inline

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

*this - this->GetProjection(b)

Definition at line 259 of file vec4h.h.

GfHalf GfVec4h::GetLength ( ) const
inline

Length.

Definition at line 269 of file vec4h.h.

GfHalf GfVec4h::GetLengthSq ( ) const
inline

Squared length.

Definition at line 264 of file vec4h.h.

GfVec4h GfVec4h::GetNormalized ( GfHalf  eps = 0.001) const
inline

Definition at line 289 of file vec4h.h.

GfVec4h GfVec4h::GetProjection ( GfVec4h const &  v) const
inline

Returns the projection of this onto v. That is:

v * (*this * v)

Definition at line 250 of file vec4h.h.

GfHalf GfVec4h::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().

Todo:
This was fixed for bug 67777. This is a gcc64 optimizer bug. By tickling the code, it no longer tries to write into an illegal memory address (in the code section of memory).

Definition at line 281 of file vec4h.h.

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

Definition at line 170 of file vec4h.h.

GfVec4h GfVec4h::operator* ( double  s) const
inline

Definition at line 222 of file vec4h.h.

GfHalf GfVec4h::operator* ( GfVec4h const &  v) const
inline

See GfDot().

Definition at line 242 of file vec4h.h.

GfVec4h& GfVec4h::operator*= ( double  s)
inline

Multiplication by scalar.

Definition at line 215 of file vec4h.h.

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

Addition.

Definition at line 191 of file vec4h.h.

GfVec4h GfVec4h::operator- ( ) const
inline

Create a vec with negated elements.

Definition at line 186 of file vec4h.h.

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

Subtraction.

Definition at line 203 of file vec4h.h.

GfVec4h GfVec4h::operator/ ( double  s) const
inline

Definition at line 237 of file vec4h.h.

GfVec4h& GfVec4h::operator/= ( double  s)
inline

Division by scalar.

Definition at line 231 of file vec4h.h.

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

Equality comparison.

Definition at line 164 of file vec4h.h.

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

Equality comparison.

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

Equality comparison.

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

Equality comparison.

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

Indexing.

Definition at line 155 of file vec4h.h.

GfHalf& GfVec4h::operator[] ( size_t  i)
inline

Definition at line 156 of file vec4h.h.

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

Set all elements with passed arguments.

Definition at line 136 of file vec4h.h.

GfVec4h& GfVec4h::Set ( GfHalf const *  a)
inline

Set all elements with a pointer to data.

Definition at line 145 of file vec4h.h.

static GfVec4h GfVec4h::WAxis ( )
inlinestatic

Create a unit vector along the W-axis.

Definition at line 120 of file vec4h.h.

static GfVec4h GfVec4h::XAxis ( )
inlinestatic

Create a unit vector along the X-axis.

Definition at line 102 of file vec4h.h.

static GfVec4h GfVec4h::YAxis ( )
inlinestatic

Create a unit vector along the Y-axis.

Definition at line 108 of file vec4h.h.

static GfVec4h GfVec4h::ZAxis ( )
inlinestatic

Create a unit vector along the Z-axis.

Definition at line 114 of file vec4h.h.

Friends And Related Function Documentation

size_t hash_value ( GfVec4h const &  vec)
friend

Hash.

Definition at line 159 of file vec4h.h.

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

Definition at line 225 of file vec4h.h.

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

Definition at line 198 of file vec4h.h.

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

Definition at line 210 of file vec4h.h.

Member Data Documentation

const size_t GfVec4h::dimension = 4
static

Definition at line 68 of file vec4h.h.


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