42        template<
typename Type>
 
   45        template<
typename Type>
 
   48        template<
typename Type>
 
   51        template<
typename Type>
 
   54        template<
typename Type>
 
   57        template<
typename Type>
 
   60        template<
typename Type>
 
   63        template<
typename Type>
 
   73        template<
typename Type>
 
   79                union { Type 
x; Type 
s; Type 
r; };
 
   80                union { Type 
y; Type 
t; Type 
g; };
 
   81                union { Type 
z; Type 
u; Type 
b; };
 
   84                explicit Vec3(
const Type &scalar) : 
x(scalar), 
y(scalar), 
z(scalar) { }
 
   92                explicit Vec3(
const Type &p1, 
const Type &p2, 
const Type &p3) : 
x(p1), 
y(p2), 
z(p3) { }
 
   93                explicit Vec3(
const Type *array_xyz) : 
x(array_xyz[0]), 
y(array_xyz[1]), 
z(array_xyz[2]) { }
 
  105                static Type 
dot(
const Vec3<Type>& vector1, 
const Vec3<Type>& vector2) { 
return vector1.x*vector2.x + vector1.y*vector2.y + vector1.z*vector2.z; }
 
  141                        Type diff_x = second.x - first.x; Type diff_y = second.y - first.y; Type diff_z = second.z - first.z;
 
  142                        return (diff_x >= -epsilon && diff_x <= epsilon && diff_y >= -epsilon && diff_y <= epsilon && diff_z >= -epsilon && diff_z <= epsilon);
 
 
  249                bool operator < (
const Vec3<Type>& vector)
 const { 
return z < vector.z || (
z == vector.z && (
y < vector.y || (
y == vector.y && 
x < vector.x))); }
 
  253        template<
typename Type>
 
  257        template<
typename Type>
 
  261        template<
typename Type>
 
  265        template<
typename Type>
 
  269        template<
typename Type>
 
  273        template<
typename Type>
 
  277        template<
typename Type>
 
  281        template<
typename Type>
 
  285        template<
typename Type>
 
  289        template<
typename Type>
 
  293        template<
typename Type>
 
  297        template<
typename Type>
 
  302        template<
typename Type>
 
  306                        matrix[0 * 3 + 0] * 
v.x + matrix[0 * 3 + 1] * 
v.y + matrix[0 * 3 + 2] * 
v.z,
 
  307                        matrix[1 * 3 + 0] * 
v.x + matrix[1 * 3 + 1] * 
v.y + matrix[1 * 3 + 2] * 
v.z,
 
  308                        matrix[2 * 3 + 0] * 
v.x + matrix[2 * 3 + 1] * 
v.y + matrix[2 * 3 + 2] * 
v.z);
 
 
  313        template<
typename Type>
 
  317                        matrix[0 * 3 + 0] * 
v.x + matrix[1 * 3 + 0] * 
v.y + matrix[2 * 3 + 0] * 
v.z,
 
  318                        matrix[0 * 3 + 1] * 
v.x + matrix[1 * 3 + 1] * 
v.y + matrix[2 * 3 + 1] * 
v.z,
 
  319                        matrix[0 * 3 + 2] * 
v.x + matrix[1 * 3 + 2] * 
v.y + matrix[2 * 3 + 2] * 
v.z);
 
 
  394        template<
typename Type>
 
  403        template<
typename Type>
 
 
  406        template<
typename Type>
 
 
 
