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

3D vector More...

#include <line_ray.h>

Inheritance diagram for CL_Vec3< Type >:
Inheritance graph
[legend]

Public Types

typedef Type datatype
 

Public Member Functions

 CL_Vec3 ()
 
 CL_Vec3 (const CL_Vec2< Type > &copy)
 
 CL_Vec3 (const CL_Vec1< Type > &copy)
 
 CL_Vec3 (const CL_Vec4< Type > &copy)
 
 CL_Vec3 (const CL_Vec3< double > &copy)
 
 CL_Vec3 (const CL_Vec3< float > &copy)
 
 CL_Vec3 (const CL_Vec3< int > &copy)
 
 CL_Vec3 (const Type &p1, const Type &p2=0, const Type &p3=0)
 
 CL_Vec3 (const Type *array_xyz)
 
template<>
 CL_Vec3 (const CL_Vec3< float > &copy)
 
template<>
 CL_Vec3 (const CL_Vec3< double > &copy)
 
template<>
 CL_Vec3 (const CL_Vec3< int > &copy)
 
template<>
 CL_Vec3 (const CL_Vec3< float > &copy)
 
template<>
 CL_Vec3 (const CL_Vec3< double > &copy)
 
template<>
 CL_Vec3 (const CL_Vec3< int > &copy)
 
template<>
 CL_Vec3 (const CL_Vec3< float > &copy)
 
template<>
 CL_Vec3 (const CL_Vec3< double > &copy)
 
template<>
 CL_Vec3 (const CL_Vec3< int > &copy)
 
template<>
 CL_Vec3 (const CL_Vec3< float > &copy)
 
template<>
 CL_Vec3 (const CL_Vec3< double > &copy)
 
template<>
 CL_Vec3 (const CL_Vec3< int > &copy)
 
template<>
 CL_Vec3 (const CL_Vec3< float > &copy)
 
template<>
 CL_Vec3 (const CL_Vec3< double > &copy)
 
template<>
 CL_Vec3 (const CL_Vec3< int > &copy)
 
Attributes
Type length () const
 Returns the length (magnitude) of this vector. More...
 
CL_Vec3< Type > & normalize ()
 Normalizes this vector. More...
 
Type dot (const CL_Vec3< Type > &vector) const
 Dot products this vector with an other vector. More...
 
CL_Angle angle (const CL_Vec3< Type > &vector) const
 Calculate the angle between this vector and an other vector. More...
 
Type distance (const CL_Vec3< Type > &vector) const
 Calculate the distance between this vector and an other vector. More...
 
CL_Vec3< Type > & cross (const CL_Vec3< Type > &vector)
 Calculate the cross product between this vector and an other vector. More...
 
CL_Vec3< Type > & rotate (const CL_Angle &angle, const CL_Vec3< Type > &axis)
 Rotate this vector around an axis. Same as glRotate[f|d](angle, a);. More...
 
CL_Vec3< 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_Vec3< Type > &vector)
 += operator. More...
 
void operator+= (Type value)
 += operator. More...
 
CL_Vec3< Type > operator+ (const CL_Vec3< Type > &vector) const
 
  • operator.
More...
 
CL_Vec3< Type > operator+ (Type value) const
 
  • operator.
More...
 
void operator-= (const CL_Vec3< Type > &vector)
 -= operator. More...
 
void operator-= (Type value)
 -= operator. More...
 
CL_Vec3< Type > operator- (const CL_Vec3< Type > &vector) const
 
  • operator.
More...
 
CL_Vec3< Type > operator- (Type value) const
 
  • operator.
More...
 
void operator*= (const CL_Vec3< Type > &vector)
 *= operator. More...
 
void operator*= (Type value)
 *= operator. More...
 
CL_Vec3< Type > operator* (const CL_Vec3< Type > &vector) const
 
  • operator.
More...
 
CL_Vec3< Type > operator* (Type value) const
 
  • operator.
More...
 
void operator/= (const CL_Vec3< Type > &vector)
 /= operator. More...
 
void operator/= (Type value)
 /= operator. More...
 
CL_Vec3< Type > operator/ (const CL_Vec3< Type > &vector) const
 / operator. More...
 
CL_Vec3< Type > operator/ (Type value) const
 / operator. More...
 
CL_Vec3< Type > & operator= (const CL_Vec3< Type > &vector)
 = operator. More...
 
bool operator== (const CL_Vec3< Type > &vector) const
 == operator. More...
 
bool operator!= (const CL_Vec3< Type > &vector) const
 != operator. More...
 

Static Public Member Functions

static CL_Vec3< Type > cross (const CL_Vec3< Type > &vector1, const CL_Vec3< Type > &vector2)
 Calculate the cross product between two vectors. More...
 
static Type dot (const CL_Vec3< Type > &vector1, const CL_Vec3< Type > &vector2)
 Dot products between two vectors. More...
 
