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
GfVec4d Class Reference

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

#include <vec4d.h>

Public Types

typedef double ScalarType
 Scalar element type and dimension.
 

Public Member Functions

 GfVec4d ()=default
 Default constructor does no initialization.
 
constexpr GfVec4d (double value)
 Initialize all elements to a single value.
 
constexpr GfVec4d (double s0, double s1, double s2, double s3)
 Initialize all elements with explicit arguments.
 
template<class Scl >
constexpr GfVec4d (Scl const *p)
 Construct with pointer to values.
 
 GfVec4d (class GfVec4f const &other)
 Implicitly convert from GfVec4f.
 
 GfVec4d (class GfVec4h const &other)
 Implicitly convert from GfVec4h.
 
 GfVec4d (class GfVec4i const &other)
 Implicitly convert from GfVec4i.
 
GfVec4dSet (double s0, double s1, double s2, double s3)
 Set all elements with passed arguments.
 
GfVec4dSet (double const *a)
 Set all elements with a pointer to data.
 
double const * data () const
 Direct data access.
 
double * data ()
 
double const * GetArray () const
 
double const & operator[] (size_t i) const
 Indexing.
 
double & operator[] (size_t i)
 
bool operator== (GfVec4d const &other) const
 Equality comparison.
 
bool operator!= (GfVec4d const &other) const
 
GF_API bool operator== (class GfVec4f const &other) const
 Equality comparison.
 
GF_API bool operator== (class GfVec4h const &other) const
 Equality comparison.
 
GF_API bool operator== (class GfVec4i const &other) const
 Equality comparison.
 
GfVec4d operator- () const
 Create a vec with negated elements.
 
GfVec4doperator+= (GfVec4d const &other)
 Addition.
 
GfVec4doperator-= (GfVec4d const &other)
 Subtraction.
 
GfVec4doperator*= (double s)
 Multiplication by scalar.
 
GfVec4d operator* (double s) const
 
GfVec4doperator/= (double s)
 Division by scalar.
 
GfVec4d operator/ (double s) const
 
double operator* (GfVec4d const &v) const
 See GfDot().
 
GfVec4d GetProjection (GfVec4d const &v) const
 Returns the projection of this onto v.
 
GfVec4d GetComplement (GfVec4d const &b) const
 Returns the orthogonal complement of this->GetProjection(b).
 
double GetLengthSq () const
 Squared length.
 
double GetLength () const
 Length.
 
double Normalize (double eps=GF_MIN_VECTOR_LENGTH)
 Normalizes the vector in place to unit length, returning the length before normalization.
 
GfVec4d GetNormalized (double eps=GF_MIN_VECTOR_LENGTH) const
 

Static Public Member Functions

static GfVec4d XAxis ()
 Create a unit vector along the X-axis.
 
static GfVec4d YAxis ()
 Create a unit vector along the Y-axis.
 
static GfVec4d ZAxis ()
 Create a unit vector along the Z-axis.
 
static GfVec4d WAxis ()
 Create a unit vector along the W-axis.
 
static GfVec4d 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 (GfVec4d const &vec)
 Hash.
 
GfVec4d operator+ (GfVec4d const &l, GfVec4d const &r)
 
GfVec4d operator- (GfVec4d const &l, GfVec4d const &r)
 
GfVec4d operator* (double s, GfVec4d const &v)
 

Detailed Description

Basic type for a vector of 4 double components.

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

Definition at line 45 of file vec4d.h.

Member Typedef Documentation

◆ ScalarType

typedef double ScalarType

Scalar element type and dimension.

Definition at line 49 of file vec4d.h.

Constructor & Destructor Documentation

◆ GfVec4d() [1/7]

GfVec4d ( )
default

Default constructor does no initialization.

◆ GfVec4d() [2/7]

constexpr GfVec4d ( double  value)
inlineexplicitconstexpr

Initialize all elements to a single value.

Definition at line 56 of file vec4d.h.

◆ GfVec4d() [3/7]

constexpr GfVec4d ( double  s0,
double  s1,
double  s2,
double  s3 
)
inlineconstexpr

Initialize all elements with explicit arguments.

Definition at line 62 of file vec4d.h.

◆ GfVec4d() [4/7]

constexpr GfVec4d ( Scl const *  p)
inlineexplicitconstexpr

Construct with pointer to values.

Definition at line 69 of file vec4d.h.

◆ GfVec4d() [5/7]

GfVec4d ( class GfVec4f const &  other)
inline

Implicitly convert from GfVec4f.

Definition at line 296 of file vec4d.h.

◆ GfVec4d() [6/7]

GfVec4d ( class GfVec4h const &  other)
inline

Implicitly convert from GfVec4h.

Definition at line 304 of file vec4d.h.

