Loading...
Searching...
No Matches
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
 GfVec4i value-initializes to zero and performs no default initialization, like float or double.
 
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.
 
Swizzles

Each accessor returns a new vector built from this one's components, in the order named.

For example wzyx() returns GfVec4i(w, z, y, x).

Every permutation of 2 to 4 of the 4 components is available. Repeated components (xx, xyy) are not; nor are single-component swizzles, which are just the components themselves.

The results are ordinary GfVecs, so all the usual operators, GfDot() and so on apply to them. They are values, not references into this vector, so they cannot be assigned through.

constexpr GfVec2i xy () const
 
constexpr GfVec2i xz () const
 
constexpr GfVec2i xw () const
 
constexpr GfVec2i yx () const
 
constexpr GfVec2i yz () const
 
constexpr GfVec2i yw () const
 
constexpr GfVec2i zx () const
 
constexpr GfVec2i zy () const
 
constexpr GfVec2i zw () const
 
constexpr GfVec2i wx () const
 
constexpr GfVec2i wy () const
 
constexpr GfVec2i wz () const
 
constexpr GfVec3i xyz () const
 
constexpr GfVec3i xyw () const
 
constexpr GfVec3i xzy () const
 
constexpr GfVec3i xzw () const
 
constexpr GfVec3i xwy () const
 
constexpr GfVec3i xwz () const
 
constexpr GfVec3i yxz () const
 
constexpr GfVec3i yxw () const
 
constexpr GfVec3i yzx () const
 
constexpr GfVec3i yzw () const
 
constexpr GfVec3i ywx () const
 
constexpr GfVec3i ywz () const
 
constexpr GfVec3i zxy () const
 
constexpr GfVec3i zxw () const
 
constexpr GfVec3i zyx () const
 
constexpr GfVec3i zyw () const
 
constexpr GfVec3i zwx () const
 
constexpr GfVec3i zwy () const
 
constexpr GfVec3i wxy () const
 
constexpr GfVec3i wxz () const
 
constexpr GfVec3i wyx () const
 
constexpr GfVec3i wyz () const
 
constexpr GfVec3i wzx () const
 
constexpr GfVec3i wzy () const
 
constexpr GfVec4i xyzw () const
 
constexpr GfVec4i xywz () const
 
constexpr GfVec4i xzyw () const
 
constexpr GfVec4i xzwy () const
 
constexpr GfVec4i xwyz () const
 
constexpr GfVec4i xwzy () const
 
constexpr GfVec4i yxzw () const
 
constexpr GfVec4i yxwz () const
 
constexpr GfVec4i yzxw () const
 
constexpr GfVec4i yzwx () const
 
constexpr GfVec4i ywxz () const
 
constexpr GfVec4i ywzx () const
 
constexpr GfVec4i zxyw () const
 
constexpr GfVec4i zxwy () const
 
constexpr GfVec4i zyxw () const
 
constexpr GfVec4i zywx () const
 
constexpr GfVec4i zwxy () const
 
constexpr GfVec4i zwyx () const
 
constexpr GfVec4i wxyz () const
 
constexpr GfVec4i wxzy () const
 
constexpr GfVec4i wyxz () const
 
constexpr GfVec4i wyzx () const
 
constexpr GfVec4i wzxy () const
 
constexpr GfVec4i wzyx () const
 

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.
 

Public Attributes

Vector Components

The vector's components, which are also its storage.

These are public and directly readable and writable.

The components are contiguous and in declaration order, so &x points to dimension values. See data() and operator[]().

For multi-component access see the swizzle accessors below, which return a new vector by value.

int x
 
int y
 
int z
 
int w
 

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 45 of file vec4i.h.

Member Typedef Documentation

◆ ScalarType

Scalar element type and dimension.

Definition at line 49 of file vec4i.h.

Constructor & Destructor Documentation

◆ GfVec4i() [1/4]

GfVec4i ( )
default

GfVec4i value-initializes to zero and performs no default initialization, like float or double.

◆ GfVec4i() [2/4]

GfVec4i ( int value)
inlineexplicitconstexpr

Initialize all elements to a single value.

Definition at line 71 of file vec4i.h.

◆ GfVec4i() [3/4]

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

Initialize all elements with explicit arguments.

Definition at line 77 of file vec4i.h.

◆ GfVec4i() [4/4]

template<class Scl >
GfVec4i ( Scl const * p)
inlineexplicitconstexpr

Construct with pointer to values.

Definition at line 84 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 118 of file vec4i.h.

◆ data() [1/2]

int * data ( )
inline

Definition at line 145 of file vec4i.h.

◆ data() [2/2]

int const * data ( ) const
inline

Direct data access.

data() is the only member that relies on the components being contiguous; every other member either names them directly or goes through here.

Definition at line 144 of file vec4i.h.

◆ GetArray()

