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

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

Public Attributes

Components of the vector
x
 
y
 
z
 

Friends

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