ClanLib  2.3.7
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
CL_Vec4< Type > Class Template Reference

4D vector More...

#include <size.h>

Public Types

typedef Type datatype
 

Public Member Functions

 CL_Vec4 ()
 
 CL_Vec4 (const CL_Vec1< Type > &copy)
 
 CL_Vec4 (const CL_Vec2< Type > &copy)
 
 CL_Vec4 (const CL_Vec3< Type > &copy)
 
 CL_Vec4 (const Type &p1, const Type &p2=0, const Type &p3=0, const Type &p4=0)
 
 CL_Vec4 (const Type *array_xyzw)
 
Attributes
*Type length3 () const
 Returns the length (magnitude) of this vector (not taking into account the w ordinate). More...
 
*Type length4 () const
 Returns the length (magnitude) of this vector (taking into account the w ordinate). More...
 
CL_Vec4< Type > & normalize3 ()
 Normalizes this vector (not taking into account the w ordinate) More...
 
CL_Vec4< Type > & normalize4 ()
 Normalizes this vector (taking into account the w ordinate) More...
 
Type dot3 (const CL_Vec4< Type > &vector) const
 Dot products this vector with an other vector (not taking into account the w ordinate). More...
 
Type dot4 (const CL_Vec4< Type > &vector) const
 Dot products this vector with an other vector (taking into account the w ordinate). More...
 
CL_Angle angle3 (const CL_Vec4< Type > &vector) const
 Calculate the angle between this vector and an other vector (not taking into account the w ordinate). More...
 
Type distance3 (const CL_Vec4< Type > &vector) const
 Calculate the distance between this vector and an other vector (not taking into account the w ordinate). More...
 
Type distance4 (const CL_Vec4< Type > &vector) const
 Calculate the distance between this vector and an other vector (taking into account the w ordinate). More...
 
CL_Vec4< Type > & cross3 (const CL_Vec4< Type > &vector)
 Calculate the cross product between this vector and an other vector (not taking into account the w ordinate). More...
 
CL_Vec4< Type > & rotate3 (const CL_Angle &angle, const CL_Vec4< Type > &axis)
 Rotate this vector around an axis. Same as glRotate[f|d](angle, a);. More...
 
CL_Vec4< Type > & round ()
 Rounds all components on this vector. More...
 
Operators
const Type & operator[] (unsigned int i) const
 
Type & operator[] (unsigned int i)
 
 operator Type * ()
 
 operator Type *const () const
 
void operator+= (const CL_Vec4< Type > &vector)
 += operator. More...
 
void operator+= (Type value)
 += operator. More...
 
CL_Vec4< Type > operator+ (const CL_Vec4< Type > &vector) const
 
  • operator.
More...
 
CL_Vec4< Type > operator+ (Type value) const
 
  • operator.
More...
 
void operator-= (const CL_Vec4< Type > &vector)
 -= operator. More...
 
void operator-= (Type value)
 -= operator. More...
 
CL_Vec4< Type > operator- (const CL_Vec4< Type > &vector) const
 
  • operator.
More...
 
CL_Vec4< Type > operator- (Type value) const
 
  • operator.
More...
 
void operator*= (const CL_Vec4< Type > &vector)
 *= operator. More...
 
void operator*= (Type value)
 *= operator. More...
 
CL_Vec4< Type > operator* (const CL_Vec4< Type > &vector) const
 
  • operator.
More...
 
CL_Vec4< Type > operator* (Type value) const
 
  • operator.
More...
 
void operator/= (const CL_Vec4< Type > &vector)
 /= operator. More...
 
void operator/= (Type value)
 /= operator. More...
 
CL_Vec4< Type > operator/ (const CL_Vec4< Type > &vector) const
 / operator. More...
 
CL_Vec4< Type > operator/ (Type value) const
 / operator. More...
 
CL_Vec4< Type > & operator= (const CL_Vec4< Type > &vector)
 = operator. More...
 
bool operator== (const CL_Vec4< Type > &vector) const
 == operator. More...
 
bool operator!= (const CL_Vec4< Type > &vector) const
 != operator. More...
 

Static Public Member Functions