Angle class.
Definition angle.h:60
3D matrix
Definition vec4.h:55
2D vector
Definition vec4.h:43
Type y
Definition vec2.h:81
Type x
Definition vec2.h:80
3D vector
Definition vec4.h:46
bool operator!=(const Vec3< Type > &vector) const
!= operator.
Definition vec3.h:246
bool is_equal(const Vec3< Type > &other, Type epsilon) const
Returns true if equal within the bounds of an epsilon.
Definition vec3.h:210
static bool is_equal(const Vec3< Type > &first, const Vec3< Type > &second, Type epsilon)
Returns true if equal within the bounds of an epsilon.
Definition vec3.h:139
Vec3< Type > operator-() const
operator.
Definition vec3.h:225
static Vec3< Type > cross(const Vec3< Type > &vector1, const Vec3< Type > &vector2)
Calculate the cross product between two vectors.
Vec3(const Type *array_xyz)
Definition vec3.h:93
Type s
Definition vec3.h:79
Vec3()
Definition vec3.h:83
Type r
Definition vec3.h:79
static Type dot(const Vec3< Type > &vector1, const Vec3< Type > &vector2)
Dot products between two vectors.
Definition vec3.h:105
Vec3< Type > & operator=(const Vec3< Type > &vector)
= operator.
Definition vec3.h:240
Vec3< Type > & rotate(const Angle &angle, const Vec3< Type > &axis)
Rotate this vector around an axis. Same as glRotate[f|d](angle, a);.
static Vec3< Type > reflect(const Vec3< Type > &incident, const Vec3< Type > &normal)
Calculate the reflection direction for an incident vector.
Vec3(const Vec3< int > ©)
Vec3(const Vec3< double > ©)
static Vec3< Type > round(const Vec3< Type > &vector)
Rounds all components on a vector.
Vec3< Type > & round()
Rounds all components on this vector.
Vec3(const Type &p1, const Type &p2, const Type &p3)
Definition vec3.h:92
Vec3(const Type &scalar)
Definition vec3.h:84
Type z
Definition vec3.h:81
Type y
Definition vec3.h:80
Type g
Definition vec3.h:80
Type t
Definition vec3.h:80
bool operator<(const Vec3< Type > &vector) const
< operator.
Definition vec3.h:249
Angle angle_normed(const Vec3< Type > &vector) const
Calculate the angle between this vector and an other vector, where the vectors are unit vectors.
void operator-=(const Vec3< Type > &vector)
-= operator.
Definition vec3.h:219
void operator+=(const Vec3< Type > &vector)
+= operator.
Definition vec3.h:213
void operator/=(const Vec3< Type > &vector)
/= operator.
Definition vec3.h:234
Vec3< Type > & cross(const Vec3< Type > &vector)
Calculate the cross product between this vector and an other vector.
Vec3(const Vec4< Type > ©)
Definition vec3.h:86
Vec3(const Vec2< Type > ©, const Type &p3)
Definition vec3.h:85
Type u
Definition vec3.h:81
Type distance(const Vec3< Type > &vector) const
Calculate the distance between this vector and an other vector.
Type x
Definition vec3.h:79
Type b
Definition vec3.h:81
Type datatype
Definition vec3.h:77
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);.
bool operator==(const Vec3< Type > &vector) const
== operator.
Definition vec3.h:243
Angle angle(const Vec3< Type > &vector) const
Calculate the angle between this vector and an other vector.
Type dot(const Vec3< Type > &vector) const
Dot products this vector with an other vector.
Definition vec3.h:163
void operator*=(const Vec3< Type > &vector)
*= operator.
Definition vec3.h:228
Vec3(const Vec3< float > ©)
4D vector
Definition vec4.h:75
Type z
Definition vec4.h:81
Type y
Definition vec4.h:80
Type x
Definition vec4.h:79
Vec2< Type > operator/(const Vec2< Type > &v1, const Vec2< Type > &v2)
/ operator.
Definition vec2.h:302
static Vec3< Type > normalize(const Vec3< Type > &vector)
Normalizes a vector.
Definition vec3.h:407
Vec3< unsigned char > Vec3ub
Definition vec3.h:409
Type length() const
Returns the length (magnitude) of this vector.
Definition vec3.h:395
Vec3< Type > & normalize()
Normalizes this vector.
Definition vec3.h:404
Vec3< unsigned short > Vec3us
Definition vec3.h:411
Vec3< unsigned int > Vec3ui
Definition vec3.h:413
Vec3< float > Vec3f
Definition vec3.h:415
Vec2< Type > operator-(const Vec2< Type > &v1, const Vec2< Type > &v2)
operator.
Definition vec2.h:278
Vec2< Type > operator+(const Vec2< Type > &v1, const Vec2< Type > &v2)
operator.
Definition vec2.h:266
Vec3< double > Vec3d
Definition vec3.h:416
Vec3< char > Vec3b
Definition vec3.h:410
Vec2< Type > operator*(const Vec2< Type > &v1, const Vec2< Type > &v2)
operator.
Definition vec2.h:290
Vec3< short > Vec3s
Definition vec3.h:412
Vec3< int > Vec3i
Definition vec3.h:414
@ length
value is a keyword