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

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

#include <vec4i.h>

Public Types

typedef int ScalarType
 Scalar element type and dimension.
 

Public Member Functions

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

Static Public Member Functions

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

Detailed Description

Basic type for a vector of 4 int components.

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

Definition at line 43 of file vec4i.h.

Member Typedef Documentation

◆ ScalarType

typedef int ScalarType

Scalar element type and dimension.

Definition at line 47 of file vec4i.h.

Constructor & Destructor Documentation

◆ GfVec4i() [1/4]

GfVec4i ( )
default

Default constructor does no initialization.

◆ GfVec4i() [2/4]

constexpr GfVec4i ( int  value)
inlineexplicitconstexpr

Initialize all elements to a single value.

Definition at line 54 of file vec4i.h.

◆ GfVec4i() [3/4]

constexpr GfVec4i ( int  s0,
int  s1,
int  s2,
int  s3 
)
inlineconstexpr

Initialize all elements with explicit arguments.

Definition at line 60 of file vec4i.h.

◆ GfVec4i() [4/4]

constexpr GfVec4i ( Scl const *  p)
inlineexplicitconstexpr

Construct with pointer to values.

Definition at line 67 of file vec4i.h.

Member Function Documentation

◆ Axis()

static GfVec4i 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 99 of file vec4i.h.

◆ data() [1/2]

int * data ( )
inline

Definition at line 122 of file vec4i.h.

◆ data() [2/2]

int const * data ( ) const
inline

Direct data access.

Definition at line 121 of file vec4i.h.

◆ GetArray()

int const * GetArray ( ) const
inline

Definition at line 123 of file vec4i.h.

◆ GetComplement()

GfVec4i GetComplement ( GfVec4i const &  b) const
inline

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

That is:

*this - this->GetProjection(b)
GfVec4i GetProjection(GfVec4i const &v) const
Returns the projection of this onto v.
Definition: vec4i.h:221

Definition at line 230 of file vec4i.h.

◆ GetLengthSq()

int GetLengthSq ( ) const
inline

Squared length.

Definition at line 235 of file vec4i.h.

◆ GetProjection()

GfVec4i GetProjection ( GfVec4i const &  v) const
inline

Returns the projection of this onto v.

That is:

v * (*this * v)

Definition at line 221 of file vec4i.h.

◆ operator!=()

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

Definition at line 141 of file vec4i.h.

◆ operator*() [1/2]

GfVec4i operator* ( double  s) const
inline

Definition at line 193 of file vec4i.h.

◆ operator*() [2/2]

int operator* ( GfVec4i const &  v) const
inline

See GfDot().

Definition at line 213 of file vec4i.h.

◆ operator*=()

GfVec4i & operator*= ( double  s)
inline

Multiplication by scalar.

Definition at line 186 of file vec4i.h.

◆ operator+=()

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

Addition.

Definition at line 162 of file vec4i.h.

◆ operator-()

GfVec4i operator- ( ) const
inline

Create a vec with negated elements.

Definition at line 157 of file vec4i.h.

◆ operator-=()

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

Subtraction.

Definition at line 174 of file vec4i.h.

◆ operator/()

GfVec4i operator/ ( int  s) const
inline

Definition at line 208 of file vec4i.h.

◆ operator/=()

GfVec4i & operator/= ( int  s)
inline

Division by scalar.

Definition at line 201 of file vec4i.h.

◆ operator==() [1/4]

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

Equality comparison.

◆ operator==() [2/4]

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

Equality comparison.

◆ operator==() [3/4]

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

Equality comparison.

◆ operator==() [4/4]

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

Equality comparison.

Definition at line 135 of file vec4i.h.

◆ operator[]() [1/2]

int & operator[] ( size_t  i)
inline

Definition at line 127 of file vec4i.h.

◆ operator[]() [2/2]

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

Indexing.

Definition at line 126 of file vec4i.h.

◆ Set() [1/2]

GfVec4i & Set ( int const *  a)
inline

Set all elements with a pointer to data.

Definition at line 116 of file vec4i.h.

◆ Set() [2/2]

GfVec4i & Set ( int  s0,
int  s1,
int  s2,
int  s3 
)
inline

Set all elements with passed arguments.

Definition at line 107 of file vec4i.h.

◆ WAxis()

static GfVec4i WAxis ( )
inlinestatic

Create a unit vector along the W-axis.

Definition at line 91 of file vec4i.h.

◆ XAxis()

static GfVec4i XAxis ( )
inlinestatic

Create a unit vector along the X-axis.

Definition at line 73 of file vec4i.h.

◆ YAxis()

static GfVec4i YAxis ( )
inlinestatic

Create a unit vector along the Y-axis.

Definition at line 79 of file vec4i.h.

◆ ZAxis()

static GfVec4i ZAxis ( )
inlinestatic

Create a unit vector along the Z-axis.

Definition at line 85 of file vec4i.h.

Friends And Related Function Documentation

◆ hash_value

size_t hash_value ( GfVec4i const &  vec)
friend

Hash.

Definition at line 130 of file vec4i.h.

◆ operator*

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

Definition at line 196 of file vec4i.h.

◆ operator+

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

Definition at line 169 of file vec4i.h.

◆ operator-

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

Definition at line 181 of file vec4i.h.

Member Data Documentation

◆ dimension

const size_t dimension = 4
static

Definition at line 48 of file vec4i.h.


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