Files Class List
IVec4< T > Class Template Reference

Detailed Description

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

4D integer vector class

#include <cyIVector.h>

Public Member Functions

Conversion
template<typename T >
 operator Vec4< T > () const
 
Set & Get value methods
void Zero ()
 
void Get (T *p) const
 
void Set (T const *p)
 
void Set (T v)
 
void Set (T _x, T _y, T _z, T _w=0)
 
Length and Normalize 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
IVec4 operator- () const
 
Binary operators
IVec4 operator+ (IVec4 const &p) const
 
IVec4 operator- (IVec4 const &p) const
 
IVec4 operator* (IVec4 const &p) const
 
IVec4 operator/ (IVec4 const &p) const
 
IVec4 operator+ (T const v) const
 
IVec4 operator- (T const v) const
 
IVec4 operator* (T const v) const
 
IVec4 operator/ (T const v) const
 
Assignment operators
IVec4 const & operator+= (IVec4 const &p)
 
IVec4 const & operator-= (IVec4 const &p)
 
IVec4 const & operator*= (IVec4 const &p)
 
IVec4 const & operator/= (IVec4 const &p)
 
IVec4 const & operator+= (T const v)
 
IVec4 const & operator-= (T const v)
 
IVec4 const & operator*= (T const v)
 
IVec4 const & operator/= (T const v)
 
Bitwise operators
IVec4 operator<< (IVec4 const &p) const
 
IVec4 operator>> (IVec4 const &p) const
 
IVec4 operator& (IVec4 const &p) const
 
IVec4 operator| (IVec4 const &p) const
 
IVec4 operator^ (IVec4 const &p) const
 
IVec4 operator<< (T const v) const
 
IVec4 operator>> (T const v) const
 
IVec4 operator& (T const v) const
 
IVec4 operator| (T const v) const
 
IVec4 operator^ (T const v) const
 
Bitwise Assignment operators
IVec4 const & operator<<= (IVec4 const &p)
 
IVec4 const & operator>>= (IVec4 const &p)
 
IVec4 const & operator&= (IVec4 const &p)
 
IVec4 const & operator|= (IVec4 const &p)
 
IVec4 const & operator^= (IVec4 const &p)
 
IVec4 const & operator<<= (T const v)
 
IVec4 const & operator>>= (T const v)
 
IVec4 const & operator&= (T const v)
 
IVec4 const & operator|= (T const v)
 
IVec4 const & operator^= (T const v)
 
Test operators
bool operator== (IVec4 const &p) const
 
bool operator!= (IVec4 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 (IVec4 const &p) const
 
operator% (IVec4 const &p) const
 
Conversion Methods
IVec2< T > XY () const
 
IVec3< T > XYZ () const
 

Public Attributes

x
 
y
 
z
 
w
 
elem [4]
 
Components of the vector
union {
   struct {
      T   x
 
      T   y
 
      T   z
 
      T   w
 
   } 
 
   T   elem [4]
 
}; 
 

Friends

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

Constructors

_y
 
T T _z
 
T T T _w: x( _x)
 
 IVec4 () CY_CLASS_FUNCTION_DEFAULT IVec4(T _x
 
T T T y (_y)
 
T T T z (_z)
 
T T T w (_w)
 
 IVec4 (T v)
 
 IVec4 (IVec3< T > const &p, T _w=0)
 
 IVec4 (IVec2< T > const &p, T _z=0, T _w=0)
 
template<typename S >
 IVec4 (IVec4< S > const &p)
 
template<typename S >
 IVec4 (IVec3< S > const &p, T _w=0)
 
template<typename S >
 IVec4 (IVec2< S > const &p, T _z=0, T _w=0)
 
template<int M>
 IVec4 (IVec< T, M > const &p)
 
template<typename S , int M>
 IVec4 (IVec< S, M > const &p)
 
template<typename P >
 IVec4 (P 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/3]

void Set ( T const *  p)

Sets the coordinates using the values in the given array.

§ Set() [2/3]

void Set ( v)

Sets all coordinates using the given value.

§ Set() [3/3]

void Set ( _x,
_y,
_z,
_w = 0 
)

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 ( IVec4< T > const &  p) const

Dot product.

§ operator%()

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

Dot product.

Friends And Related Function Documentation

§ operator+

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

Addition with a constant.

§ operator-

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

Subtraction from a constant.

§ operator*

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

Multiplication with a constant.