Graphics Reference
In-Depth Information
y
3
z = 0
repeat until (done) {
R = z-axis rotation matrix of 'z' degrees
for each point P of the moon {
P
2
= R*P
1
}
record a frame of the animation
z = z+5
}
x
( r , 0, 0)
z
FIGURE 2.13
Rotation by forming the rotation matrix anew for each frame.
matrix to represent a rigid transformation is to take the first row (column) and normalize it. Take the
second row (column), compute the cross-product of this row (column) and the first row (column), nor-
malize it, and place it in the third row (column). Take the cross-product of the third row (column) and
the first row (column) and put it in the second row (column) (see Figure 2.14 ) . Notice that this does not
necessarily produce the correct transformation; it merely forces the matrix to represent a rigid trans-
formation. The error has just been shifted around so that the columns of the matrix are orthonormal and
the error may be less noticeable.
If the transformation might contain a uniform scale, then take the length of one of the rows, or the
average length of the three rows, and, instead of normalizing the vectors by the steps described above,
make them equal to this length. If the transformation might include nonuniform scale, then the differ-
ence between shear and error accumulation cannot be determined unless something more is known
about the transformations represented. For example, if it is known that nonuniform scale was applied
before any rotation (i.e., no shear), then Gram-Schmidt Orthonormalization [ 6 ] can be performed, with-
out the normalization step, to force orthogonality among the vectors. Gram-Schmidt processes the vec-
tors in any order. To process a vector, project it onto each previously processed vector. Subtract the
projections from the vector currently being processed, then process the next vector. When all vectors
have been processed, they are orthogonal to each other.
Considerations of scale
When constructing a large database (e.g., flight simulator), there may be such variations in the mag-
nitude of various measures as to create precision problems. For example, you may require detail on the
order of a fraction of an inch may be required for some objects, while the entire database may span
thousands of miles. The scale of values would range from to 10 -1 inches to 5000 miles
5280 feet/
10 8 inches. This exceeds the precision of 32-bit single-precision represen-
tations. Using double-precision will help eliminate the problem. However, using double-precision
representations may also increase storage space requirements and decrease the speed of the computa-
tions. Alternatively, subdividing the database into local data, such as airports in the example of a flight
simulator, and switching between these localized databases might provide an acceptable solution.
ΒΌ
mile
12 inches/foot
3.168
 
Search WWH ::




Custom Search