static CL_Vec3< Type > normalize (const CL_Vec3< Type > &vector)
 Normalizes a vector. More...
 
static CL_Vec3< Type > rotate (const CL_Vec3< Type > &vector, const CL_Angle &angle, const CL_Vec3< Type > &axis)
 Rotate a vector around an axis. Same as glRotate[f|d](angle, a);. More...
 
static CL_Vec3< Type > round (const CL_Vec3< 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
 
}; 
 

Detailed Description

template<typename Type>
class CL_Vec3< Type >

3D vector

These vector templates are defined for:
char (CL_Vec3c), unsigned char (CL_Vec3uc), short (CL_Vec3s),
unsigned short (CL_Vec3us), int (CL_Vec3i), unsigned int (CL_Vec3ui), float (CL_Vecdf), double (CL_Vec3d)

Member Typedef Documentation

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

Constructor & Destructor Documentation

template<typename Type>
CL_Vec3< Type >::CL_Vec3 ( )
inline
template<typename Type>
CL_Vec3< Type >::CL_Vec3 ( const CL_Vec2< Type > &  copy)
inline
template<typename Type>
CL_Vec3< Type >::CL_Vec3 ( const CL_Vec1< Type > &  copy)
inline
template<typename Type>
CL_Vec3< Type >::CL_Vec3 ( const CL_Vec4< Type > &  copy)
inline
template<typename Type>
CL_Vec3< Type >::CL_Vec3 ( const CL_Vec3< double > &  copy)
template<typename Type>
CL_Vec3< Type >::CL_Vec3 ( const CL_Vec3< float > &  copy)
template<typename Type>
CL_Vec3< Type >::CL_Vec3 ( const CL_Vec3< int > &  copy)
template<typename Type>
CL_Vec3< Type >::CL_Vec3 ( const Type &  p1,
const Type &  p2 = 0,
const Type &  p3 = 0 
)
inline
template<typename Type>
CL_Vec3< Type >::CL_Vec3 ( const Type *  array_xyz)
inline
template<>
CL_Vec3< unsigned char >::CL_Vec3 ( const CL_Vec3< float > &  copy)
inline
template<>
CL_Vec3< unsigned char >::CL_Vec3 ( const CL_Vec3< double > &  copy)
inline
template<>
CL_Vec3< unsigned char >::CL_Vec3 ( const CL_Vec3< int > &  copy)
inline
template<>
CL_Vec3< char >::CL_Vec3 ( const CL_Vec3< float > &  copy)
inline
template<>
CL_Vec3< char >::CL_Vec3 ( const CL_Vec3< double > &  copy)
inline
template<>
CL_Vec3< char >::CL_Vec3 ( const CL_Vec3< int > &  copy)
inline
template<>
CL_Vec3< unsigned short >::CL_Vec3 ( const CL_Vec3< float > &  copy)
inline
template<>
CL_Vec3< unsigned short >::CL_Vec3 ( const CL_Vec3< double > &  copy)
inline
template<>
CL_Vec3< unsigned short >::CL_Vec3 ( const CL_Vec3< int > &  copy)
inline
template<>
CL_Vec3< short >::CL_Vec3 ( const CL_Vec3< float > &  copy)
inline
template<>
CL_Vec3< short >::CL_Vec3 ( const CL_Vec3< double > &  copy)
inline
template<>
CL_Vec3< short >::CL_Vec3 ( const CL_Vec3< int > &  copy)
inline
template<>
CL_Vec3< unsigned int >::CL_Vec3 ( const CL_Vec3< float > &  copy)
inline
template<>
CL_Vec3< unsigned int >::CL_Vec3 ( const CL_Vec3< double > &  copy)
inline
template<>
CL_Vec3< unsigned int >::CL_Vec3 ( const CL_Vec3< int > &  copy)
inline

Member Function Documentation

template<typename Type>
CL_Angle CL_Vec3< Type >::angle ( const CL_Vec3< Type > &  vector) const

Calculate the angle between this vector and an other vector.

Parameters
vectorSecond vector used to calculate angle.
Returns
The angle between the two vectors.
template<typename Type>
static CL_Vec3<Type> CL_Vec3< Type >::cross ( const CL_Vec3< Type > &  vector1,
const CL_Vec3< Type > &  vector2 
)
static

Calculate the cross product between two vectors.

Parameters
vector1= The first vector
vector2= The second vector
Returns
The cross product
template<typename Type>
CL_Vec3<Type>& CL_Vec3< Type >::cross ( const CL_Vec3< Type > &  vector)

Calculate the cross product between this vector and an other vector.

Operates in the native datatype

Parameters
vector= Second vector used to perform the calculation.
Returns
reference to this object
template<typename Type>
Type CL_Vec3< Type >::distance ( const CL_Vec3< Type > &  vector) const

Calculate the distance between this vector and an other vector.

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

Dot products between two vectors.

Returns
The dot product
template<typename Type>
Type CL_Vec3< Type >::dot ( const CL_Vec3< Type > &  vector) const
inline

