Affine spatial transformation matrices are used to represent the orientation and position of a coordinate system within a 3 dimensional "world" coordinate system. Spatial transformation matrices can be used to map from one to another. They are often used in Kinematics.
Any combination of translation, rotation, scaling, reflection and shear can be represented by a single 4 by 4 affine transformation matrix:
A = |
|
This matrix A can be used to transform any point / vector p to a new point / vector p'.
DCM (Direction Cosine Matrix): The upper left 3x3 area is the rotation / orientation / scale / shear sub-section. It is made of 3 sections:
Position: The upper right area translates position.
The 4th row is always [0, 0, 0, 1] to maintain transformation matrix format.
To apply the transformation, simply enter the desired values for the type of transformation (see below) and apply matrix math multiplication to the original point as a vector of x, y, z, and 1.
p' = Ap
Multiple translations can be applied sequentially, or can be merged into a single matrix operation by multiplying all the transformation matrixes together. Remember that unlike normal math, in matrix multiplication the order matters, and as applied here, this maintains the order of transformations.
A = |
|
Where x, y, and z are the desired translation in each direction.
A = |
|
Where Sx, Sy, and Sz are the desired scaling factor in each dimension. Note that if you want to scale in all three axis by the same amount, you can just change the lower right "1" to factor and leave Sx, Sy, Sz as 1.
Where theta O is the desired rotation in radians around the given axis. These can be combined, by multiplying all three matrix together, and separate the "thetas" to three different variables:
A = |
|
A = |
|
A = |
|
Note that these are "right handed" rotations. Positive angles of
O cause counter-clockwise rotation about an axis
as seen from a point on the positive side of the axis looking in toward the
origin.
These three transformations (in X, Y, and Z) can, theoretically, be applied in sequence to reach any orientation. This uses a set of three angles, which are referred to as Euler Angles.
Note that if you apply a rotation of 1/4 of a full turn around, for example, the X axis, then you have effectively aligned the other two axis, Y and Z, with each other. If you then apply any rotation around, for example, the Z axis, that would be exactly the same as rotation around the Y axes. This removes a degree of freedom from any further transformations, and is called "gimbal lock" which is one type of singularity. It is a limitation of Euler Angles.
To avoid this limitation, a better system for rotations in multiple axis can be developed by using Quaternions. These are 4 dimensional values where the extra dimensions are akin to complex numbers. Where a complex number has one real and one imaginary part, a quaternion has a vector component and 4 imaginary parts, called i, j, and k.
qw + i qx + j qy + k qz.
A quaternion holds the angles in the real and imaginary parts. Because they are all combined, any rotation around a combination of axis can be described. Quaternions can be converted into 3x3 rotational matrixes.
See also:
1 - 2*qy2 - 2*qz2 | 2*qx*qy - 2*qz*qw | 2*qx*qz + 2*qy*qw |
2*qx*qy + 2*qz*qw | 1 - 2*qx2 - 2*qz2 | 2*qy*qz - 2*qx*qw |
2*qx*qz - 2*qy*qw | 2*qy*qz + 2*qx*qw | 1 - 2*qx2 - 2*qy2 |
file: /Techref/method/math/spatial-transformations.htm, 15KB, , updated: 2023/11/8 19:17, local time: 2024/11/25 06:43,
3.15.239.145:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://techref.massmind.org/Techref/method/math/spatial-transformations.htm"> Spatial Transformation Matrix Math Methods</A> |
Did you find what you needed? |
Welcome to massmind.org! |
Welcome to techref.massmind.org! |
.