-
Notifications
You must be signed in to change notification settings - Fork 2
vmath is set of C++ classes for Vector and Matrix algebra used in computer graphics
License
drhelius/vmath
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Intro vmath is set of C++ classes for Vector and Matrix algebra used in computer graphics. The library consits of these classes: Vector2 - two dimensional vector for 2D vertices and texture coordinates Vector3 - three dimensional vector for 3D vertices, normals and texture coordinates and also for color Vector4 - four dimensional vector for 3D vertices, normals, texture coordinates and color with alpha channell. Matrix3 - matrix 3x3 for rotation (used in ODE) Matrix4 - matrix 4x4 for general geometrix transformations Quaternion - quaternion re 3x im, for rotation Note that this library is set of C++ class that has all(!) method inlined. (for performance reasons) Features basic aritemetic operations - using operators basic linear algebra operations - such as transpose, dot product, etc. aliasis 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 convertable T1, T2 type pairs. In other words, you can do this: Vector3f f3; Vector3d d3 = f3; ... f3 = d3; Status Classes Vector2<T>, Vector3<T>, Vector4<T> are supposed to be stable. I have been using these libraries for two or three years. Classes Matrix3<T>, Matrix4<T> were tested for barely all operations and seems to be everything OK. Class Quaternion<T> was tested for barely all operations and seems to be good. Tricks You can pass vector or matrix class directly as argument appropriate OpenGL function, Vector2f t; Vector3f n,v; Matrix4f transform; glMultiMatrixf(transform); glTexCoord2fv(t); glNormal3fv(n); glVertex3fv(v);
About
vmath is set of C++ classes for Vector and Matrix algebra used in computer graphics
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published