Dot products this vector with an other vector.

Operates in the native datatype

Parameters
vectorSecond vector used for the dot product.
Returns
The resulting dot product of the two vectors.
template<typename Type>
Type CL_Vec3< Type >::length ( ) const

Returns the length (magnitude) of this vector.

Operates in the native datatype

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

Normalizes a vector.

Parameters
vector= Vector to use

Operates in the native datatype

template<typename Type>
CL_Vec3<Type>& CL_Vec3< Type >::normalize ( )

Normalizes this vector.

Operates in the native datatype

Returns
reference to this object
template<typename Type>
CL_Vec3< Type >::operator Type * ( )
inline
template<typename Type>
CL_Vec3< Type >::operator Type *const ( ) const
inline
template<typename Type>
bool CL_Vec3< Type >::operator!= ( const CL_Vec3< Type > &  vector) const
inline

!= operator.

template<typename Type>
CL_Vec3<Type> CL_Vec3< Type >::operator* ( const CL_Vec3< Type > &  vector) const
inline

  • operator.

template<typename Type>
CL_Vec3<Type> CL_Vec3< Type >::operator* ( Type  value) const
inline

  • operator.

template<typename Type>
void CL_Vec3< Type >::operator*= ( const CL_Vec3< Type > &  vector)
inline

*= operator.

template<typename Type>
void CL_Vec3< Type >::operator*= ( Type  value)
inline

*= operator.

template<typename Type>
CL_Vec3<Type> CL_Vec3< Type >::operator+ ( const CL_Vec3< Type > &  vector) const
inline

  • operator.

template<typename Type>
CL_Vec3<Type> CL_Vec3< Type >::operator+ ( Type  value) const
inline

  • operator.

template<typename Type>
void CL_Vec3< Type >::operator+= ( const CL_Vec3< Type > &  vector)
inline

+= operator.

template<typename Type>
void CL_Vec3< Type >::operator+= ( Type  value)
inline

+= operator.

template<typename Type>
CL_Vec3<Type> CL_Vec3< Type >::operator- ( const CL_Vec3< Type > &  vector) const
inline

  • operator.

template<typename Type>
CL_Vec3<Type> CL_Vec3< Type >::operator- ( Type  value) const
inline

  • operator.

template<typename Type>
void CL_Vec3< Type >::operator-= ( const CL_Vec3< Type > &  vector)
inline

-= operator.

template<typename Type>
void CL_Vec3< Type >::operator-= ( Type  value)
inline

-= operator.

template<typename Type>
CL_Vec3<Type> CL_Vec3< Type >::operator/ ( const CL_Vec3< Type > &  vector) const
inline

/ operator.

template<typename Type>
CL_Vec3<Type> CL_Vec3< Type >::operator/ ( Type  value) const
inline

/ operator.

template<typename Type>
void CL_Vec3< Type >::operator/= ( const CL_Vec3< Type > &  vector)
inline

/= operator.

template<typename Type>
void CL_Vec3< Type >::operator/= ( Type  value)
inline

/= operator.

template<typename Type>
CL_Vec3<Type>& CL_Vec3< Type >::operator= ( const CL_Vec3< Type > &  vector)
inline

= operator.

template<typename Type>
bool CL_Vec3< Type >::operator== ( const CL_Vec3< Type > &  vector) const
inline

== operator.

template<typename Type>
const Type& CL_Vec3< Type >::operator[] ( unsigned int  i) const
inline
template<typename Type>
Type& CL_Vec3< Type >::operator[] ( unsigned int  i)
inline
template<typename Type>
static CL_Vec3<Type> CL_Vec3< Type >::rotate ( const CL_Vec3< Type > &  vector,
const CL_Angle angle,
const CL_Vec3< Type > &  axis 
)
static

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

Parameters
vector= Vector to use
angle= Angle to rotate.
axis= Rotation axis.
Returns
The rotated vector
template<typename Type>
CL_Vec3<Type>& CL_Vec3< Type >::rotate ( const CL_Angle angle,
const CL_Vec3< Type > &  axis 
)

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

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

Rounds all components on a vector.

Uses Asymmetric Arithmetic Rounding

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

Rounds all components on this vector.

Uses Asymmetric Arithmetic Rounding

Returns
reference to this object

Member Data Documentation

union { ... }
union { ... }
union { ... }
template<typename Type>
Type CL_Vec3< Type >::b
template<typename Type>
Type CL_Vec3< Type >::g
template<typename Type>
Type CL_Vec3< Type >::r
template<typename Type>
Type CL_Vec3< Type >::s
template<typename Type>
Type CL_Vec3< Type >::t
template<typename Type>
Type CL_Vec3< Type >::u
template<typename Type>
Type CL_Vec3< Type >::x
template<typename Type>
Type CL_Vec3< Type >::y
template<typename Type>
Type CL_Vec3< Type >::z

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