Virtual Environments Exercises#

Exercise 17

The diagram belows shows the side view and a plan view of an object.

../_images/exercise_17.svg

The object is defined in the object space so that the centre of the base it as the origin. Define the vertex and face matrices in MATLAB and produce a plot of the object space.

Exercise 18

The object from Exercise 17 is used to build a virtual environment consisting of two objects. The first object is scaled by 0.5 in the \(x\) and \(y\) directions and 2 in the \(z\) direction, rotated about the \(z\)-axis by angle \(\pi/3\) and translated so that the centre of the base of the object is at \((3, 3, 0)\). The second object is scaled by 2 in the \(y\) direction, rotated by angle \(\pi/4\) about the \(z\)-axis and translated so that the centre of the base of the object is at \((6, 6, 0)\).

In MATLAB, determine the world space vertex and face matrices and produce a plot of the world space.

Exercise 19

The world space from Exercise 18 is to be viewed from the position \((12, 7, 4)\) looking towards the centre of view at \((5, 5, 2)\). Calculate the camera space co-ordinates and produce a plot of the camera space looking down the \(z\)-axis.

Exercise 20

The camera space from Exercise 19 is projected onto a screen space defined by the near and far viewing planes at distances 2 and 10 away from the origin respectively, a field of view angle \(\pi/3\) and an aspect ratio of \(4:3\). Calculate the screen space co-ordinates and produce a plot of the screen space looking down the \(z\)-axis.