Files Class List
IVec3< T > Class Template Reference

Detailed Description

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

3D integer vector class

#include <cyIVector.h>

Public Member Functions

Conversion
template<typename T >
 operator Vec3< 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)
 
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
IVec3 operator- () const
 
Binary operators
IVec3 operator+ (IVec3 const &p) const
 
IVec3 operator- (IVec3 const &p) const
 
IVec3 operator* (IVec3 const &p) const
 
IVec3 operator/ (IVec3 const &p) const
 
IVec3 operator+ (T const v) const
 
IVec3 operator- (T const v) const
 
IVec3 operator* (T const v) const
 
IVec3 operator/ (T const v) const
 
Assignment operators
IVec3 const & operator+= (IVec3 const &p)
 
IVec3 const & operator-= (IVec3 const &p)
 
IVec3 const & operator*= (IVec3 const &p)
 
IVec3 const & operator/= (IVec3 const &p)
 
IVec3 const & operator+= (T const v)
 
IVec3 const & operator-= (T const v)
 
IVec3 const & operator*= (T const v)
 
IVec3 const & operator/= (T const v)
 
Bitwise operators
IVec3 operator<< (IVec3 const &p) const
 
IVec3 operator>> (IVec3 const &p) const
 
IVec3 operator& (IVec3 const &p) const
 
IVec3 operator| (IVec3 const &p) const
 
IVec3 operator^ (IVec3 const &p) const
 
IVec3 operator<< (T const v) const
 
IVec3 operator>> (T const v) const
 
IVec3 operator& (T const v) const
 
IVec3 operator| (T const v) const
 
IVec3 operator^ (T const v) const
 
Bitwise Assignment operators
IVec3 const & operator<<= (IVec3 const &p)
 
IVec3 const & operator>>= (IVec3 const &p)
 
IVec3 const & operator&= (IVec3 const &p)
 
IVec3 const & operator|= (IVec3 const &p)
 
IVec3 const & operator^= (IVec3 const &p)
 
IVec3 const & operator<<= (T const v)
 
IVec3 const & operator>>= (T const v)
 
IVec3 const & operator&= (T const v)
 
IVec3 const & operator|= (T const v)
 
IVec3 const & operator^= (T const v)
 
Test operators
bool operator== (IVec3 const &p) const
 
bool operator!= (IVec3 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 (IVec3 const &p) const
 
operator% (IVec3 const &p) const
 
Conversion Methods
IVec2< T > XY () const
 

Public Attributes

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

Friends

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

Constructors

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

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

Dot product.

§ operator%()

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

Dot product.

Friends And Related Function Documentation

§ operator+

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

Addition with a constant.

§ operator-

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

Subtraction from a constant.

§ operator*

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

Multiplication with a constant.