◆ GfVec4d() [7/7]

GfVec4d ( class GfVec4i const &  other)
inline

Implicitly convert from GfVec4i.

Definition at line 312 of file vec4d.h.

Member Function Documentation

◆ Axis()

static GfVec4d 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 110 of file vec4d.h.

◆ data() [1/2]

double * data ( )
inline

Definition at line 133 of file vec4d.h.

◆ data() [2/2]

double const * data ( ) const
inline

Direct data access.

Definition at line 132 of file vec4d.h.

◆ GetArray()

double const * GetArray ( ) const
inline

Definition at line 134 of file vec4d.h.

◆ GetComplement()

GfVec4d GetComplement ( GfVec4d const &  b) const
inline

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

That is:

*this - this->GetProjection(b)
GfVec4d GetProjection(GfVec4d const &v) const
Returns the projection of this onto v.
Definition: vec4d.h:232

Definition at line 241 of file vec4d.h.

◆ GetLength()

double GetLength ( ) const
inline

Length.

Definition at line 251 of file vec4d.h.

◆ GetLengthSq()

double GetLengthSq ( ) const
inline

Squared length.

Definition at line 246 of file vec4d.h.

◆ GetNormalized()

GfVec4d GetNormalized ( double  eps = GF_MIN_VECTOR_LENGTH) const
inline

Definition at line 271 of file vec4d.h.

◆ GetProjection()

GfVec4d GetProjection ( GfVec4d const &  v) const
inline

Returns the projection of this onto v.

That is:

v * (*this * v)

Definition at line 232 of file vec4d.h.

◆ Normalize()

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

Definition at line 263 of file vec4d.h.

◆ operator!=()

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

Definition at line 152 of file vec4d.h.

◆ operator*() [1/2]

GfVec4d operator* ( double  s) const
inline

Definition at line 204 of file vec4d.h.

◆ operator*() [2/2]

double operator* ( GfVec4d const &  v) const
inline

See GfDot().

Definition at line 224 of file vec4d.h.

◆ operator*=()

GfVec4d & operator*= ( double  s)
inline

Multiplication by scalar.

Definition at line 197 of file vec4d.h.

◆ operator+=()

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

Addition.

Definition at line 173 of file vec4d.h.

◆ operator-()

GfVec4d operator- ( ) const
inline

Create a vec with negated elements.

Definition at line 168 of file vec4d.h.

◆ operator-=()

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

Subtraction.

Definition at line 185 of file vec4d.h.

◆ operator/()

GfVec4d operator/ ( double  s) const
inline

Definition at line 219 of file vec4d.h.

◆ operator/=()

GfVec4d & operator/= ( double  s)
inline

Division by scalar.

Definition at line 213 of file vec4d.h.

◆ operator==() [1/4]

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

Equality comparison.

◆ operator==() [2/4]

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

Equality comparison.

◆ operator==() [3/4]

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

Equality comparison.

◆ operator==() [4/4]

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

Equality comparison.

Definition at line 146 of file vec4d.h.

◆ operator[]() [1/2]

double & operator[] ( size_t  i)
inline

Definition at line 138 of file vec4d.h.

◆ operator[]() [2/2]

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

Indexing.

Definition at line 137 of file vec4d.h.

◆ Set() [1/2]

GfVec4d & Set ( double const *  a)
inline

Set all elements with a pointer to data.

Definition at line 127 of file vec4d.h.

◆ Set() [2/2]

GfVec4d & Set ( double  s0,
double  s1,
double  s2,
double  s3 
)
inline

Set all elements with passed arguments.

Definition at line 118 of file vec4d.h.

◆ WAxis()

static GfVec4d WAxis ( )
inlinestatic

Create a unit vector along the W-axis.

Definition at line 102 of file vec4d.h.

◆ XAxis()

static GfVec4d XAxis ( )
inlinestatic

Create a unit vector along the X-axis.

Definition at line 84 of file vec4d.h.

◆ YAxis()

static GfVec4d YAxis ( )
inlinestatic

Create a unit vector along the Y-axis.

Definition at line 90 of file vec4d.h.

◆ ZAxis()

static GfVec4d ZAxis ( )
inlinestatic

Create a unit vector along the Z-axis.

Definition at line 96 of file vec4d.h.

Friends And Related Function Documentation

◆ hash_value

size_t hash_value ( GfVec4d const &  vec)
friend

Hash.

Definition at line 141 of file vec4d.h.

◆ operator*

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

Definition at line 207 of file vec4d.h.

◆ operator+

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

Definition at line 180 of file vec4d.h.

◆ operator-

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

Definition at line 192 of file vec4d.h.

Member Data Documentation

◆ dimension

const size_t dimension = 4
static

Definition at line 50 of file vec4d.h.


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