3D Matrix Transformation Calculator – Rotation & Scaling in Space (Theory)
A 3D linear transformation maps a vector \(\mathbf{x}=(x,y,z)\) to a new vector \(\mathbf{x}'\)
using a \(3\times 3\) matrix:
\[
\mathbf{x}' = A\mathbf{x},\quad
A=\begin{bmatrix}
a_{11}&a_{12}&a_{13}\\
a_{21}&a_{22}&a_{23}\\
a_{31}&a_{32}&a_{33}
\end{bmatrix}.
\]
Linear transformations include rotations, scalings, and reflections.
Affine transformations: adding translation
Many real applications (graphics, CAD, robotics) also include translation:
\[
\mathbf{x}' = A\mathbf{x} + \mathbf{t},\quad
\mathbf{t}=\begin{bmatrix}t_x\\t_y\\t_z\end{bmatrix}.
\]
This is an affine transformation (linear + shift).
Transforming “about a point” (center \(\mathbf{c}\))
A matrix naturally acts about the origin. To rotate or scale a shape about a center \(\mathbf{c}\),
shift the geometry so \(\mathbf{c}\) is at the origin, apply the matrix, then shift back:
\[
\mathbf{x}' = A(\mathbf{x}-\mathbf{c}) + \mathbf{c} + \mathbf{t}.
\]
The calculator lets you choose \(\mathbf{c}=(0,0,0)\), the centroid of your input points, or a custom center.
Common 3D rotation matrices
Rotations about coordinate axes (right-hand rule):
Determinant: volume scale and orientation
The determinant of a \(3\times 3\) matrix controls two key geometric properties:
- Volume scaling: any 3D volume is multiplied by \(|\det(A)|\).
- Orientation: if \(\det(A)<0\), orientation flips (typical of reflections).
If \(\det(A)=0\), the transformation is not invertible and collapses 3D space into a lower dimension.
Built-in wireframe cube / rectangular prism generator
For quick visualization (like a CAD viewport), the calculator can generate a wireframe cube or
rectangular prism. The prism has 8 vertices and 12 edges. If the center is
\((x_0,y_0,z_0)\) and the dimensions are \(w,h,d\), then the corners are located at:
\[
x=x_0\pm\frac{w}{2},\quad y=y_0\pm\frac{h}{2},\quad z=z_0\pm\frac{d}{2}.
\]
Choose “Transform about → Centroid” to rotate/scale around the prism’s center.
Worked example: rotate (1,0,0) by 90° around the z-axis
With \(\theta=90^\circ\),
\[
R_z(90^\circ)=
\begin{bmatrix}
0&-1&0\\
1&0&0\\
0&0&1
\end{bmatrix},
\quad
\mathbf{x}=
\begin{bmatrix}1\\0\\0\end{bmatrix}.
\]
Then
\[
\mathbf{x}'=R_z(90^\circ)\mathbf{x}=
\begin{bmatrix}0\\1\\0\end{bmatrix}.
\]
The calculator’s Fill example uses this exact input.
Practical tip (CAD / graphics intuition)
Rotations and scalings are easiest to understand by visualization. Use the interactive 3D view:
rotate the camera, pan to center the object, and animate the transformation (slider or Play).