Files Class List
IVec2< T > Class Template Reference

Detailed Description

template<typename T>
class cy::IVec2< T >

2D integer vector class

#include <cyIVector.h>

Public Member Functions

Conversion
template<typename T >
 operator Vec2< T > () const
 
Set & Get value methods
void Zero ()
 
void Get (T *p) const
 
void Set (const T *p)
 
void Set (const T &v)
 
void Set (const T &_x, const T &_y)
 
General methods
Sum () const
 
bool IsZero () const
 
Min () const
 
Max () const
 
int MinID () const
 
int MaxID () const
 
Limit methods
void Clamp (T minValue, T maxValue)
 
void ClampMin (T v)
 
void ClampMax (T v)
 
void Abs ()
 
Unary operators
IVec2 operator- () const
 
Binary operators
IVec2 operator+ (IVec2 const &p) const
 
IVec2 operator- (IVec2 const &p) const
 
IVec2 operator* (IVec2 const &p) const
 
IVec2 operator/ (IVec2 const &p) const
 
IVec2 operator+ (T const v) const
 
IVec2 operator- (T const v) const
 
IVec2 operator* (T const v) const
 
IVec2 operator/ (T const v) const
 
Assignment operators
IVec2 const & operator+= (IVec2 const &p)
 
IVec2 const & operator-= (IVec2 const &p)
 
IVec2 const & operator*= (IVec2 const &p)
 
IVec2 const & operator/= (IVec2 const &p)
 
IVec2 const & operator+= (T const v)
 
IVec2 const & operator-= (T const v)
 
IVec2 const & operator*= (T const v)
 
IVec2 const & operator/= (T const v)
 
Bitwise operators
IVec2 operator<< (IVec2 const &p) const
 
IVec2 operator>> (IVec2 const &p) const
 
IVec2 operator& (IVec2 const &p) const
 
IVec2 operator| (IVec2 const &p) const
 
IVec2 operator^ (IVec2 const &p) const
 
IVec2 operator<< (T const v) const
 
IVec2 operator>> (T const v) const
 
IVec2 operator& (T const v) const
 
IVec2 operator| (T const v) const
 
IVec2 operator^ (T const v) const
 
Bitwise Assignment operators
IVec2 const & operator<<= (IVec2 const &p)
 
IVec2 const & operator>>= (IVec2 const &p)
 
IVec2 const & operator&= (IVec2 const &p)
 
IVec2 const & operator|= (IVec2 const &p)
 
IVec2 const & operator^= (IVec2 const &p)
 
IVec2 const & operator<<= (T const v)
 
IVec2 const & operator>>= (T const v)
 
IVec2 const & operator&= (T const v)
 
IVec2 const & operator|= (T const v)
 
IVec2 const & operator^= (T const v)
 
Test operators
bool operator== (IVec2 const &p) const
 
bool operator!= (IVec2 const &p) const
 
Access operators
T & operator[] (int i)
 
T const & operator[] (int i) const
 
T & Element (int i)
 
T const & Element (int i) const
 
T * Data ()
 
T const * Data () const
 
Cross product and dot product
Dot (IVec2 const &p) const
 
operator% (IVec2 const &p) const
 

Public Attributes

x
 
y
 
elem [2]
 
Components of the vector
union {
   struct {
      T   x
 
      T   y
 
   } 
 
   T   elem [2]
 
}; 
 

Friends

IVec2 operator+ (const T v, const IVec2 &p)
 
IVec2 operator- (const T v, const IVec2 &p)
 
IVec2 operator* (const T v, const IVec2 &p)
 

Constructors

_y: x( _x)
 
 IVec2 () CY_CLASS_FUNCTION_DEFAULT IVec2(T _x
 
y (_y)
 
 IVec2 (T v)
 
 IVec2 (const IVec3< T > &p)
 
 IVec2 (const IVec4< T > &p)
 
template<typename S >
 IVec2 (const IVec2< S > &p)
 
template<typename S >
 IVec2 (const IVec3< S > &p)
 
template<typename S >
 IVec2 (const IVec4< S > &p)
 
template<int M>
 IVec2 (const IVec< T, M > &p)
 
template<typename S , int M>
 IVec2 (const IVec< S, M > &p)
 
template<typename P >
 IVec2 (const P &p)
 

Member Function Documentation

§ Zero()

void Zero ( )

Sets the coordinates as zero.

§ Get()

void Get ( T *  p) const

Puts the coordinate values into the array.

§ Set() [1/3]

void Set ( const T *  p)

Sets the coordinates using the values in the given array.

§ Set() [2/3]

void Set ( const T &  v)

Sets all coordinates using the given value.

§ Set() [3/3]

void Set ( const T &  _x,
const T &  _y 
)

Sets the coordinates using the given values.

§ Sum()

T Sum ( ) const

Returns the sum of its components.

§ IsZero()

bool IsZero ( ) const

Returns true if all components are exactly zero.

§ Min()

T Min ( ) const

Returns the sum of its components.

§ Max()

T Max ( ) const

Returns the sum of its components.

§ MinID()

int MinID ( ) const

Returns the sum of its components.

§ MaxID()

int MaxID ( ) const

Returns the sum of its components.

§ Clamp()

void Clamp ( minValue,
maxValue 
)

Converts all negative components to positive values.

§ ClampMin()

void ClampMin ( v)

Converts all negative components to positive values.

§ ClampMax()

void ClampMax ( v)

Converts all negative components to positive values.

§ Abs()

void Abs ( )

Converts all negative components to positive values.

§ Dot()

T Dot ( IVec2< T > const &  p) const

Dot product.

§ operator%()

T operator% ( IVec2< T > const &  p) const

Dot product operator.

Friends And Related Function Documentation

§ operator+

IVec2 operator+ ( const T  v,
const IVec2< T > &  p 
)
friend

Addition with a constant.

§ operator-

IVec2 operator- ( const T  v,
const IVec2< T > &  p 
)
friend

Subtraction from a constant.

§ operator*

IVec2 operator* ( const T  v,
const IVec2< T > &  p 
)
friend

Multiplication with a constant.