3. The Geometry of Virtual Worlds

Section 2.2 introduced the Virtual World Generator (VWG), which maintains the geometry and physics of the virtual world. This chapter covers the *geometry* part, which is needed to make models and move them around. The models could include the walls of a building, furniture, clouds in the sky, the user's avatar, and so on. Section 3.1 covers the basics of how to define consistent, useful models. Section 3.2 explains how to apply mathematical transforms that move them around in the virtual world. This involves two components: Translation (changing position) and rotation (changing orientation). Section 3.3 presents the best ways to express and manipulate 3D rotations, which are the most complicated part of moving models. Section 3.4 then covers how the virtual world appears if we try to ``look'' at it from a particular perspective. This is the geometric component of visual rendering, which is covered in Chapter 7. Finally, Section 3.5 puts all of the transformations together, so that you can see how to go from defining a model to having it appear in the right place on the display.

If you work with high-level engines to build a VR experience, then most of the concepts from this chapter might not seem necessary. You might need only to select options from menus and write simple scripts. However, an understanding of the basic transformations, such as how to express 3D rotations or move a camera viewpoint, is essential to making the software do what you want. Furthermore, if you want to build virtual worlds from scratch, or at least want to *understand* what is going on under the hood of a software engine, then this chapter is critical.

- 3.1 Geometric Models
- Data structures
- Inside vs. outside
- Why triangles?
- Stationary vs. movable models
- Choosing coordinate axes
- Viewing the models

- 3.2 Changing Position and Orientation
- Translations
- Relativity
- Getting ready for rotations
- Applying the 2D matrix to points
- Only some matrices produce rotations
- The 3D case
- Yaw, pitch, and roll
- Combining rotations
- Matrix multiplications are ``backwards''
- Translation and rotation in one matrix
- Inverting transforms

- 3.3 Axis-Angle Representations of Rotation

- 3.4 Viewing Transformations

- 3.5 Chaining the Transformations