static CL_Vec4< Type > cross3 (const CL_Vec4< Type > &vector1, const CL_Vec4< Type > &vector2)
 Calculate the cross product between two vectors (not taking into account the w ordinate). More...
 
static Type dot3 (const CL_Vec4< Type > &vector1, const CL_Vec4< Type > &vector2)
 Dot products between two vectors (not taking into account the w ordinate). More...
 
static Type dot4 (const CL_Vec4< Type > &vector1, const CL_Vec4< Type > &vector2)
 Dot products between two vectors (taking into account the w ordinate). More...
 
static CL_Vec4< Type > normalize3 (const CL_Vec4< Type > &vector)
 Normalizes a vector (not taking into account the w ordinate) More...
 
static CL_Vec4< Type > normalize4 (const CL_Vec4< Type > &vector)
 Normalizes a vector (taking into account the w ordinate) More...
 
static CL_Vec4< Type > rotate3 (const CL_Vec4< Type > &vector, const CL_Angle &angle, const CL_Vec4< Type > &axis)
 Rotate a vector around an axis. Same as glRotate[f|d](angle, a);. More...
 
static CL_Vec4< Type > round (const CL_Vec4< Type > &vector)
 Rounds all components on a vector. More...
 

Public Attributes

union {
   Type   r
 
   Type   s
 
   Type   x
 
}; 
 
union {
   Type   g
 
   Type   t
 
   Type   y
 
}; 
 
union {
   Type   b
 
   Type   u
 
   Type   z
 
}; 
 
union {
   Type   a
 
   Type   v
 
   Type   w
 
}; 
 

Detailed Description

template<typename Type>
class CL_Vec4< Type >

4D vector

These vector templates are defined for:
char (CL_Vec4c), unsigned char (CL_Vec4uc), short (CL_Vec4s),
unsigned short (CL_Vec4us), int (CL_Vec4i), unsigned int (CL_Vec4ui), float (CL_Vec4f), double (CL_Vec4d)

Member Typedef Documentation

template<typename Type>
typedef Type CL_Vec4< Type >::datatype

Constructor & Destructor Documentation

template<typename Type>
CL_Vec4< Type >::CL_Vec4 ( )
inline
template<typename Type>
CL_Vec4< Type >::CL_Vec4 ( const CL_Vec1< Type > &  copy)
inline
template<typename Type>
CL_Vec4< Type >::CL_Vec4 ( const CL_Vec2< Type > &  copy)
inline
template<typename Type>
CL_Vec4< Type >::CL_Vec4 ( const CL_Vec3< Type > &  copy)
inline
template<typename Type>
CL_Vec4< Type >::CL_Vec4 ( const Type &  p1,
const Type &  p2 = 0,
const Type &  p3 = 0,
const Type &  p4 = 0 
)
inline
template<typename Type>
CL_Vec4< Type >::CL_Vec4 ( const Type *  array_xyzw)
inline

Member Function Documentation

template<typename Type>
CL_Angle CL_Vec4< Type >::angle3 ( const CL_Vec4< Type > &  vector) const

Calculate the angle between this vector and an other vector (not taking into account the w ordinate).

Parameters
vector= Second vector used to calculate angle.
Returns
The angle between the two vectors.
template<typename Type>
static CL_Vec4<Type> CL_Vec4< Type >::cross3 ( const CL_Vec4< Type > &  vector1,
const CL_Vec4< Type > &  vector2 
)
static

Calculate the cross product between two vectors (not taking into account the w ordinate).

= The first vector = The second vector

Returns
= Cross product
template<typename Type>
CL_Vec4<Type>& CL_Vec4< Type >::cross3 ( const CL_Vec4< Type > &  vector)

Calculate the cross product between this vector and an other vector (not taking into account the w ordinate).

Operates in the native datatype

Parameters
vectorSecond vector used to perform the calculation.
Returns
reference to this object
template<typename Type>
Type CL_Vec4< Type >::distance3 ( const CL_Vec4< Type > &  vector) const

Calculate the distance between this vector and an other vector (not taking into account the w ordinate).

