How do matrices relate to coordinate systems
In the next chapter , 3D rotation representations will discussed in further detail, but for now let us describe some of their properties. Another interpretation of rotation matrices is to interpret each of the 3 columns as the coordinates of each of the coordinate axes after rotation.
When performing two linear transformations one after another, the results are determined via matrix multiplication. Expanding this into matrix products,. Using composition we can derive other useful transformations, like scaling not aligned to an axis.
Note that due to the non-symmetricity of matrix multiplication, order of transformation matters: a rotation followed by a scaling is not necessarily the same as a scaling followed by a rotation. However, with a little inspection, we can derive the following symmetric compositions:. Note that symmetry does not generally hold in 3D! In 2D, the orientation and area of any triangle does not change, and in 3D, the orientation and volume of any tetrahedron does not change.
Which can be thought of applying a rotation about the origin first , and then a translation second. Proving that all rigid transforms have this form will be left as an exercise. It is also possible to interpret rigid transforms as rotation about an arbitrary point. Repeated application of rigid transformations also produce a rigid transformation.
Given two rigid transforms. Not all transformations have inverses, but rotations, translations, rigid transformations, and many linear transformations do. As described before, the inverse of a rotation matrix is simply its transpose. Translations are inverted by translating in the negative direction. Proof of this equation will be left as an exercise. Rigid transformations are used to represent movement of rigid bodies in space.
Coordinate frames, as well as conversions between them, are interpreted as rigid transformations. Changes of coordinate frames can also be represented in terms of rigid transforms. First, we calculate its world coordinates:. Homogeneous coordinates gives a convenient representation of rigid transforms as linear transforms on an expanded space. Moreover, it compactly represents the distinction between positional and directional quantities. The idea is to augment every point with an additional homogeneous coordinate , which is 1 if it is positional and 0 if it is directional.
Note that when applied to homogeneous positions, the rigid transform is applied to the first two coordinates of the vector while the homogeneous coordinate remains 1 since the dot product of a position representation with the last row of the matrix is 1. Also, when applied to homogenous directions, only the rotation is applied to the first two coordinates of the vector, since the third 0 coordinate nullifies the effect of the third column.
The homoeneous coordinate remains 0, since the dot product of a position representation with the last row of the matrix is 0.
The nice thing about this representation is that transform application is a matrix-vector multiply, transform composition is a matrix-matrix multiply, and transform inversion is a matrix inversion. This makes it much easier to write out complex transformations. In small 2D examples we can often treat coordinates casually, with our minds quickly filling in the gaps of meaning.
However, once we introduce rotations, or move to 3D and beyond, this type of casual thinking runs the risk of making the robot walk through a wall! It is unlikely that your linear algebra software package e. Nor will they tell you how to properly convert between reference coordinate systems.
This section will once again discuss the importance of separating the coordinate representation of an object from its physical meaning.
It will also describe some common pitfalls when working with coordinates, and tools to help reduce the risk of making calculation errors. Hence there are many physical quantities that have not changed, even through the positions themselves have.
Let us also suppose that just before moving the paper, we have erased the arrow, and now we need to draw it again. An important fact is that these equations hold regardless of the choice of world frame. Next, let us illustrate how the coordinates of directional quantities transform.
The main distinction between positions and directions is that the choice of origin does not affect how directions are represented. However, both are affected by the choice of coordinate axes. Hence, when performing changes of coordinates, the interpretation of position quantities changes in a different manner from that of directional quantities.
Positions and directional quantities also transform into each other when various operations are performed on them. When two positions are differenced, a displacement is produced. When a displacement is added to a position, another position is obtained. Displacements can be added to other displacements, or multiplied a scalar. However, it is meaningless to multiply a position by a scalar, or to add two position together, even though these are valid vector operations on their representations.
In cases where these latter two operations would seem to make sense, it is more appropriate to talk about displacements with respect to some other position. Directions transform in much the same way that displacements do, but they do not scale or add. In summary, the following mathematical operations on coordinates correspond to meaningful physical operations. The output of these operations the right hand sides of the equations may transform the type of object being represented.
Here, P indicates a position, D indicates a displacement, V indicates a direction, and c is a scalar. Here, it is assumed that all items share the same coordinate frame. Operations on items not sharing the same coordinate frame are not meaningful, nor are the following types of operations:. When working with different coordinate representations, it is easy to make mistakes in calculations.
Below are some common pitfalls. Operating on the wrong units e. An orthogonal matrix is a square matrix with real entries whose columns and rows are orthogonal unit vectors. We have mentioned previously that each row from the matrix represents an axis of a Cartesian coordinate system. If the matrix is a rotation matrix or the result of several rotation matrices multiplied with each other, then each row necessarily represents an axis of unit length because the elements of the rows are constructed from the sine and cosine trigonometric functions which are used to compute the coordinates of points lying on the unit circle.
You can see them as a Cartesian coordinate system which is originally aligned with the world coordinate system the identity matrix's rows represent the axes of the world coordinate system and rotated around one particular axis or a random axis.
Orthogonal matrices have a few interesting properties but maybe the most useful one in Computer Graphics, is that the transpose of an orthogonal matrix is equal to its inverse. Assuming Q is an orthogonal matrix, we can write:. You will sometimes find the terms affine transformations used in place of matrix transformation. This technical term is actually more accurate to designate the transformations that you get from using the type of matrices we have described so far.
In short, an affine transformation, is a transformation that preserves straight lines. The translation, rotation, shearing matrix are all affine transformations as are their combinations. The other type of transformation we will be studying in Computer Graphics are called projective transformations perspective projection is a projective transformation.
As you may have guessed, such transformations do not necessarily preserve parallelism between lines check the lessons on the perspective and orthographic projection matrix in the Foundation of 3D Rendering section.
Figure 6: as the point rotates, its coordinates in regard to the world coordinate system red and green axes change. But they stay the same in regards the coordinate system defined by the rotation matrix.
Why is this the case? And why specifically a local coordinate system? What does it even mean local coordinate system in this context? Are there any other type of matrices, apart from the rotation matrices, which can be thought as coordinate systems?
If yes, which ones, and why? Matrices usually represent a transformation linear or not, maybe also affine in computer graphics , but it's new to me to think about matrices as coordinate systems.
If you have a 3x3 matrix representing some transformation, you will actually have the X,Y,Z vectors of that transformation in the rows or columns depending on if it's a row major or column major matrix. The second column is the Y axis vector, and the third column is the Z axis vector. You can even see that this is true in an identity matrix, where the X,Y and Z vectors are just what you'd expect them to be:.
If you have a 4x4 matrix that represents a 3d transform and uses homogeneous coordinates for a translation, you can then use that to get the X,Y,Z orientation vectors, but also can get the translation from the origin.
Hopefully this is helpful, and not misleading for less common matrix types. I saw an answer deleted which said similar, so fingers crossed :P. A matrix can be used to transform a coordinate system into a new one. More specifically, it can be used to transform the basis vectors of a coordinate system. That's how it defines a new coordinate system.
It is of course always in relation to another coordinate system but that is often implicit. For example, the coordinate system where an object's vertices are defined. Those vertices are then transformed, with a matrix, to some global coordinate system with the rest of the scene.
That's why it is said that the matrix defines the local coordinate system, in relation to the global one. With that said, there can be a number of other meanings.
0コメント