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

Constructors
 IVec2 (T _x, T _y)
 
 IVec2 (T v)
 
 IVec2 (IVec3< T > const &p)
 
 IVec2 (IVec4< T > const &p)
 
 IVec2 (T const *v)
 
template<typename S >
 IVec2 (IVec2< S > const &p)
 
template<typename S >
 IVec2 (IVec3< S > const &p)
 
template<typename S >
 IVec2 (IVec4< S > const &p)
 
template<int M>
 IVec2 (IVec< T, M > const &p)
 
template<typename S , int M>
 IVec2 (IVec< S, M > const &p)
 
template<typename P >
 IVec2 (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.
 
void Set (T _x, T _y)
 Sets the coordinates using the given values.
 
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 minimum component of the vector.
 
Max () const
 Returns the maximum component of the vector.
 
int MinComp () const
 Returns the index of the minimum component of the vector.
 
int MaxComp () const
 Returns the index of the maximum component of the vector.
 
IVec2 Abs () const
 Returns a vector containing the absolute values of all components.
 
IVec2 SortAsc () const
 Returns a vector with components sorted in ascending order.
 
IVec2 SortDesc () const
 Returns a vector with components sorted in descending order.
 
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
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
 Dot product.
 
operator% (IVec2 const &p) const
 Dot product operator.
 

Public Attributes

Components of the vector
x
 
y
 

Friends

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