DevTools Logo

3D Affine Transform Visualizer

3D Affine Transform Visualizer

Compose 4×4 transforms, inspect matrices, and preview a transformed cube in your browser

Transform order

The list is multiplied from top to bottom. Move operations to see order effects.

1. Translate
2. Rotate Y
3. Rotate Z
4. Scale

Combined matrix & wireframe

1.192	-0.310	0.338	1.000
0.479	0.940	0.000	0.000
-0.556	0.145	0.725	0.000
0.000	0.000	0.000	1.000

Determinant: 1.1200

Transformed vertex 1: (-0.22, …)

About

This visualizer composes ordered 4x4 affine matrices — translation, rotation about X/Y/Z, uniform or per-axis scale, and shear — then applies the combined matrix to the corners of a unit cube so you can see exactly what the transform does. It shows the composed matrix, its determinant, and its inverse (via Gauss-Jordan), plus Euler-rotation matrices in the standard Z*Y*X row-major convention. Everything runs locally: matrix multiplication, inversion, and rendering are pure client-side math with no network requests. Use it to reason about transform order (rotating then translating differs from translating then rotating), verify normals or coordinate conversions, or generate matrices to paste into WebGL, Three.js, or shader code.

Examples

Order changes the result

Input
applyMatrix(composeTransforms([{ translate [2,0,0] }, { rotateZ [90] }]), {1,0,0}) vs reversed
Output
x ~2 versus x ~0

Rotate-then-translate moves a different point than translate-then-rotate — order is load-bearing.

Inverse restores identity

Input
multiplyMatrices(inverseMatrix(M), M) for translate/rotateY/scale chain
Output
the 4x4 identity

A well-formed affine chain times its inverse collapses back to identity within tolerance.

About this tool

Matrix Affine Transform 3D composes 4x4 column-vector matrices with composeTransforms([{ kind, values }]) over translate, rotateX/rotateY/rotateZ (degrees), scale, and skew kinds, backed by translationMatrix, scaleMatrix, rotationX/Y/ZMatrix, skewMatrix, and multiplyMatrices. Points transform with applyMatrix(matrix, vector), which defaults a Vector3 to w = 1 with perspective division.

Analysis helpers include determinant (Gaussian elimination, 0 for singular), inverseMatrix (Gauss-Jordan, throws on singular), identityMatrix, cloneMatrix, eulerRotationMatrix (Z * Y * X order), formatMatrix, plus cubeVertices and transformCube for previews.

Composition order is literal: [translate, rotateZ] multiplies T * R, so the rotation applies to the point first — swapping entries produces a different matrix, and everything is deterministic client-side math.

How to use this tool

  1. List transforms in order

    Pass translate/rotate/scale/skew entries — the first entry is the outermost matrix factor.

  2. Apply to points

    Call applyMatrix with { x, y, z } (w defaults to 1) or an explicit Vector4.

  3. Invert when needed

    Use inverseMatrix for view or undo matrices; catch the singular error on degenerate scales.

  4. Sanity-check with determinant

    Confirm scale(2, 3, 4) reads 24 and identity reads 1 before shipping the chain.

Use cases

Building model matrices

Chain scale, rotate, and translate into one matrix for object placement.

Unprojecting points

Invert the composed matrix to map world points back into local space.

Previewing on cubes

Run transformCube to see all eight corners move before touching real geometry.

Common mistakes

Mistake:Reading the transform list as apply-first order.

Fix:[translate, rotate] means T * R, so rotation hits the point first — reverse the array if you want translation applied first.

Mistake:Inverting a matrix with a zero scale axis.

Fix:Any zero scale (e.g. scale(2, 0, 3)) is singular with determinant 0 — give every axis a nonzero size or guard the throw.

Mistake:Passing degrees as radians (or skew values raw).

Fix:Rotations and skews take degrees and convert internally — 90 means a quarter turn, not 90 radians.

Frequently asked questions

What does this tool do?

It composes 4x4 affine matrices with composeTransforms over translate, rotateX/Y/Z (degrees), scale, and skew, applies them with applyMatrix (Vector3 defaults to w = 1), and analyzes them with determinant, inverseMatrix, eulerRotationMatrix, formatMatrix, and transformCube previews.

Does transform order matter?

Yes — [translate, rotateZ] multiplies T * R so rotation applies first, giving a different matrix and point than [rotateZ, translate]. Swap entries deliberately and compare.

Is my geometry uploaded or stored?

No. Composition, inversion, and point transforms are pure client-side math.

Why did inverseMatrix throw?

The matrix is singular (determinant 0) — typically a zero scale axis like scale(2, 0, 3). Restore a nonzero size on every axis or branch around degenerate chains.

References & standards