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

Constructors
 IVec4 (T _x, T _y, T _z, T _w)
 
 IVec4 (T v)
 
 IVec4 (IVec3< T > const &p, T _w=0)
 
 IVec4 (IVec2< T > const &p, T _z=0, T _w=0)
 
 IVec4 (T const *v)
 
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)
 
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, T _z, T _w=0)
 Sets the coordinates using the given values.
 
Length and Normalize 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.
 
IVec4 Abs () const
 Returns a vector containing the absolute values of all components.
 
IVec4 SortAsc () const
 Returns a vector with components sorted in ascending order.
 
IVec4 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
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
 Dot product.
 
operator% (IVec4 const &p) const
 Dot product.
 
Conversion Methods
IVec2< T > XY () const
 
IVec3< T > XYZ () const
 

Public Attributes

Components of the vector
x
 
y
 
z
 
w
 

Friends

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