What is orientation?
Intuitively, we know that the "orientation" of an object mainly describes the orientation of an object. However, the "direction" and "orientation" are not exactly the same. A vector has a "direction" but no "orientation". The difference is that when a vector points to a specific direction, the vector can be rotated (as shown in 10.1), but the vector (or its direction) but there will be no changes, because the attributes of the vector are only "size", but not "thickness" and "width ".
However, when an object rotates in the same direction as the preceding vector, you will find that the object's orientation has changed, as shown in Figure 10.2:
From a technical point of view, this means that in 3D, you only need to use two numbers (for example, polar coordinates) to express a direction using parameters ). However, to determine an orientation, at least three numbers are required.
We know that absolute coordinates cannot be used to describe the location of an object. To describe the location of an object, we must place the object in a specific reference system. The description position is actually the displacement of the description relative to the given reference point (usually the origin of the coordinate system.
Likewise, absolute quantities cannot be used to describe the object's azimuth. Similar to the displacement of a given point, the orientation is described by rotation of a given point (usually known as a "unit" or "Source. The amount of rotation is called the angle displacement. In other words, describing the azimuth in mathematics is equivalent to describing the angle displacement.
The difference between "orientation" and "angle displacement" is like the difference between "point" and "vector"-both terms are equivalent in mathematics but different in concept. The azimuth and vertices are mainly used to describe a single state, while the angle displacement and vector describe the difference between the two States. Specifically, we use a matrix and a four-element matrix to represent "angle displacement", and a euclidean angle to represent "azimuth ".
Matrix Form
In 3D, one way to describe the azimuth in the coordinate system is to list the base vectors of the coordinate system. These base vectors are described in other coordinate systems. Use these base vectors to form a 3x3 matrix, and then use the matrix form to describe the azimuth. In other words, a rotation matrix can be used to describe the relative orientation between the two coordinate systems. This rotation matrix is used to convert the vectors in one coordinate system to another, as shown in 10.3:
We determine an orientation by describing the rotation of a coordinate system to another coordinate system (no matter which transformation is used. The specific direction of matrix transformation is an implementation detail, because the rotation matrix is orthogonal. If necessary, only a simple transpose can be used to obtain the inverse transformation.
Advantages of matrix form
A matrix is a very direct description of the orientation. This directness brings about the following advantages:
(1) The vector can be rotated immediately. The most important property of matrix form is that the matrix can be used to rotate the vector between the object and the inertial coordinate system, which is not possible for other descriptions of the azimuth. To rotate a vector, the orientation must be converted into a matrix.
(2) The matrix format is used by the graphic API. The graphic API uses a matrix to describe the orientation. (APIs are application interfaces. Basically, they are the code used to communicate with your video card .) When you communicate with the graphic API, you must use a matrix to describe the required transformation. It is up to you to decide how to save the orientation in the program, but if you select another form, you must convert it to a matrix somewhere in the rendering pipeline.
(3) Multiple angular displacement connections. The second advantage of matrix form is that it can "break" the relationship between nested coordinate systems. For example, if you know the orientation of a about B and B about C, you can use a matrix to obtain the orientation of a about C.
(4) inverse of the matrix. When the angle displacement is expressed in the form of a matrix, the inverse matrix is the "inverse" angle displacement. Since the rotating matrix is orthogonal, this computation is only a simple matrix transpose operation.
Disadvantages of matrix form
(1) The Matrix occupies more memory. If you need to save a large number of orientations, such as key frames in the animation sequence, the number of 9 will cause a considerable amount of extra space loss. For example, it may not be suitable. Assume that a person's Model Animation is used, and the model is divided into 15 pieces. Animation completion strictly controls the relative orientation between the child block and the parent block. Assume that each frame stores an orientation for each part, and the animation frequency is 15Hz, which means that 225 orientations need to be saved every second. Using a matrix and a 32-bit floating point number, each frame has 8100 bytes, while using an ouarta, the same data only needs 2700 bytes. For 30 s of animation data, the matrix occupies 16 K Bytes more than the ouarla.
(2) difficult to use. A matrix is not intuitive to humans. There are too many numbers and they are all between-1 and 1. The intuitive method for humans to consider orientation is angle, while the matrix uses vectors. In practice, we can get the orientation it represents from a given matrix. However, this is still much more difficult than Orla Hora, and other aspects are not satisfactory. It is almost impossible to construct a matrix describing any location by hand. In short, the matrix is not an intuitive way for humans to think about the orientation.
(3) The matrix may be pathological. A matrix uses nine numbers. In fact, only three numbers are required. That is to say, the matrix has Level 6 redundancy. The matrix describing the azimuth must meet six constraints. Rows must be units vectors and they are vertical to each other.
How does a pathological matrix appear? There are multiple reasons:
1. The matrix may contain scaling, shear, or image operations. What are the effects of these operations on the object's "orientation? Indeed, there is no clear definition of this. Any non-orthogonal matrix is not a well-defined rotation matrix. Although the image matrix is orthogonal, it is not a valid rotation matrix.
2. Attackers may obtain "bad" data from external data sources. For example, an error may occur during the capture process when an object data is used to obtain a device (such as an action catcher. Many modeling packages are notorious for generating a pathological matrix.
3. "bad" data may be generated due to floating point rounding errors. For example, a large number of addition operations on an object's orientation are common in games that allow people to manually control the object's location. Due to the limitations of floating point precision, a large number of matrix multiplication may lead to pathological matrices. This phenomenon is called "Matrix creep ".