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 (T const *p)
 
 IVec (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 (IVec2< S > const &p)
 
template<typename S >
 IVec (IVec3< S > const &p)
 
template<typename S >
 IVec (IVec4< S > const &p)
 
template<typename P >
 IVec (P const &p)
 
Set & Get value methods
void Zero ()
 Sets the coordinates as zero.
 
void Get (T *p) const
 Puts the coordinate values into the array.
 
void Set (T const *p)
 Sets the coordinates using the values in the given array.
 
void Set (T v)
 Sets all coordinates using the given value.
 
template<int M>
void CopyData (T *p)
 Sets the coordinates as zero.
 
template<typename S , int M>
void ConvertData (S *p)
 Sets the coordinates as zero.
 
General methods
Sum () const
 Returns the sum of its components.
 
bool IsZero () const
 Returns true if all components are exactly zero.
 
Min () const
 Returns the sum of its components.
 
Max () const
 Returns the sum of its components.
 
int MinComp () const
 Returns the sum of its components.
 
int MaxComp () const
 Returns the sum of its components.
 
Limit methods
void Clamp (T minValue, T maxValue)
 Ensures that all components of the vector are within the given limits.
 
void ClampMin (T v)
 Ensures that all components of the vector are greater than or equal to the given limit.
 
void ClampMax (T v)
 Ensures that all components of the vector are smaller than or equal to the given limit.
 
void SetAbs ()
 Converts all negative components to positive values.
 
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
 Dot product.
 
operator% (IVec const &p) const
 Dot product operator.
 

Public Attributes

Components of the vector
elem [N]
 

Friends

IVec operator- (T v, IVec const &p)
 Subtraction from a constant.
 
IVec operator+ (T v, IVec const &p)
 Addition with a constant.
 
IVec operator* (T v, IVec const &p)
 Multiplication with a constant.