Parameters
vector= Second vector used to calculate distance.
Returns
The distance between the two vectors.
template<typename Type>
Type CL_Vec4< Type >::distance4 ( const CL_Vec4< Type > &  vector) const

Calculate the distance between this vector and an other vector (taking into account the w ordinate).

Parameters
vector= Second vector used to calculate distance.
Returns
The distance between the two vectors.
template<typename Type>
static Type CL_Vec4< Type >::dot3 ( const CL_Vec4< Type > &  vector1,
const CL_Vec4< Type > &  vector2 
)
inlinestatic

Dot products between two vectors (not taking into account the w ordinate).

Operates in the native datatype

Parameters
vector1First vector used for the dot product.
vector2Second vector used for the dot product.
Returns
The resulting dot product of the two vectors.

References CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.

template<typename Type>
Type CL_Vec4< Type >::dot3 ( const CL_Vec4< Type > &  vector) const
inline

Dot products this vector with an other vector (not taking into account the w ordinate).

Operates in the native datatype

Parameters
vectorSecond vector used for the dot product.
Returns
The resulting dot product of the two vectors.

References CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.

template<typename Type>
static Type CL_Vec4< Type >::dot4 ( const CL_Vec4< Type > &  vector1,
const CL_Vec4< Type > &  vector2 
)
inlinestatic

Dot products between two vectors (taking into account the w ordinate).

Operates in the native datatype

Parameters
vector1First vector used for the dot product.
vector2Second vector used for the dot product.
Returns
The resulting dot product of the two vectors.

References CL_Vec4< Type >::w, CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.

template<typename Type>
Type CL_Vec4< Type >::dot4 ( const CL_Vec4< Type > &  vector) const
inline

Dot products this vector with an other vector (taking into account the w ordinate).

Operates in the native datatype

Parameters
vectorSecond vector used for the dot product.
Returns
The resulting dot product of the two vectors.

References CL_Vec4< Type >::w, CL_Vec4< Type >::x, CL_Vec4< Type >::y, and CL_Vec4< Type >::z.

template<typename Type>
* Type CL_Vec4< Type >::length3 ( ) const

Returns the length (magnitude) of this vector (not taking into account the w ordinate).

Operates in the native datatype

Returns
the length of the vector
template<typename Type>
* Type CL_Vec4< Type >::length4 ( ) const

Returns the length (magnitude) of this vector (taking into account the w ordinate).

Operates in the native datatype

Returns
the length of the vector
template<typename Type>
static CL_Vec4<Type> CL_Vec4< Type >::normalize3 ( const CL_Vec4< Type > &  vector)
static

Normalizes a vector (not taking into account the w ordinate)

Operates in the native datatype

Parameters
vector= The vector to use
Returns
the normalized vector
template<typename Type>
CL_Vec4<Type>& CL_Vec4< Type >::normalize3 ( )

Normalizes this vector (not taking into account the w ordinate)

Operates in the native datatype

Returns
reference to this object
template<typename Type>
static CL_Vec4<Type> CL_Vec4< Type >::normalize4 ( const CL_Vec4< Type > &  vector)
static

Normalizes a vector (taking into account the w ordinate)

Operates in the native datatype

Parameters
vector= The vector to use
Returns
the normalized vector
template<typename Type>
CL_Vec4<Type>& CL_Vec4< Type >::normalize4 ( )

Normalizes this vector (taking into account the w ordinate)

Operates in the native datatype

