Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
clan::Vec3< Type > Class Template Reference
clanCore Math

3D vector More...

`#include <line_ray.h>`

## Public Types
typedef Type | datatype

## Public Member Functions
| Vec3 ()
| Vec3 (const Type &scalar)
| Vec3 (const Vec2< Type > &copy, const Type &p3)
| Vec3 (const Vec4< Type > &copy)
| Vec3 (const Vec3< double > &copy)
| Vec3 (const Vec3< float > &copy)
| Vec3 (const Vec3< int > &copy)
| Vec3 (const Type &p1, const Type &p2, const Type &p3)
| Vec3 (const Type *array_xyz)
template<>
| Vec3 (const Vec3< float > &copy)
template<>
| Vec3 (const Vec3< double > &copy)
template<>
| Vec3 (const Vec3< int > &copy)
template<>
| Vec3 (const Vec3< float > &copy)
template<>
| Vec3 (const Vec3< double > &copy)
template<>
| Vec3 (const Vec3< int > &copy)
template<>
| Vec3 (const Vec3< float > &copy)
template<>
| Vec3 (const Vec3< double > &copy)
template<>
| Vec3 (const Vec3< int > &copy)
template<>
| Vec3 (const Vec3< float > &copy)
template<>
| Vec3 (const Vec3< double > &copy)
template<>
| Vec3 (const Vec3< int > &copy)
template<>
| Vec3 (const Vec3< float > &copy)
template<>
| Vec3 (const Vec3< double > &copy)
template<>
| Vec3 (const Vec3< int > &copy)
template<>
| Vec3 (const Vec3< float > &copy)
template<>
| Vec3 (const Vec3< double > &copy)
template<>
| Vec3 (const Vec3< int > &copy)
template<>
| Vec3 (const Vec3< float > &copy)
template<>
| Vec3 (const Vec3< double > &copy)
template<>
| Vec3 (const Vec3< int > &copy)
template<>
| Vec3 (const Vec3< float > &copy)
template<>
| Vec3 (const Vec3< double > &copy)
template<>
| Vec3 (const Vec3< int > &copy)
template<>
double | length () const
template<>
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

template<>

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

References clan::Vec3< Type >::x, clan::x, clan::Vec3< Type >::y, clan::y, clan::Vec3< Type >::z, and clan::z.

template<>

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

References clan::Vec3< Type >::x, clan::x, clan::Vec3< Type >::y, clan::y, clan::Vec3< Type >::z, and clan::z.

template<>

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

References clan::Vec3< Type >::x, clan::x, clan::Vec3< Type >::y, clan::y, clan::Vec3< Type >::z, and clan::z.

template<>

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

References clan::Vec3< Type >::x, clan::x, clan::Vec3< Type >::y, clan::y, clan::Vec3< Type >::z, and clan::z.

template<>

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

References clan::Vec3< Type >::x, clan::x, clan::Vec3< Type >::y, clan::y, clan::Vec3< Type >::z, and clan::z.

template<>

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

References clan::Vec3< Type >::x, clan::x, clan::Vec3< Type >::y, clan::y, clan::Vec3< Type >::z, and clan::z.

template<>

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

References clan::Vec3< Type >::x, clan::x, clan::Vec3< Type >::y, clan::y, clan::Vec3< Type >::z, and clan::z.

template<>

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

References clan::Vec3< Type >::x, clan::x, clan::Vec3< Type >::y, clan::y, clan::Vec3< Type >::z, and clan::z.

template<>

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

References clan::Vec3< Type >::x, clan::x, clan::Vec3< Type >::y, clan::y, clan::Vec3< Type >::z, and clan::z.

template<>

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

References clan::Vec3< Type >::x, clan::x, clan::Vec3< Type >::y, clan::y, clan::Vec3< Type >::z, and clan::z.

template<>

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

References clan::Vec3< Type >::x, clan::x, clan::Vec3< Type >::y, clan::y, clan::Vec3< Type >::z, and clan::z.

template<>

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

References clan::Vec3< Type >::x, clan::x, clan::Vec3< Type >::y, clan::y, clan::Vec3< Type >::z, and clan::z.

template<>

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

References clan::Vec3< Type >::x, clan::x, clan::Vec3< Type >::y, clan::y, clan::Vec3< Type >::z, and clan::z.

template<>

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

References clan::Vec3< Type >::x, clan::x, clan::Vec3< Type >::y, clan::y, clan::Vec3< Type >::z, and clan::z.

template<>

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

References clan::Vec3< Type >::x, clan::x, clan::Vec3< Type >::y, clan::y, clan::Vec3< Type >::z, and clan::z.

template<>

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

References clan::Vec3< Type >::x, clan::x, clan::Vec3< Type >::y, clan::y, clan::Vec3< Type >::z, and clan::z.

template<>

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

References clan::Vec3< Type >::x, clan::x, clan::Vec3< Type >::y, clan::y, clan::Vec3< Type >::z, and clan::z.

template<>

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

References clan::Vec3< Type >::x, clan::x, clan::Vec3< Type >::y, clan::y, clan::Vec3< Type >::z, and clan::z.

template<>

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

References clan::Vec3< Type >::x, clan::x, clan::Vec3< Type >::y, clan::y, clan::Vec3< Type >::z, and clan::z.

template<>

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

References clan::Vec3< Type >::x, clan::x, clan::Vec3< Type >::y, clan::y, clan::Vec3< Type >::z, and clan::z.

template<>

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

References clan::Vec3< Type >::x, clan::x, clan::Vec3< Type >::y, clan::y, clan::Vec3< Type >::z, and clan::z.

template<>

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

References clan::Vec3< Type >::x, clan::x, clan::Vec3< Type >::y, clan::y, clan::Vec3< Type >::z, and clan::z.

template<>

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

References clan::Vec3< Type >::x, clan::x, clan::Vec3< Type >::y, clan::y, clan::Vec3< Type >::z, and clan::z.

template<>

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

References clan::Vec3< Type >::x, clan::x, clan::Vec3< Type >::y, clan::y, clan::Vec3< Type >::z, and clan::z.

## Member Function Documentation

template<>

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

References clan::x, clan::y, and clan::z.

template<>

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

References clan::x, clan::y, and clan::z.

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

- line_ray.h
- vec3.h