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

#include <vec3h.h>

Public Types

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

Public Member Functions

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

Static Public Member Functions

static GfVec3h XAxis ()
 Create a unit vector along the X-axis. More...
 
static GfVec3h YAxis ()
 Create a unit vector along the Y-axis. More...
 
static GfVec3h ZAxis ()
 Create a unit vector along the Z-axis. More...
 
static GfVec3h Axis (size_t i)
 
static GF_API bool OrthogonalizeBasis (GfVec3h *tx, GfVec3h *ty, GfVec3h *tz, const bool normalize, double eps=GF_MIN_ORTHO_TOLERANCE)
 

Static Public Attributes

static const size_t dimension = 3
 

Friends

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

Detailed Description

Basic type for a vector of 3 GfHalf components.

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

Definition at line 64 of file vec3h.h.

Member Typedef Documentation

Scalar element type and dimension.

Definition at line 68 of file vec3h.h.

Constructor & Destructor Documentation

GfVec3h::GfVec3h ( )
default

Default constructor does no initialization.

constexpr GfVec3h::GfVec3h ( GfHalf  value)
inlineexplicit

Initialize all elements to a single value.

Definition at line 75 of file vec3h.h.

constexpr GfVec3h::GfVec3h ( GfHalf  s0,
GfHalf  s1,
GfHalf  s2 
)
inline

Initialize all elements with explicit arguments.

Definition at line 81 of file vec3h.h.

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

Construct with pointer to values.

Definition at line 88 of file vec3h.h.

PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE GfVec3h::GfVec3h ( class GfVec3d const other)
inlineexplicit

Construct from GfVec3d.

Definition at line 332 of file vec3h.h.

GfVec3h::GfVec3h ( class GfVec3f const other)
inlineexplicit

Construct from GfVec3f.

Definition at line 339 of file vec3h.h.

GfVec3h::GfVec3h ( class GfVec3i const other)
inline

Implicitly convert from GfVec3i.

Definition at line 346 of file vec3h.h.

Member Function Documentation

static GfVec3h GfVec3h::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 3.

Definition at line 123 of file vec3h.h.

GF_API void GfVec3h::BuildOrthonormalFrame ( GfVec3h v1,
GfVec3h v2,
GfHalf  eps = 0.001 
) const

Sets v1 and v2 to unit vectors such that v1, v2 and *this are mutually orthogonal. If the length L of *this is smaller than eps, then v1 and v2 will have magnitude L/eps. As a result, the function delivers a continuous result as *this shrinks in length.

GfHalf const* GfVec3h::data ( ) const
inline

Direct data access.

Definition at line 144 of file vec3h.h.

GfHalf* GfVec3h::data ( )
inline

Definition at line 145 of file vec3h.h.

GfHalf const* GfVec3h::GetArray ( ) const
inline

Definition at line 146 of file vec3h.h.

GfVec3h GfVec3h::GetComplement ( GfVec3h const b) const
inline

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

*this - this->GetProjection(b)

Definition at line 253 of file vec3h.h.

GfHalf GfVec3h::GetLength ( ) const
inline

Length.

Definition at line 263 of file vec3h.h.

GfHalf GfVec3h::GetLengthSq ( ) const
inline

Squared length.

Definition at line 258 of file vec3h.h.

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

Definition at line 284 of file vec3h.h.

GfVec3h GfVec3h::GetProjection ( GfVec3h const v) const
inline

Returns the projection of this onto v. That is:

v * (*this * v)

Definition at line 244 of file vec3h.h.

GfHalf GfVec3h::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 276 of file vec3h.h.

bool GfVec3h::operator!= ( GfVec3h const other) const
inline

Definition at line 167 of file vec3h.h.

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

Definition at line 216 of file vec3h.h.

GfHalf GfVec3h::operator* ( GfVec3h const v) const
inline

See GfDot().

Definition at line 236 of file vec3h.h.

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

Multiplication by scalar.

Definition at line 210 of file vec3h.h.

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

Addition.

Definition at line 188 of file vec3h.h.

GfVec3h GfVec3h::operator- ( ) const
inline

Create a vec with negated elements.

Definition at line 183 of file vec3h.h.

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

Subtraction.

Definition at line 199 of file vec3h.h.

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

Definition at line 231 of file vec3h.h.

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

Division by scalar.

Definition at line 225 of file vec3h.h.

bool GfVec3h::operator== ( GfVec3h const other) const
inline

Equality comparison.

Definition at line 162 of file vec3h.h.

GF_API bool GfVec3h::operator== ( class GfVec3d const other) const

Equality comparison.

GF_API bool GfVec3h::operator== ( class GfVec3f const other) const

Equality comparison.

GF_API bool GfVec3h::operator== ( class GfVec3i const other) const

Equality comparison.

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

Indexing.

Definition at line 149 of file vec3h.h.

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

Definition at line 150 of file vec3h.h.

static GF_API bool GfVec3h::OrthogonalizeBasis ( GfVec3h tx,
GfVec3h ty,
GfVec3h tz,
const bool  normalize,
double  eps = GF_MIN_ORTHO_TOLERANCE 
)
static

Orthogonalize and optionally normalize a set of basis vectors. This uses an iterative method that is very stable even when the vectors are far from orthogonal (close to colinear). The number of iterations and thus the computation time does increase as the vectors become close to colinear, however. Returns a bool specifying whether the solution converged after a number of iterations. If it did not converge, the returned vectors will be as close as possible to orthogonal within the iteration limit. Colinear vectors will be unaltered, and the method will return false.

GfVec3h& GfVec3h::Set ( GfHalf  s0,
GfHalf  s1,
GfHalf  s2 
)
inline

Set all elements with passed arguments.

Definition at line 131 of file vec3h.h.

GfVec3h& GfVec3h::Set ( GfHalf const a)
inline

Set all elements with a pointer to data.

Definition at line 139 of file vec3h.h.

static GfVec3h GfVec3h::XAxis ( )
inlinestatic

Create a unit vector along the X-axis.

Definition at line 103 of file vec3h.h.

static GfVec3h GfVec3h::YAxis ( )
inlinestatic

Create a unit vector along the Y-axis.

Definition at line 109 of file vec3h.h.

static GfVec3h GfVec3h::ZAxis ( )
inlinestatic

Create a unit vector along the Z-axis.

Definition at line 115 of file vec3h.h.

Friends And Related Function Documentation

size_t hash_value ( GfVec3h const vec)
friend

Hash.

Definition at line 153 of file vec3h.h.

GfVec3h operator* ( double  s,
GfVec3h const v 
)
friend

Definition at line 219 of file vec3h.h.

GfVec3h operator+ ( GfVec3h const l,
GfVec3h const r 
)
friend

Definition at line 194 of file vec3h.h.

GfVec3h operator- ( GfVec3h const l,
GfVec3h const r 
)
friend

Definition at line 205 of file vec3h.h.

Member Data Documentation

const size_t GfVec3h::dimension = 3
static

Definition at line 69 of file vec3h.h.


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