Returns
reference to this object
template<typename Type>
CL_Vec4< Type >::operator Type * ( )
inline
template<typename Type>
CL_Vec4< Type >::operator Type *const ( ) const
inline
template<typename Type>
bool CL_Vec4< Type >::operator!= ( const CL_Vec4< Type > &  vector) const
inline
template<typename Type>
CL_Vec4<Type> CL_Vec4< Type >::operator* ( const CL_Vec4< Type > &  vector) const
inline
template<typename Type>
CL_Vec4<Type> CL_Vec4< Type >::operator* ( Type  value) const
inline
template<typename Type>
void CL_Vec4< Type >::operator*= ( const CL_Vec4< Type > &  vector)
inline
template<typename Type>
void CL_Vec4< Type >::operator*= ( Type  value)
inline
template<typename Type>
CL_Vec4<Type> CL_Vec4< Type >::operator+ ( const CL_Vec4< Type > &  vector) const
inline
template<typename Type>
CL_Vec4<Type> CL_Vec4< Type >::operator+ ( Type  value) const
inline
template<typename Type>
void CL_Vec4< Type >::operator+= ( const CL_Vec4< Type > &  vector)
inline
template<typename Type>
void CL_Vec4< Type >::operator+= ( Type  value)
inline
template<typename Type>
CL_Vec4<Type> CL_Vec4< Type >::operator- ( const CL_Vec4< Type > &  vector) const
inline
template<typename Type>
CL_Vec4<Type> CL_Vec4< Type >::operator- ( Type  value) const
inline
template<typename Type>
void CL_Vec4< Type >::operator-= ( const CL_Vec4< Type > &  vector)
inline
template<typename Type>
void CL_Vec4< Type >::operator-= ( Type  value)
inline
template<typename Type>
CL_Vec4<Type> CL_Vec4< Type >::operator/ ( const CL_Vec4< Type > &  vector) const
inline
template<typename Type>
CL_Vec4<Type> CL_Vec4< Type >::operator/ ( Type  value) const
inline
template<typename Type>
void CL_Vec4< Type >::operator/= ( const CL_Vec4< Type > &  vector)
inline
template<typename Type>
void CL_Vec4< Type >::operator/= ( Type  value)
inline
template<typename Type>
CL_Vec4<Type>& CL_Vec4< Type >::operator= ( const CL_Vec4< Type > &  vector)
inline
template<typename Type>
bool CL_Vec4< Type >::operator== ( const CL_Vec4< Type > &  vector) const
inline
template<typename Type>
const Type& CL_Vec4< Type >::operator[] ( unsigned int  i) const
inline
template<typename Type>
Type& CL_Vec4< Type >::operator[] ( unsigned int  i)
inline
template<typename Type>
static CL_Vec4<Type> CL_Vec4< Type >::rotate3 ( const CL_Vec4< Type > &  vector,
const CL_Angle angle,
const CL_Vec4< Type > &  axis 
)
static

Rotate a vector around an axis. Same as glRotate[f|d](angle, a);.

Not taking into account the w ordinate
The w ordinate is not modified

Parameters
vector= The vector to use
angleAngle to rotate
axisRotation axis.
Returns
The rotated vector
template<typename Type>
CL_Vec4<Type>& CL_Vec4< Type >::rotate3 ( const CL_Angle angle,
const CL_Vec4< Type > &  axis 
)

Rotate this vector around an axis. Same as glRotate[f|d](angle, a);.

Not taking into account the w ordinate
The w ordinate is not modified

Parameters
angleAngle to rotate
axisRotation axis.
Returns
reference to this object
template<typename Type>
static CL_Vec4<Type> CL_Vec4< Type >::round ( const CL_Vec4< Type > &  vector)
static

Rounds all components on a vector.

Includes the w ordinate
Uses Asymmetric Arithmetic Rounding

Parameters
vector= The vector to use
Returns
The rounded vector
template<typename Type>
CL_Vec4<Type>& CL_Vec4< Type >::round ( )

Rounds all components on this vector.

Includes the w ordinate
Uses Asymmetric Arithmetic Rounding

Returns
reference to this object

Member Data Documentation

union { ... }
union { ... }
union { ... }
union { ... }
template<typename Type>
Type CL_Vec4< Type >::a
template<typename Type>
Type CL_Vec4< Type >::b
template<typename Type>
Type CL_Vec4< Type >::g
template<typename Type>
Type CL_Vec4< Type >::r
template<typename Type>
Type CL_Vec4< Type >::s
template<typename Type>
Type CL_Vec4< Type >::t
template<typename Type>
Type CL_Vec4< Type >::u
template<typename Type>
Type CL_Vec4< Type >::v
template<typename Type>
Type CL_Vec4< Type >::w
template<typename Type>
Type CL_Vec4< Type >::x
template<typename Type>
Type CL_Vec4< Type >::y
template<typename Type>
Type CL_Vec4< Type >::z

The documentation for this class was generated from the following files: