3D vector More...

#include <line_ray.h>

Public Types

typedef Type datatype
 

Public Member Functions

 Vec3 ()
 
 Vec3 (const Type &p1, const Type &p2, const Type &p3)
 
 Vec3 (const Type &scalar)
 
 Vec3 (const Type *array_xyz)
 
 Vec3 (const Vec2< Type > &copy, const Type &p3)
 
 Vec3 (const Vec3< double > &copy)
 
 Vec3 (const Vec3< double > &copy)
 
 Vec3 (const Vec3< double > &copy)
 
 Vec3 (const Vec3< double > &copy)
 
 Vec3 (const Vec3< double > &copy)
 
 Vec3 (const Vec3< double > &copy)
 
 Vec3 (const Vec3< double > &copy)
 
 Vec3 (const Vec3< double > &copy)
 
 Vec3 (const Vec3< double > &copy)
 
 Vec3 (const Vec3< float > &copy)
 
 Vec3 (const Vec3< float > &copy)
 
 Vec3 (const Vec3< float > &copy)
 
 Vec3 (const Vec3< float > &copy)
 
 Vec3 (const Vec3< float > &copy)
 
 Vec3 (const Vec3< float > &copy)
 
 Vec3 (const Vec3< float > &copy)
 
 Vec3 (const Vec3< float > &copy)
 
 Vec3 (const Vec3< float > &copy)
 
 Vec3 (const Vec3< int > &copy)
 
 Vec3 (const Vec3< int > &copy)
 
 Vec3 (const Vec3< int > &copy)
 
 Vec3 (const Vec3< int > &copy)
 
 Vec3 (const Vec3< int > &copy)
 
 Vec3 (const Vec3< int > &copy)
 
 Vec3 (const Vec3< int > &copy)
 
 Vec3 (const Vec3< int > &copy)
 
 Vec3 (const Vec3< int > &copy)
 
 Vec3 (const Vec4< Type > &copy)
 
double length () const
 
float length () const
 
Attributes
Type length () const
 Returns the length (magnitude) of this vector. More...
 
Vec3< Type > & normalize ()
 Normalizes this vector. More...
 
Type dot (const Vec3< Type > &vector) const
 Dot products this vector with an other vector. More...
 
Angle angle (const Vec3< Type > &vector) const
 Calculate the angle between this vector and an other vector. More...
 
Angle angle_normed (const Vec3< Type > &vector) const
 Calculate the angle between this vector and an other vector, where the vectors are unit vectors. More...
 
Type distance (const Vec3< Type > &vector) const
 Calculate the distance between this vector and an other vector. More...
 
Vec3< Type > & cross (const Vec3< Type > &vector)
 Calculate the cross product between this vector and an other vector. More...
 
Vec3< Type > & rotate (const Angle &angle, const Vec3< Type > &axis)
 Rotate this vector around an axis. Same as glRotate[f|d](angle, a);. More...
 
Vec3< Type > & round ()
 Rounds all components on this vector. More...
 
bool is_equal (const Vec3< Type > &other, Type epsilon) const
 Returns true if equal within the bounds of an epsilon. More...
 
Operators
void operator+= (const Vec3< Type > &vector)
 += operator. More...
 
void operator+= (Type value)
 += operator. More...
 
void operator-= (const Vec3< Type > &vector)
 -= operator. More...
 
void operator-= (Type value)
 -= operator. More...
 
Vec3< Type > operator- () const
 
  • operator.
More...
 
void operator*= (const Vec3< Type > &vector)
 *= operator. More...
 
void operator*= (Type value)
 *= operator. More...
 
void operator/= (const Vec3< Type > &vector)
 /= operator. More...
 
void operator/= (Type value)
 /= operator. More...
 
Vec3< Type > & operator= (const Vec3< Type > &vector)
 = operator. More...
 
bool operator== (const Vec3< Type > &vector) const
 == operator. More...
 
bool operator!= (const Vec3< Type > &vector) const
 != operator. More...
 
bool operator< (const Vec3< Type > &vector) const
 < operator. More...
 

Static Public Member Functions

static Vec3< Type > cross (const Vec3< Type > &vector1, const Vec3< Type > &vector2)
 Calculate the cross product between two vectors. More...
 
static Type dot (const Vec3< Type > &vector1, const Vec3< Type > &vector2)
 Dot products between two vectors. More...
 
static bool is_equal (const Vec3< Type > &first, const Vec3< Type > &second, Type epsilon)
 Returns true if equal within the bounds of an epsilon. More...
 
static Vec3< Type > normalize (const Vec3< Type > &vector)
 Normalizes a vector. More...
 
static Vec3< Type > reflect (const Vec3< Type > &incident, const Vec3< Type > &normal)
 Calculate the reflection direction for an incident vector. More...
 
static Vec3< Type > rotate (const Vec3< Type > &vector, const Angle &angle, const Vec3< Type > &axis)
 Rotate a vector around an axis. Same as glRotate[f|d](angle, a);. More...
 
static Vec3< Type > round (const Vec3< Type > &vector)
 Rounds all components on a vector. More...
 

Public Attributes

union {
   Type   clan::Vec3< Type >::r
 
   Type   clan::Vec3< Type >::s
 
   Type   clan::Vec3< Type >::x
 
}; 
 
union {
   Type   clan::Vec3< Type >::g
 
   Type   clan::Vec3< Type >::t
 
   Type   clan::Vec3< Type >::y
 
}; 
 
union {
   Type   clan::Vec3< Type >::b
 
   Type   clan::Vec3< Type >::u
 
   Type   clan::Vec3< Type >::z
 
}; 
 

Detailed Description

template<typename Type>
class clan::Vec3< Type >

3D vector

These vector templates are defined for:
char (Vec3c), unsigned char (Vec3uc), short (Vec3s),
unsigned short (Vec3us), int (Vec3i), unsigned int (Vec3ui), float (Vecdf), double (Vec3d)

Constructor & Destructor Documentation

◆ Vec3() [1/24]

clan::Vec3< unsigned char >::Vec3 ( const Vec3< float > &  copy)
inline

◆ Vec3() [2/24]

clan::Vec3< unsigned char >::Vec3 ( const Vec3< double > &  copy)
inline

◆ Vec3() [3/24]

clan::Vec3< unsigned char >::Vec3 ( const Vec3< int > &  copy)
inline

◆ Vec3() [4/24]

clan::Vec3< char >::Vec3 ( const Vec3< float > &  copy)
inline

◆ Vec3() [5/24]

clan::Vec3< char >::Vec3 ( const Vec3< double > &  copy)
inline

◆ Vec3() [6/24]

clan::Vec3< char >::Vec3 ( const Vec3< int > &  copy)
inline

◆ Vec3() [7/24]

clan::Vec3< unsigned short >::Vec3 ( const Vec3< float > &  copy)
inline

◆ Vec3() [8/24]

clan::Vec3< unsigned short >::Vec3 ( const Vec3< double > &  copy)
inline

◆ Vec3() [9/24]

clan::Vec3< unsigned short >::Vec3 ( const Vec3< int > &  copy)
inline

◆ Vec3() [10/24]

clan::Vec3< short >::Vec3 ( const Vec3< float > &  copy)
inline

◆ Vec3() [11/24]

clan::Vec3< short >::Vec3 ( const Vec3< double > &  copy)
inline

◆ Vec3() [12/24]

clan::Vec3< short >::Vec3 ( const Vec3< int > &  copy)
inline

◆ Vec3() [13/24]

clan::Vec3< int >::Vec3 ( const Vec3< float > &  copy)
inline

◆ Vec3() [14/24]

clan::Vec3< int >::Vec3 ( const Vec3< double > &  copy)
inline

◆ Vec3() [15/24]

clan::Vec3< int >::Vec3 ( const Vec3< int > &  copy)
inline

◆ Vec3() [16/24]

clan::Vec3< unsigned int >::Vec3 ( const Vec3< float > &  copy)
inline

◆ Vec3() [17/24]

clan::Vec3< unsigned int >::Vec3 ( const Vec3< double > &  copy)
inline

◆ Vec3() [18/24]

clan::Vec3< unsigned int >::Vec3 ( const Vec3< int > &  copy)
inline

◆ Vec3() [19/24]

clan::Vec3< float >::Vec3 ( const Vec3< float > &  copy)
inline

◆ Vec3() [20/24]

clan::Vec3< float >::Vec3 ( const Vec3< double > &  copy)
inline

◆ Vec3() [21/24]

clan::Vec3< float >::Vec3 ( const Vec3< int > &  copy)
inline

◆ Vec3() [22/24]

clan::Vec3< double >::Vec3 ( const Vec3< float > &  copy)
inline

◆ Vec3() [23/24]

clan::Vec3< double >::Vec3 ( const Vec3< double > &  copy)
inline

◆ Vec3() [24/24]

clan::Vec3< double >::Vec3 ( const Vec3< int > &  copy)
inline

Member Function Documentation

◆ length() [1/2]

double clan::Vec3< double >::length ( ) const
inline

◆ length() [2/2]

float clan::Vec3< float >::length ( ) const
inline

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