User Tools

This is an old revision of the document!

Matrix Transform

The previous transforms are actually simplified versions of matrix mathematics. For example, translate is just applying additition using a matrix.

Learn about matrix mathematics at

var m = new CSG.Matrix4x4();
m = m.multiply(CSG.Matrix4x4.rotationX(40));
m = m.multiply(CSG.Matrix4x4.rotationZ(40));
m = m.multiply(CSG.Matrix4x4.translation([-.5, 0, 0]));
m = m.multiply(CSG.Matrix4x4.scaling([1.1, 1.2, 1.3]));
// and apply the transform:
var cube3 = cube().transform(m);