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

#include <vec2i.h>

Public Types

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

Public Member Functions

 GfVec2i ()=default
 Default constructor does no initialization. More...
 
constexpr GfVec2i (int value)
 Initialize all elements to a single value. More...
 
constexpr GfVec2i (int s0, int s1)
 Initialize all elements with explicit arguments. More...
 
template<class Scl >
constexpr GfVec2i (Scl const *p)
 Construct with pointer to values. More...
 
GfVec2iSet (int s0, int s1)
 Set all elements with passed arguments. More...
 
GfVec2iSet (int const *a)
 Set all elements with a pointer to data. More...
 
int const * data () const
 Direct data access. More...
 
intdata ()
 
int const * GetArray () const
 
int const & operator[] (size_t i) const
 Indexing. More...
 
intoperator[] (size_t i)
 
bool operator== (GfVec2i const &other) const
 Equality comparison. More...
 
bool operator!= (GfVec2i const &other) const
 
GF_API bool operator== (class GfVec2d const &other) const
 Equality comparison. More...
 
GF_API bool operator== (class GfVec2f const &other) const
 Equality comparison. More...
 
GF_API bool operator== (class GfVec2h const &other) const
 Equality comparison. More...
 
GfVec2i operator- () const
 Create a vec with negated elements. More...
 
GfVec2ioperator+= (GfVec2i const &other)
 Addition. More...
 
GfVec2ioperator-= (GfVec2i const &other)
 Subtraction. More...
 
GfVec2ioperator*= (double s)
 Multiplication by scalar. More...
 
GfVec2i operator* (double s) const
 
GfVec2ioperator/= (int s)
 Division by scalar. More...
 
GfVec2i operator/ (int s) const
 
int operator* (GfVec2i const &v) const
 See GfDot(). More...
 
GfVec2i GetProjection (GfVec2i const &v) const
 
GfVec2i GetComplement (GfVec2i const &b) const
 
int GetLengthSq () const
 Squared length. More...
 

Static Public Member Functions

static GfVec2i XAxis ()
 Create a unit vector along the X-axis. More...
 
static GfVec2i YAxis ()
 Create a unit vector along the Y-axis. More...
 
static GfVec2i Axis (size_t i)
 

Static Public Attributes

static const size_t dimension = 2
 

Friends

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

Detailed Description

Basic type for a vector of 2 int components.

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

Definition at line 60 of file vec2i.h.

Member Typedef Documentation

Scalar element type and dimension.

Definition at line 64 of file vec2i.h.

Constructor & Destructor Documentation

GfVec2i::GfVec2i ( )
default

Default constructor does no initialization.

constexpr GfVec2i::GfVec2i ( int  value)
inlineexplicit

Initialize all elements to a single value.

Definition at line 71 of file vec2i.h.

constexpr GfVec2i::GfVec2i ( int  s0,
int  s1 
)
inline

Initialize all elements with explicit arguments.

Definition at line 77 of file vec2i.h.

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

Construct with pointer to values.

Definition at line 84 of file vec2i.h.

Member Function Documentation

static GfVec2i GfVec2i::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 2.

Definition at line 104 of file vec2i.h.

int const* GfVec2i::data ( ) const
inline

Direct data access.

Definition at line 124 of file vec2i.h.

int* GfVec2i::data ( )
inline

Definition at line 125 of file vec2i.h.

int const* GfVec2i::GetArray ( ) const
inline

Definition at line 126 of file vec2i.h.

GfVec2i GfVec2i::GetComplement ( GfVec2i const &  b) const
inline

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

*this - this->GetProjection(b)

Definition at line 223 of file vec2i.h.

int GfVec2i::GetLengthSq ( ) const
inline

Squared length.

Definition at line 228 of file vec2i.h.

GfVec2i GfVec2i::GetProjection ( GfVec2i const &  v) const
inline

Returns the projection of this onto v. That is:

v * (*this * v)

Definition at line 214 of file vec2i.h.

bool GfVec2i::operator!= ( GfVec2i const &  other) const
inline

Definition at line 142 of file vec2i.h.

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

Definition at line 188 of file vec2i.h.

int GfVec2i::operator* ( GfVec2i const &  v) const
inline

See GfDot().

Definition at line 206 of file vec2i.h.

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

Multiplication by scalar.

Definition at line 183 of file vec2i.h.

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

Addition.

Definition at line 163 of file vec2i.h.

GfVec2i GfVec2i::operator- ( ) const
inline

Create a vec with negated elements.

Definition at line 158 of file vec2i.h.

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

Subtraction.

Definition at line 173 of file vec2i.h.

GfVec2i GfVec2i::operator/ ( int  s) const
inline

Definition at line 201 of file vec2i.h.

GfVec2i& GfVec2i::operator/= ( int  s)
inline

Division by scalar.

Definition at line 196 of file vec2i.h.

bool GfVec2i::operator== ( GfVec2i const &  other) const
inline

Equality comparison.

Definition at line 138 of file vec2i.h.

GF_API bool GfVec2i::operator== ( class GfVec2d const &  other) const

Equality comparison.

GF_API bool GfVec2i::operator== ( class GfVec2f const &  other) const

Equality comparison.

GF_API bool GfVec2i::operator== ( class GfVec2h const &  other) const

Equality comparison.

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

Indexing.

Definition at line 129 of file vec2i.h.

int& GfVec2i::operator[] ( size_t  i)
inline

Definition at line 130 of file vec2i.h.

GfVec2i& GfVec2i::Set ( int  s0,
int  s1 
)
inline

Set all elements with passed arguments.

Definition at line 112 of file vec2i.h.

GfVec2i& GfVec2i::Set ( int const *  a)
inline

Set all elements with a pointer to data.

Definition at line 119 of file vec2i.h.

static GfVec2i GfVec2i::XAxis ( )
inlinestatic

Create a unit vector along the X-axis.

Definition at line 90 of file vec2i.h.

static GfVec2i GfVec2i::YAxis ( )
inlinestatic

Create a unit vector along the Y-axis.

Definition at line 96 of file vec2i.h.

Friends And Related Function Documentation

size_t hash_value ( GfVec2i const &  vec)
friend

Hash.

Definition at line 133 of file vec2i.h.

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

Definition at line 191 of file vec2i.h.

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

Definition at line 168 of file vec2i.h.

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

Definition at line 178 of file vec2i.h.

Member Data Documentation

const size_t GfVec2i::dimension = 2
static

Definition at line 65 of file vec2i.h.


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