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

#include <vec3f.h>

Public Types

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

Public Member Functions

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

Static Public Member Functions

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

Static Public Attributes

static const size_t dimension = 3
 

Friends

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

Detailed Description

Basic type for a vector of 3 float components.

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

Definition at line 63 of file vec3f.h.

Member Typedef Documentation

typedef float GfVec3f::ScalarType

Scalar element type and dimension.

Definition at line 67 of file vec3f.h.

Constructor & Destructor Documentation

GfVec3f::GfVec3f ( )
default

Default constructor does no initialization.

constexpr GfVec3f::GfVec3f ( float  value)
inlineexplicit

Initialize all elements to a single value.

Definition at line 74 of file vec3f.h.

constexpr GfVec3f::GfVec3f ( float  s0,
float  s1,
float  s2 
)
inline

Initialize all elements with explicit arguments.

Definition at line 80 of file vec3f.h.

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

Construct with pointer to values.

Definition at line 87 of file vec3f.h.

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

Construct from GfVec3d.

Definition at line 331 of file vec3f.h.

GfVec3f::GfVec3f ( class GfVec3h const other)
inline

Implicitly convert from GfVec3h.

Definition at line 338 of file vec3f.h.

GfVec3f::GfVec3f ( class GfVec3i const other)
inline

Implicitly convert from GfVec3i.

Definition at line 345 of file vec3f.h.

Member Function Documentation

static GfVec3f GfVec3f::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 122 of file vec3f.h.

GF_API void GfVec3f::BuildOrthonormalFrame ( GfVec3f v1,
GfVec3f v2,
float  eps = GF_MIN_VECTOR_LENGTH 
) 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.

float const* GfVec3f::data ( ) const
inline

Direct data access.

Definition at line 143 of file vec3f.h.

float* GfVec3f::data ( )
inline

Definition at line 144 of file vec3f.h.

float const* GfVec3f::GetArray ( ) const
inline

Definition at line 145 of file vec3f.h.

GfVec3f GfVec3f::GetComplement ( GfVec3f const b) const
inline

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

*this - this->GetProjection(b)

Definition at line 252 of file vec3f.h.

float GfVec3f::GetLength ( ) const
inline

Length.

Definition at line 262 of file vec3f.h.

float GfVec3f::GetLengthSq ( ) const
inline

Squared length.

Definition at line 257 of file vec3f.h.

GfVec3f GfVec3f::GetNormalized ( float  eps = GF_MIN_VECTOR_LENGTH) const
inline

Definition at line 283 of file vec3f.h.

GfVec3f GfVec3f::GetProjection ( GfVec3f const v) const
inline

Returns the projection of this onto v. That is:

v * (*this * v)

Definition at line 243 of file vec3f.h.

float GfVec3f::Normalize ( float  eps = GF_MIN_VECTOR_LENGTH)
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 275 of file vec3f.h.

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

Definition at line 166 of file vec3f.h.

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

Definition at line 215 of file vec3f.h.

float GfVec3f::operator* ( GfVec3f const v) const
inline

See GfDot().

Definition at line 235 of file vec3f.h.

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

Multiplication by scalar.

Definition at line 209 of file vec3f.h.

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

Addition.

Definition at line 187 of file vec3f.h.

GfVec3f GfVec3f::operator- ( ) const
inline

Create a vec with negated elements.

Definition at line 182 of file vec3f.h.

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

Subtraction.

Definition at line 198 of file vec3f.h.

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

Definition at line 230 of file vec3f.h.

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

Division by scalar.

Definition at line 224 of file vec3f.h.

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

Equality comparison.

Definition at line 161 of file vec3f.h.

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

Equality comparison.

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

Equality comparison.

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

Equality comparison.

float const& GfVec3f::operator[] ( size_t  i) const
inline

Indexing.

Definition at line 148 of file vec3f.h.

float& GfVec3f::operator[] ( size_t  i)
inline

Definition at line 149 of file vec3f.h.

static GF_API bool GfVec3f::OrthogonalizeBasis ( GfVec3f tx,
GfVec3f ty,
GfVec3f 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.

GfVec3f& GfVec3f::Set ( float  s0,
float  s1,
float  s2 
)
inline

Set all elements with passed arguments.

Definition at line 130 of file vec3f.h.

GfVec3f& GfVec3f::Set ( float const a)
inline

Set all elements with a pointer to data.

Definition at line 138 of file vec3f.h.

static GfVec3f GfVec3f::XAxis ( )
inlinestatic

Create a unit vector along the X-axis.

Definition at line 102 of file vec3f.h.

static GfVec3f GfVec3f::YAxis ( )
inlinestatic

Create a unit vector along the Y-axis.

Definition at line 108 of file vec3f.h.

static GfVec3f GfVec3f::ZAxis ( )
inlinestatic

Create a unit vector along the Z-axis.

Definition at line 114 of file vec3f.h.

Friends And Related Function Documentation

size_t hash_value ( GfVec3f const vec)
friend

Hash.

Definition at line 152 of file vec3f.h.

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

Definition at line 218 of file vec3f.h.

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

Definition at line 193 of file vec3f.h.

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

Definition at line 204 of file vec3f.h.

Member Data Documentation

const size_t GfVec3f::dimension = 3
static

Definition at line 68 of file vec3f.h.


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