<ColorRGBA|User's Guide|Vector>

Matrix

Definition

A Matrix is typically used as a linear transformation to map vectors to vectors. That is: Y = MX where X is a Vector and M is a Matrix applying any or all transformations (scale, rotate, translate).

There are a few special matrices:

zero matrix is the Matrix with all zero entries.

000
000
000

The Identity Matrix is the matrix with 1 on the diagonal entries and 0 for all other entries.

100
010
001

A Matrix is invertible if there is a matrix M-1 where MM-1 = M-1 = I.

The transpose of a matrix M = [mij] is MT = [mji]. This causes the rows of M to become the columns of MT.

111 123
222123
333 123

A Matrix is symmetric if M = MT.

XAB
AXC
BCX

Where X, A, B, and C equal numbers

jME includes two types of Matrix classes: Matrix3f and Matrix4f. Matrix3f is a 3×3 matrix and is the most commonly used (able to handle scaling and rotating), while Matrix4f is a 4×4 matrix that can also handle translation.

Transformations

Multiplying a Vector with a Matrix allows the Vector to be transformed. Either rotating, scaling or translating that Vector.

Scaling

If a diagonal Matrix, defined by D = [dij] and dij = 0 for i != j, has all positive entries it is a scaling matrix. If di is greater than 1 then the resulting Vector will grow, while if di is less than 1 it will shrink.

Rotation

A rotation matrix requires that the transpose and inverse are the same matrix (R-1 = RT). The rotation matrix R can then be calculated as: R = I + (sin(angle)) S + (1 - cos(angle)S2 where S is:

0u2-u1
-u20u0
u1-u00

Translation

Translation requires a 4×4 matrix, where the Vector (x,y,z) is mapped to (x,y,z,1) for multiplication. The Translation Matrix is then defined as:

MT
ST1

where M is the 3×3 matrix (containing any rotation/scale information), T is the translation Vector and ST is the transpose Vector of T. 1 is just a constant.

jME Class

Both Matrix3f and Matrix4f store their values as floats and are publicly available as (m00, m01, m02, …, mNN) where N is either 2 or 3.

Most methods are straight forward, and I will leave documentation to the Javadoc.

<ColorRGBA|User's Guide|Vector>


/var/www/wiki/data/pages/matrix.txt · Last modified: 2009/11/23 06:26 by isole  
Recent changes · Show pagesource · Login

Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki

subscribe to jME latest jme headlines


site design by bleedcrimson designs © 2008