Vector mathematics for computer graphics
Features
-
basic arithmetic operations - using operators
-
basic linear algebra operations - such as transpose, dot product, etc.
-
aliases for vertex coordinates - it means:
Vector3f v;
// use vertex coordinates
v.x = 1; v.y = 2; v.z = -1;
// use texture coordinates
v.s = 0; v.t = 1; v.u = 0.5;
// use color coordinates
v.r = 1; v.g = 0.5; v.b = 0;
-
conversion constructor and assign operators - so you can assign a value of Vector3<T1> type to a variable of Vector3<T2> type for any convertible T1, T2 type pairs. In other words, you can do this:
Vector3f f3; Vector3d d3 = f3;
...
f3 = d3;
types
-
Vector2 Two dimensional vector
-
float — Vector2f
-
double — Vector2d
-
int — Vector2i
-
Vector3 Three dimensional vector
-
float — Vector3f
-
double — Vector3d
-
int — Vector3i
-
Vector4 Four dimensional vector
-
float — Vector4f
-
double — Vector4d
-
int — Vector4i
-
Matrix3 Matrix 3x3
-
float — Matrix3f
-
double — Matrix3d
-
int — Matrix3i
-
Matrix4 Matrix 4x4
-
float — Matrix4f
-
double — Matrix4d
-
int — Matrix4i
-
Quaternion
-
float — Quatf
-
double — Quatd
-
Aabb3 axes-aligned bounding-box
-
float — Aabb3f
-
double — Aabb3d