Geometric transformations in 3D space are fundamental concepts in computer graphics, robotics, and various scientific fields. These transformations allow us to manipulate objects in 3D space, change their position, orientation, size, or shape while preserving certain properties. Understanding coordinate frames is essential for applying these transformations correctly across different reference systems.
Before diving into transformations, it's crucial to understand the 3D coordinate systems that serve as a foundation for these operations:
The most common 3D coordinate system is the Cartesian coordinate system, which uses three perpendicular axes (x, y, and z) that intersect at a common origin point. In the right-handed coordinate system, if you align your right hand's thumb, index finger, and middle finger along the positive directions of the x, y, and z axes, respectively, they will naturally point in orthogonal directions.
Simple 3D Cartesian coordinate system visualization
In addition to Cartesian coordinates, 3D space can also be described using cylindrical coordinates (, , z) and spherical coordinates (r, , ). These alternative coordinate systems are particularly useful for certain problems or applications where symmetry aligns with these coordinate representations.
Geometric transformations in 3D can be classified into several fundamental types, each with distinct mathematical representations and effects:
Translation moves every point of an object by the same distance in a given direction. In 3D, a translation is defined by a vector (tx, ty, tz) that specifies the displacement along each axis:
Translation in 3D space
Mathematically, if point p = (x, y, z) is translated by vector t = (tx, ty, tz), the new point p' is:
p' = (x + tx, y + ty, z + tz)
Rotation turns an object around a specific axis by a certain angle. In 3D, rotation can occur around the x, y, or z axes, or around an arbitrary axis. The rotation matrix for a rotation of angle around the z-axis is:
[cos() -sin() 0][sin() cos() 0][0 0 1]
Similar matrices exist for rotations around the x and y axes. Rotations preserve distances between points and the orientation of the object's shape, making them rigid transformations.
For example, rotating a point (1, 0, 0) by 90 around the z-axis would place it at (0, 1, 0) in the coordinate system.
Scaling changes the size of an object by multiplying each coordinate by a scaling factor. Uniform scaling uses the same factor (s) for all dimensions:
p' = (sx, sy, sz)
Non-uniform scaling uses different factors for each dimension, potentially changing the object's proportions. Scaling transformations can be represented with a diagonal matrix where the diagonal elements are the scaling factors.
Reflection creates a mirror image of an object across a plane, line, or point. In 3D, reflecting across the xy-plane would invert the z-coordinate:
p' = (x, y, -z)
Shear transformations shift each point in a direction proportional to its distance from a line or plane parallel to that direction. Unlike translations and rotations, shear changes the shape of an object while preserving its volume.
Complex transformations can be created by composing basic transformations through matrix multiplication. The order of transformations matters, as matrix multiplication is not commutative. For example, rotating an object and then translating it will generally produce a different result than translating it and then rotating it.
When using 44 homogeneous transformation matrices, all basic transformations (translation, rotation, scaling) can be represented uniformly and combined through matrix multiplication:
[Tcombined] = [Tn] [Tn-1] ... [T2] [T1]
Where each Ti represents one of the basic transformations, and the transformations are applied from right to left.
A coordinate frame (or reference frame) defines a coordinate system relative to which positions and orientations of objects are described. Multiple coordinate frames are often needed in 3D applications:
To describe the position of an object in different coordinate frames, we use frame transformations. The transformation from the local frame of an object to the world frame consists of a rotation followed by a translation:
pworld = R plocal + t
Where R is the rotation matrix that aligns the local axes with the world axes, and t is the translation vector from the world origin to the local frame's origin.
This transformation can be inverted to convert coordinates from world frame to local frame:
plocal = RT (pworld - t)
Where RT is the transpose of the rotation matrix R (which is also its inverse for rotation matrices).
In many applications, objects are organized in hierarchies, where child objects inherit transformations from their parents. This hierarchical structure is commonly represented using trees or graphs of coordinate frames. The transformation of a child object relative to the world frame is the product of all transformations from the root to that child:
Tchildworld = Tparent(n)world ... Tparent(1)world Tchildparent(1)
In computer graphics, 3D transformations are essential for:
Robotic systems rely heavily on geometric transformations to:
Medical imagers use transformations to:
While rotation matrices are effective for representing rotations, quaternions offer several advantages for 3D rotations:
A quaternion q = w + xi + yj + zk can represent a rotation of angle around a normalized axis (x, y, z) as:
q = (cos(/2), xsin(/2), ysin(/2), zsin(/2))
Geometric transformations in 3D space and the concept of coordinate frames form the backbone of many technological systems we use daily. From video games to surgical robots, understanding how to describe and manipulate objects in 3D space is essential. While the mathematics behind these concepts can be complex, the fundamental principles of translation, rotation, scaling, and coordinate transformations provide a powerful framework for solving spatial problems across numerous disciplines. As computational power increases and applications demand more sophisticated spatial reasoning, the importance of these foundational concepts continues to grow.
