Loading...
Searching...
No Matches
GfVec3i Class Reference

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

#include <vec3i.h>

Public Types

typedef int ScalarType
 Scalar element type and dimension.
 

Public Member Functions

 GfVec3i ()=default
 GfVec3i value-initializes to zero and performs no default initialization, like float or double.
 
constexpr GfVec3i (int value)
 Initialize all elements to a single value.
 
constexpr GfVec3i (int s0, int s1, int s2)
 Initialize all elements with explicit arguments.
 
template<class Scl >
constexpr GfVec3i (Scl const *p)
 Construct with pointer to values.
 
GfVec3iSet (int s0, int s1, int s2)
 Set all elements with passed arguments.
 
GfVec3iSet (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== (GfVec3i const &other) const
 Equality comparison.
 
bool operator!= (GfVec3i const &other) const
 
GF_API bool operator== (class GfVec3d const &other) const
 Equality comparison.
 
GF_API bool operator== (class GfVec3f const &other) const
 Equality comparison.
 
GF_API bool operator== (class GfVec3h const &other) const
 Equality comparison.
 
GfVec3i operator- () const
 Create a vec with negated elements.
 
GfVec3ioperator+= (GfVec3i const &other)
 Addition.
 
GfVec3ioperator-= (GfVec3i const &other)
 Subtraction.
 
GfVec3ioperator*= (double s)
 Multiplication by scalar.
 
GfVec3i operator* (double s) const
 
GfVec3ioperator/= (int s)
 Division by scalar.
 
GfVec3i operator/ (int s) const
 
int operator* (GfVec3i const &v) const
 See GfDot().
 
GfVec3i GetProjection (GfVec3i const &v) const
 Returns the projection of this onto v.
 
GfVec3i GetComplement (GfVec3i 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 zyx() returns GfVec3i(z, y, x).

Every permutation of 2 to 3 of the 3 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 yx () const
 
constexpr GfVec2i yz () const
 
constexpr GfVec2i zx () const
 
constexpr GfVec2i zy () const
 
constexpr GfVec3i xyz () const
 
constexpr GfVec3i xzy () const
 
constexpr GfVec3i yxz () const
 
constexpr GfVec3i yzx () const
 
constexpr GfVec3i zxy () const
 
constexpr GfVec3i zyx () const
 

Static Public Member Functions

static GfVec3i XAxis ()
 Create a unit vector along the X-axis.
 
static GfVec3i YAxis ()
 Create a unit vector along the Y-axis.
 
static GfVec3i ZAxis ()
 Create a unit vector along the Z-axis.
 
static GfVec3i 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
 

Static Public Attributes

static const size_t dimension = 3
 

Friends

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

Detailed Description

Basic type for a vector of 3 int components.

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

Definition at line 44 of file vec3i.h.

Member Typedef Documentation

◆ ScalarType

Scalar element type and dimension.

Definition at line 48 of file vec3i.h.

Constructor & Destructor Documentation

◆ GfVec3i() [1/4]

GfVec3i ( )
default

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

◆ GfVec3i() [2/4]

GfVec3i ( int value)
inlineexplicitconstexpr

Initialize all elements to a single value.

Definition at line 70 of file vec3i.h.

◆ GfVec3i() [3/4]

GfVec3i ( int s0,
int s1,
int s2 )
inlineconstexpr

Initialize all elements with explicit arguments.

Definition at line 76 of file vec3i.h.

◆ GfVec3i() [4/4]

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

Construct with pointer to values.

Definition at line 83 of file vec3i.h.

Member Function Documentation

◆ Axis()

static GfVec3i 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 110 of file vec3i.h.

◆ data() [1/2]

int * data ( )
inline

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

◆ GetArray()

int const * GetArray ( ) const
inline

Definition at line 137 of file vec3i.h.

◆ GetComplement()

GfVec3i GetComplement ( GfVec3i const & b) const
inline

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

That is:

*this - this->GetProjection(b)
GfVec3i GetProjection(GfVec3i const &v) const
Returns the projection of this onto v.
Definition vec3i.h:230

Definition at line 239 of file vec3i.h.

◆ GetLengthSq()

int GetLengthSq ( ) const
inline

Squared length.

Definition at line 244 of file vec3i.h.

◆ GetProjection()

GfVec3i GetProjection ( GfVec3i const & v) const
inline

Returns the projection of this onto v.

That is:

v * (*this * v)

Definition at line 230 of file vec3i.h.

◆ operator!=()

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

Definition at line 154 of file vec3i.h.

◆ operator*() [1/2]

GfVec3i operator* ( double s) const
inline

Definition at line 203 of file vec3i.h.

◆ operator*() [2/2]

int operator* ( GfVec3i const & v) const
inline

See GfDot().

Definition at line 222 of file vec3i.h.

◆ operator*=()

GfVec3i & operator*= ( double s)
inline

Multiplication by scalar.

Definition at line 197 of file vec3i.h.

◆ operator+=()

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

Addition.

Definition at line 175 of file vec3i.h.

◆ operator-()

GfVec3i operator- ( ) const
inline

Create a vec with negated elements.

Definition at line 170 of file vec3i.h.

◆ operator-=()

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

Subtraction.

Definition at line 186 of file vec3i.h.

◆ operator/()

GfVec3i operator/ ( int s) const
inline

Definition at line 217 of file vec3i.h.

◆ operator/=()

GfVec3i & operator/= ( int s)
inline

Division by scalar.

Definition at line 211 of file vec3i.h.

◆ operator==() [1/4]

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

Equality comparison.

◆ operator==() [2/4]

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

Equality comparison.

◆ operator==() [3/4]

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

Equality comparison.

◆ operator==() [4/4]

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

Equality comparison.

Definition at line 149 of file vec3i.h.

◆ operator[]() [1/2]

int & operator[] ( size_t i)
inline

Definition at line 141 of file vec3i.h.

◆ operator[]() [2/2]

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

Indexing.

Definition at line 140 of file vec3i.h.

◆ Set() [1/2]

GfVec3i & Set ( int const * a)
inline

Set all elements with a pointer to data.

Definition at line 126 of file vec3i.h.

◆ Set() [2/2]

GfVec3i & Set ( int s0,
int s1,
int s2 )
inline

Set all elements with passed arguments.

Definition at line 118 of file vec3i.h.

◆ XAxis()

static GfVec3i XAxis ( )
inlinestatic

Create a unit vector along the X-axis.

Definition at line 88 of file vec3i.h.

◆ xy()

Vec xy ( ) const
constexpr

Definition at line 313 of file vec3i.h.

◆ xyz()

Vec xyz ( ) const
constexpr

Definition at line 361 of file vec3i.h.

◆ xz()

Vec xz ( ) const
constexpr

Definition at line 321 of file vec3i.h.

◆ xzy()

Vec xzy ( ) const
constexpr

Definition at line 369 of file vec3i.h.

◆ YAxis()

static GfVec3i YAxis ( )
inlinestatic

Create a unit vector along the Y-axis.

Definition at line 95 of file vec3i.h.

◆ yx()

Vec yx ( ) const
constexpr

Definition at line 329 of file vec3i.h.

◆ yxz()

Vec yxz ( ) const
constexpr

Definition at line 377 of file vec3i.h.

◆ yz()

Vec yz ( ) const
constexpr

Definition at line 337 of file vec3i.h.

◆ yzx()

Vec yzx ( ) const
constexpr

Definition at line 385 of file vec3i.h.

◆ ZAxis()

static GfVec3i ZAxis ( )
inlinestatic

Create a unit vector along the Z-axis.

Definition at line 102 of file vec3i.h.

◆ zx()

Vec zx ( ) const
constexpr

Definition at line 345 of file vec3i.h.

◆ zxy()

Vec zxy ( ) const
constexpr

Definition at line 393 of file vec3i.h.

◆ zy()

Vec zy ( ) const
constexpr

Definition at line 353 of file vec3i.h.

◆ zyx()

Vec zyx ( ) const
constexpr

Definition at line 401 of file vec3i.h.

Friends And Related Symbol Documentation

◆ hash_value

size_t hash_value ( GfVec3i const & vec)
friend

Hash.

Definition at line 144 of file vec3i.h.

◆ operator*

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

Definition at line 206 of file vec3i.h.

◆ operator+

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

Definition at line 181 of file vec3i.h.

◆ operator-

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

Definition at line 192 of file vec3i.h.

Member Data Documentation

◆ dimension

const size_t dimension = 3
static

Definition at line 49 of file vec3i.h.

◆ x

int x

Definition at line 62 of file vec3i.h.

◆ y

int y

Definition at line 62 of file vec3i.h.

◆ z

int z

Definition at line 62 of file vec3i.h.


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