int const * GetArray ( ) const
inline

Definition at line 146 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:244

Definition at line 253 of file vec4i.h.

◆ GetLengthSq()

int GetLengthSq ( ) const
inline

Squared length.

Definition at line 258 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 244 of file vec4i.h.

◆ operator!=()

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

Definition at line 164 of file vec4i.h.

◆ operator*() [1/2]

GfVec4i operator* ( double s) const
inline

Definition at line 216 of file vec4i.h.

◆ operator*() [2/2]

int operator* ( GfVec4i const & v) const
inline

See GfDot().

Definition at line 236 of file vec4i.h.

◆ operator*=()

GfVec4i & operator*= ( double s)
inline

Multiplication by scalar.

Definition at line 209 of file vec4i.h.

◆ operator+=()

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

Addition.

Definition at line 185 of file vec4i.h.

◆ operator-()

GfVec4i operator- ( ) const
inline

Create a vec with negated elements.

Definition at line 180 of file vec4i.h.

◆ operator-=()

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

Subtraction.

Definition at line 197 of file vec4i.h.

◆ operator/()

GfVec4i operator/ ( int s) const
inline

Definition at line 231 of file vec4i.h.

◆ operator/=()

GfVec4i & operator/= ( int s)
inline

Division by scalar.

Definition at line 224 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 158 of file vec4i.h.

◆ operator[]() [1/2]

int & operator[] ( size_t i)
inline

Definition at line 150 of file vec4i.h.

◆ operator[]() [2/2]

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

Indexing.

Definition at line 149 of file vec4i.h.

◆ Set() [1/2]

GfVec4i & Set ( int const * a)
inline

Set all elements with a pointer to data.

Definition at line 135 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 126 of file vec4i.h.

◆ WAxis()

static GfVec4i WAxis ( )
inlinestatic

Create a unit vector along the W-axis.

Definition at line 110 of file vec4i.h.

◆ wx()

Vec wx ( ) const
constexpr

Definition at line 496 of file vec4i.h.

◆ wxy()

Vec wxy ( ) const
constexpr

Definition at line 664 of file vec4i.h.

◆ wxyz()

Vec wxyz ( ) const
constexpr

Definition at line 856 of file vec4i.h.

◆ wxz()

Vec wxz ( ) const
constexpr

Definition at line 672 of file vec4i.h.

◆ wxzy()

Vec wxzy ( ) const
constexpr

Definition at line 864 of file vec4i.h.

◆ wy()

Vec wy ( ) const
constexpr

Definition at line 504 of file vec4i.h.

◆ wyx()

Vec wyx ( ) const
constexpr

Definition at line 680 of file vec4i.h.

◆ wyxz()

Vec wyxz ( ) const
constexpr

Definition at line 872 of file vec4i.h.

◆ wyz()

Vec wyz ( ) const
constexpr

Definition at line 688 of file vec4i.h.

◆ wyzx()

Vec wyzx ( ) const
constexpr

Definition at line 880 of file vec4i.h.

◆ wz()

Vec wz ( ) const
constexpr

Definition at line 512 of file vec4i.h.

◆ wzx()

Vec wzx ( ) const
constexpr

Definition at line 696 of file vec4i.h.

◆ wzxy()

Vec wzxy ( ) const
constexpr

Definition at line 888 of file vec4i.h.

◆ wzy()

Vec wzy ( ) const
constexpr

Definition at line 704 of file vec4i.h.

◆ wzyx()

Vec wzyx ( ) const
constexpr

Definition at line 896 of file vec4i.h.

◆ XAxis()

static GfVec4i XAxis ( )
inlinestatic

Create a unit vector along the X-axis.

Definition at line 89 of file vec4i.h.

◆ xw()

Vec xw ( ) const
constexpr

Definition at line 440 of file vec4i.h.

◆ xwy()

Vec xwy ( ) const
constexpr

Definition at line 552 of file vec4i.h.

◆ xwyz()

Vec xwyz ( ) const
constexpr

Definition at line 744 of file vec4i.h.

◆ xwz()

Vec xwz ( ) const
constexpr

Definition at line 560 of file vec4i.h.

◆ xwzy()

Vec xwzy ( ) const
constexpr

Definition at line 752 of file vec4i.h.

◆ xy()

Vec xy ( ) const
constexpr

Definition at line 424 of file vec4i.h.

◆ xyw()

Vec xyw ( ) const
constexpr

Definition at line 528 of file vec4i.h.

◆ xywz()

Vec xywz ( ) const
constexpr

Definition at line 720 of file vec4i.h.

◆ xyz()

Vec xyz ( ) const
constexpr

Definition at line 520 of file vec4i.h.

◆ xyzw()

Vec xyzw ( ) const
constexpr

Definition at line 712 of file vec4i.h.

◆ xz()

Vec xz ( ) const
constexpr

