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

#include <vec2h.h>

Public Types

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

Public Member Functions

 GfVec2h ()=default
 Default constructor does no initialization. More...
 
constexpr GfVec2h (GfHalf value)
 Initialize all elements to a single value. More...
 
constexpr GfVec2h (GfHalf s0, GfHalf s1)
 Initialize all elements with explicit arguments. More...
 
template<class Scl >
constexpr GfVec2h (Scl const *p)
 Construct with pointer to values. More...
 
 GfVec2h (class GfVec2d const &other)
 Construct from GfVec2d. More...
 
 GfVec2h (class GfVec2f const &other)
 Construct from GfVec2f. More...
 
 GfVec2h (class GfVec2i const &other)
 Implicitly convert from GfVec2i. More...
 
GfVec2hSet (GfHalf s0, GfHalf s1)
 Set all elements with passed arguments. More...
 
GfVec2hSet (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== (GfVec2h const &other) const
 Equality comparison. More...
 
bool operator!= (GfVec2h const &other) const
 
GF_API bool operator== (class GfVec2d const &other) const
 Equality comparison. More...
 
GF_API bool operator== (class GfVec2f const &other) const
 Equality comparison. More...
 
GF_API bool operator== (class GfVec2i const &other) const
 Equality comparison. More...
 
GfVec2h operator- () const
 Create a vec with negated elements. More...
 
GfVec2hoperator+= (GfVec2h const &other)
 Addition. More...
 
GfVec2hoperator-= (GfVec2h const &other)
 Subtraction. More...
 
GfVec2hoperator*= (double s)
 Multiplication by scalar. More...
 
GfVec2h operator* (double s) const
 
GfVec2hoperator/= (double s)
 Division by scalar. More...
 
GfVec2h operator/ (double s) const
 
GfHalf operator* (GfVec2h const &v) const
 See GfDot(). More...
 
GfVec2h GetProjection (GfVec2h const &v) const
 
GfVec2h GetComplement (GfVec2h const &b) const
 
GfHalf GetLengthSq () const
 Squared length. More...
 
GfHalf GetLength () const
 Length. More...
 
GfHalf Normalize (GfHalf eps=0.001)
 
GfVec2h GetNormalized (GfHalf eps=0.001) const
 

Static Public Member Functions

static GfVec2h XAxis ()
 Create a unit vector along the X-axis. More...
 
static GfVec2h YAxis ()
 Create a unit vector along the Y-axis. More...
 
static GfVec2h Axis (size_t i)
 

Static Public Attributes

static const size_t dimension = 2
 

Friends

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

Detailed Description

Basic type for a vector of 2 GfHalf components.

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

Definition at line 63 of file vec2h.h.

Member Typedef Documentation

Scalar element type and dimension.

Definition at line 67 of file vec2h.h.

Constructor & Destructor Documentation

GfVec2h::GfVec2h ( )
default

Default constructor does no initialization.

constexpr GfVec2h::GfVec2h ( GfHalf  value)
inlineexplicit

Initialize all elements to a single value.

Definition at line 74 of file vec2h.h.

constexpr GfVec2h::GfVec2h ( GfHalf  s0,
GfHalf  s1 
)
inline

Initialize all elements with explicit arguments.

Definition at line 80 of file vec2h.h.

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

Construct with pointer to values.

Definition at line 87 of file vec2h.h.

PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE GfVec2h::GfVec2h ( class GfVec2d const &  other)
inlineexplicit

Construct from GfVec2d.

Definition at line 292 of file vec2h.h.

GfVec2h::GfVec2h ( class GfVec2f const &  other)
inlineexplicit

Construct from GfVec2f.

Definition at line 298 of file vec2h.h.

GfVec2h::GfVec2h ( class GfVec2i const &  other)
inline

Implicitly convert from GfVec2i.

Definition at line 304 of file vec2h.h.

Member Function Documentation

static GfVec2h GfVec2h::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 2.

Definition at line 116 of file vec2h.h.

GfHalf const* GfVec2h::data ( ) const
inline

Direct data access.

Definition at line 136 of file vec2h.h.

GfHalf* GfVec2h::data ( )
inline

Definition at line 137 of file vec2h.h.

GfHalf const* GfVec2h::GetArray ( ) const
inline

Definition at line 138 of file vec2h.h.

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

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

*this - this->GetProjection(b)

Definition at line 237 of file vec2h.h.

GfHalf GfVec2h::GetLength ( ) const
inline

Length.

Definition at line 247 of file vec2h.h.

GfHalf GfVec2h::GetLengthSq ( ) const
inline

Squared length.

Definition at line 242 of file vec2h.h.

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

Definition at line 267 of file vec2h.h.

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

Returns the projection of this onto v. That is:

v * (*this * v)

Definition at line 228 of file vec2h.h.

GfHalf GfVec2h::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 259 of file vec2h.h.

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

Definition at line 154 of file vec2h.h.

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

Definition at line 200 of file vec2h.h.

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

See GfDot().

Definition at line 220 of file vec2h.h.

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

Multiplication by scalar.

Definition at line 195 of file vec2h.h.

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

Addition.

Definition at line 175 of file vec2h.h.

GfVec2h GfVec2h::operator- ( ) const
inline

Create a vec with negated elements.

Definition at line 170 of file vec2h.h.

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

Subtraction.

Definition at line 185 of file vec2h.h.

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

Definition at line 215 of file vec2h.h.

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

Division by scalar.

Definition at line 209 of file vec2h.h.

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

Equality comparison.

Definition at line 150 of file vec2h.h.

GF_API bool GfVec2h::operator== ( class GfVec2d const &  other) const

Equality comparison.

GF_API bool GfVec2h::operator== ( class GfVec2f const &  other) const

Equality comparison.

GF_API bool GfVec2h::operator== ( class GfVec2i const &  other) const

Equality comparison.

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

Indexing.

Definition at line 141 of file vec2h.h.

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

Definition at line 142 of file vec2h.h.

GfVec2h& GfVec2h::Set ( GfHalf  s0,
GfHalf  s1 
)
inline

Set all elements with passed arguments.

Definition at line 124 of file vec2h.h.

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

Set all elements with a pointer to data.

Definition at line 131 of file vec2h.h.

static GfVec2h GfVec2h::XAxis ( )
inlinestatic

Create a unit vector along the X-axis.

Definition at line 102 of file vec2h.h.

static GfVec2h GfVec2h::YAxis ( )
inlinestatic

Create a unit vector along the Y-axis.

Definition at line 108 of file vec2h.h.

Friends And Related Function Documentation

size_t hash_value ( GfVec2h const &  vec)
friend

Hash.

Definition at line 145 of file vec2h.h.

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

Definition at line 203 of file vec2h.h.

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

Definition at line 180 of file vec2h.h.

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

Definition at line 190 of file vec2h.h.

Member Data Documentation

const size_t GfVec2h::dimension = 2
static

Definition at line 68 of file vec2h.h.


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