Download Virtual Reality Applications

Transcript
Figure 4.2 – Comparison of VRML 1.0 and 2.0
4.1.3 Hierarchical transformation
All scenes in WTK are structured in a hierarchical manner, which, as described in section
3.2.3, means that WTK allows hierarchical transformation.
4.1.4 Rotation in any chosen point
Every sub-geometry in WTK has a local coordinate system, where the origin is placed at the
geometry’s midpoint (see Figure 4.3). When a geometry is rotated, it rotates around one of its
axes that run through the origin of the local coordinate system (also illustrated in Figure 4.3).
Thus a plain rotation only rotates the geometry around its midpoint, which can be quite
limited. The requirements specified that it must be possible to rotate a geometry in any chosen
point. This is achieved by the following procedure:
1.
The first thing that has to be done is to translate the geometry, so that the point of
rotation (marked with an X in Figure 4.3 (a)) is located at the origin of the local
coordinate system. This is illustrated in Figure 4.3 (b).
2.
The next step is to perform the actual rotation (Figure 4.3 (c)).
3.
Finally, the geometry is translated back to its original position, i.e. the inverse
translation of step one is performed. The final result is illustrated in Figure 4.3(d).
Since all modifications to geometries in WTK are performed before a scene is rendered (in
each program loop), the sequence above only displays the final result. This means that it does
not show on the screen the results of the intermediate steps.
14