Files Class List
IVec< T, N > Class Template Reference

Detailed Description

template<typename T, int N>
class cy::IVec< T, N >

A general class for N-dimensional integer vectors.

#include <cyIVector.h>

Public Member Functions

Constructors
 IVec () CY_CLASS_FUNCTION_DEFAULT IVec(IVec const &p)
 
 IVec (const T *p)
 
 IVec (const T &v)
 
template<typename S >
 IVec (IVec< S, N > const &p)
 
template<int M>
 IVec (IVec< T, M > const &p)
 
template<typename S , int M>
 IVec (IVec< S, M > const &p)
 
 IVec (IVec2< T > const &p)
 
 IVec (IVec3< T > const &p)
 
 IVec (IVec4< T > const &p)
 
template<typename S >
 IVec (const IVec2< S > &p)
 
template<typename S >
 IVec (const IVec3< S > &p)
 
template<typename S >
 IVec (const IVec4< S > &p)
 
template<typename P >
 IVec (const P &p)
 
Set & Get value methods
void Zero ()
 
void Get (T *p) const
 
void Set (T const *p)
 
void Set (T v)
 
template<int M>
void CopyData (T *p)
 
template<typename S , int M>
void ConvertData (S *p)
 
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
IVec operator- () const
 
Binary operators
IVec operator+ (IVec const &p) const
 
IVec operator- (IVec const &p) const
 
IVec operator* (IVec const &p) const
 
IVec operator/ (IVec const &p) const
 
IVec operator+ (T const v) const
 
IVec operator- (T const v) const
 
IVec operator* (T const v) const
 
IVec operator/ (T const v) const
 
Assignment operators
const IVecoperator+= (IVec const &p)
 
const IVecoperator-= (IVec const &p)
 
const IVecoperator*= (IVec const &p)
 
const IVecoperator/= (IVec const &p)
 
const IVecoperator+= (T const v)
 
const IVecoperator-= (T const v)
 
const IVecoperator*= (T const v)
 
const IVecoperator/= (T const v)
 
Bitwise operators
IVec operator<< (IVec const &p) const
 
IVec operator>> (IVec const &p) const
 
IVec operator& (IVec const &p) const
 
IVec operator| (IVec const &p) const
 
IVec operator^ (IVec const &p) const
 
IVec operator<< (T const v) const
 
IVec operator>> (T const v) const
 
IVec operator& (T const v) const
 
IVec operator| (T const v) const
 
IVec operator^ (T const v) const
 
Bitwise Assignment operators
const IVecoperator<<= (IVec const &p)
 
const IVecoperator>>= (IVec const &p)
 
const IVecoperator&= (IVec const &p)
 
const IVecoperator|= (IVec const &p)
 
const IVecoperator^= (IVec const &p)
 
const IVecoperator<<= (T const v)
 
const IVecoperator>>= (T const v)
 
const IVecoperator&= (T const v)
 
const IVecoperator|= (T const v)
 
const IVecoperator^= (T const v)
 
Test operators
bool operator== (IVec const &p) const
 
bool operator!= (IVec const &p) const
 
Access operators
T & operator[] (int i)
 
operator[] (int i) const
 
Dot product
Dot (IVec const &p) const
 
operator% (IVec const &p) const
 

Public Attributes

Components of the vector
elem [N]
 

Friends

IVec operator+ (T const v, IVec const &p)
 
IVec operator- (T const v, IVec const &p)
 
IVec operator* (T const v, IVec const &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/2]

void Set ( T const *  p)

Sets the coordinates using the values in the given array.

§ Set() [2/2]

void Set ( v)

Sets all coordinates using the given value.

§ CopyData()

void CopyData ( T *  p)

Sets the coordinates as zero.

§ ConvertData()

void ConvertData ( S *  p)

Sets the coordinates as zero.

§ 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 ( IVec< T, N > const &  p) const

Dot product.

§ operator%()

T operator% ( IVec< T, N > const &  p) const

Dot product operator.

Friends And Related Function Documentation

§ operator+

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

Addition with a constant.

§ operator-

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

Subtraction from a constant.

§ operator*

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

Multiplication with a constant.