Definition at line 432 of file vec4i.h.

◆ xzw()

Vec xzw ( ) const
constexpr

Definition at line 544 of file vec4i.h.

◆ xzwy()

Vec xzwy ( ) const
constexpr

Definition at line 736 of file vec4i.h.

◆ xzy()

Vec xzy ( ) const
constexpr

Definition at line 536 of file vec4i.h.

◆ xzyw()

Vec xzyw ( ) const
constexpr

Definition at line 728 of file vec4i.h.

◆ YAxis()

static GfVec4i YAxis ( )
inlinestatic

Create a unit vector along the Y-axis.

Definition at line 96 of file vec4i.h.

◆ yw()

Vec yw ( ) const
constexpr

Definition at line 464 of file vec4i.h.

◆ ywx()

Vec ywx ( ) const
constexpr

Definition at line 600 of file vec4i.h.

◆ ywxz()

Vec ywxz ( ) const
constexpr

Definition at line 792 of file vec4i.h.

◆ ywz()

Vec ywz ( ) const
constexpr

Definition at line 608 of file vec4i.h.

◆ ywzx()

Vec ywzx ( ) const
constexpr

Definition at line 800 of file vec4i.h.

◆ yx()

Vec yx ( ) const
constexpr

Definition at line 448 of file vec4i.h.

◆ yxw()

Vec yxw ( ) const
constexpr

Definition at line 576 of file vec4i.h.

◆ yxwz()

Vec yxwz ( ) const
constexpr

Definition at line 768 of file vec4i.h.

◆ yxz()

Vec yxz ( ) const
constexpr

Definition at line 568 of file vec4i.h.

◆ yxzw()

Vec yxzw ( ) const
constexpr

Definition at line 760 of file vec4i.h.

◆ yz()

Vec yz ( ) const
constexpr

Definition at line 456 of file vec4i.h.

◆ yzw()

Vec yzw ( ) const
constexpr

Definition at line 592 of file vec4i.h.

◆ yzwx()

Vec yzwx ( ) const
constexpr

Definition at line 784 of file vec4i.h.

◆ yzx()

Vec yzx ( ) const
constexpr

Definition at line 584 of file vec4i.h.

◆ yzxw()

Vec yzxw ( ) const
constexpr

Definition at line 776 of file vec4i.h.

◆ ZAxis()

static GfVec4i ZAxis ( )
inlinestatic

Create a unit vector along the Z-axis.

Definition at line 103 of file vec4i.h.

◆ zw()

Vec zw ( ) const
constexpr

Definition at line 488 of file vec4i.h.

◆ zwx()

Vec zwx ( ) const
constexpr

Definition at line 648 of file vec4i.h.

◆ zwxy()

Vec zwxy ( ) const
constexpr

Definition at line 840 of file vec4i.h.

◆ zwy()

Vec zwy ( ) const
constexpr

Definition at line 656 of file vec4i.h.

◆ zwyx()

Vec zwyx ( ) const
constexpr

Definition at line 848 of file vec4i.h.

◆ zx()

Vec zx ( ) const
constexpr

Definition at line 472 of file vec4i.h.

◆ zxw()

Vec zxw ( ) const
constexpr

Definition at line 624 of file vec4i.h.

◆ zxwy()

Vec zxwy ( ) const
constexpr

Definition at line 816 of file vec4i.h.

◆ zxy()

Vec zxy ( ) const
constexpr

Definition at line 616 of file vec4i.h.

◆ zxyw()

Vec zxyw ( ) const
constexpr

Definition at line 808 of file vec4i.h.

◆ zy()

Vec zy ( ) const
constexpr

Definition at line 480 of file vec4i.h.

◆ zyw()

Vec zyw ( ) const
constexpr

Definition at line 640 of file vec4i.h.

◆ zywx()

Vec zywx ( ) const
constexpr

Definition at line 832 of file vec4i.h.

◆ zyx()

Vec zyx ( ) const
constexpr

Definition at line 632 of file vec4i.h.

◆ zyxw()

Vec zyxw ( ) const
constexpr

Definition at line 824 of file vec4i.h.

Friends And Related Symbol Documentation

◆ hash_value

size_t hash_value ( GfVec4i const & vec)
friend

Hash.

Definition at line 153 of file vec4i.h.

◆ operator*

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

Definition at line 219 of file vec4i.h.

◆ operator+

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

Definition at line 192 of file vec4i.h.

◆ operator-

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

Definition at line 204 of file vec4i.h.

Member Data Documentation

◆ dimension

const size_t dimension = 4
static

Definition at line 50 of file vec4i.h.

◆ w

int w

Definition at line 63 of file vec4i.h.

◆ x

int x

Definition at line 63 of file vec4i.h.

◆ y

int y

Definition at line 63 of file vec4i.h.

◆ z

int z

Definition at line 63 of file vec4i.h.


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