Project
Skip to content

3D foundations · Intermediate · 4 min

3D Math: Coordinates, Vectors and Transformations

How every 3D program moves, turns and sizes objects: points, vectors, the dot and cross products, and the 4 × 4 matrices behind them — with worked numbers.

By the 3DA.XYZ editorsUpdated 2026-11-05Original renders & data

Points and vectors

A point is a position: (x, y, z). A vector is a direction with a length — the difference between two points. From A = (1, 2, 0) to B = (4, 6, 0) the vector is B − A = (3, 4, 0). Its length is √(3² + 4² + 0²) = 5. Dividing a vector by its length gives a unit vector (length 1), written n̂. Unit vectors describe pure direction: the way a face points, the way a light shines, the way a camera looks.

The dot product: how aligned are two directions?

For a = (a₁, a₂, a₃) and b = (b₁, b₂, b₃), the dot product is a·b = a₁b₁ + a₂b₂ + a₃b₃. For unit vectors it equals the cosine of the angle between them: 1 when they point the same way, 0 at right angles, −1 when opposite.

  • Lighting: brightness of a matte surface ∝ max(0, n̂ · l̂), where n̂ is the surface normal and l̂ points toward the light. That single line is Lambert shading.
  • Facing tests: if a face normal points away from the camera (n̂ · v̂ < 0), the face is a back face and can be skipped.
  • Overhangs: a slicer compares each face normal with straight down to decide where supports are needed.

The cross product: a direction perpendicular to both

a × b = (a₂b₃ − a₃b₂, a₃b₁ − a₁b₃, a₁b₂ − a₂b₁). The result is perpendicular to both inputs, and its length equals the area of the parallelogram they span. Order matters: b × a points the opposite way. For a triangle with corners A, B, C, the normal is (B − A) × (C − A), and half its length is the triangle’s area. This is exactly how the 3D Studio computes surface area, and why the corner order (the winding) decides which side is “outside”. More in Normals and winding.

Transformations

Moving, turning and resizing an object are transformations applied to every vertex.

TransformationWhat it doesFormula for a point (x, y, z)
Translation by (tx, ty, tz)Moves without turning(x + tx, y + ty, z + tz)
Uniform scale by sResizes about the origin(s·x, s·y, s·z)
Rotation by θ about ZTurns in the XY plane(x cos θ − y sin θ, x sin θ + y cos θ, z)
Mirror in XFlips left–right(−x, y, z) — also reverses winding

Rotating (1, 0, 0) by 90° about Z gives (cos 90° · 1, sin 90° · 1, 0) = (0, 1, 0): the X direction turns into the Y direction. The Studio’s Rotate 90° Z button does exactly that to every vertex.

Matrices and homogeneous coordinates

All of these can be written as a 4 × 4 matrix multiplying the point written as (x, y, z, 1). The extra 1 is what lets a matrix add a translation, not just scale and rotate. A rotation about Z becomes:

cos θ−sin θ00
sin θcos θ00
0010
0001

The power of matrices is that several transforms combine into one by multiplying them. A model with thousands of vertices is moved by one matrix, computed once.

Order matters. Rotating then translating is not the same as translating then rotating. Most software applies scale, then rotation, then translation (often written TRS, and multiplied right to left).

Coordinate spaces

A vertex passes through several spaces on its way to your screen:

  1. Object (local) space — coordinates as modeled, relative to the object’s own origin.
  2. World space — after the object’s transform places it in the scene.
  3. View (camera) space — re-expressed relative to the camera.
  4. Clip space — after the projection matrix applies perspective or orthographic projection.
  5. Screen space — pixel positions.

glTF scene nodes, 3MF build items and Blender object transforms are all matrices that take local space to world space. When the Studio opens a GLB, it multiplies each mesh by its node matrices and then converts glTF’s Y-up metres into Z-up millimetres.

Rotations without surprises: Euler angles and quaternions

Three angles (yaw, pitch, roll) are easy to read but can “gimbal lock”: at some orientations two axes line up and a degree of freedom disappears. Animation and game engines usually store rotations as quaternions — four numbers that interpolate smoothly and never lock — and convert to matrices for drawing.

Try itOpen the block, rotate it 90° about X, then about Z, and watch the size readout swap axes. Open the block →

Check your understanding

1. What does the dot product of two unit vectors equal?

2. Why do 3D programs use 4 × 4 matrices for 3D points?

3. Rotating (1, 0, 0) by 90° about Z gives…