Loading...
Compose multiple 3D transformation matrices in the correct order using NumPy.
3D transformations are represented as 4×4 homogeneous matrices. Composing transformations requires multiplying matrices in reverse order of application.
If we want to apply T1 first, then T2: Result = T2 @ T1
Common 3D transformations:
This is crucial for camera positioning, object manipulation, and scene graph traversal in 3D CV.
transforms = [ [[1,0,0,5],[0,1,0,0],[0,0,1,0],[0,0,0,1]], # Translate X by 5 [[2,0,0,0],[0,2,0,0],[0,0,2,0],[0,0,0,1]] # Scale by 2 ]
[[2,0,0,10],[0,2,0,0],[0,0,2,0],[0,0,0,1]]
First translate by (5,0,0), then scale by 2.
Composed: Scale @ Translate (reverse order)
Point [0,0,0] → translate → [5,0,0] → scale → [10,0,0]
The translation component also gets scaled!