1. An isometric perspective projection is one where the viewplane intersects the principal axes at equal angles. In particular we require a view where the viewplane intersects the negative X, Y and Z axes. The View Reference Point is at the origin, and the viewer is looking towards the origin. The viewplane is one unit distance from the VRP, and the Center of Projection is one unit distance from the viewplane, on the opposite side of the viewplane from the VRP, and on the viewing axis specified by the view plane normal. The line segment (0,0,0) to (0,0,1) should appear vertical in the projection.
(a) Construct the matrix which transforms from World Coordinates to Viewing Coordinates, given the above view.
By construction we can obtain the following parameters: VRP = (0,0,0), VPN = (1,1,1), VUV = (0,0,1). (Write sqrt(x) = s(x)). Then n = VPN/|VPN| = (1/s(3), 1/s(3), 1/s(3)). n x VUV = (1/s(3), -1/s(3), 0), so that u = (1/s(2),-1/s(2),0) by normalisation. v = u x n = (-1/s(6), -1/s(6), 2/s(6)). Since VRP = (0,0,0), we have the matrix M = 1/s(2) -1/s(6) 1/s(3) 0 -1/s(2) -1/s(6) 1/s(3) 0 0 2/s(6) 1/s(3) 0 0 0 0 1(b) Find a formula giving the projection of the point (x,y,z) in world coordinates, on the viewplane.
From the question we have that COP = (0,0,-2) and the VP distance -1. Therefore, for a point (xa,ya,za) in VC the projection to the viewplane is given by (xa/(za+2), ya/(za+2)). We need to obtain (xa,ya,za) - this is obtained by multiplying (x,y,z,1) by M. This gives: xa = x/s(2) - y/s(2) ya = -x/s(6) - y/s(6) + 2*z/s(6) za = (x+y+z)/s(3).
2. Consider the following function:
void lookAt(double eyex, double eyey, double eyez, double centerx, double centery,double centerz, double upx, double upy, double upz);This specifies a viewing matrix. The desired viewpoint is specified by eyex, eyey, eyez. The centerx, centery, centerz arguments specify any point along the desired line of sight, but typically they're some point in the center of the scene being looked at. The upx, upy, upz arguments indicate which direction is up (that is the direction from the bottom to the top of the viewing volume.
Show how to implement this function by using the functions of the abstract camera model.
void lookAt(double eyex, double eyey, double eyez, double centerx, double centery,double centerz, double upx, double upy, double upz); { double d; setVRP(centerx,centery,centerz); setVPN(centerx - eyex, centery-eyey, centerz-eyez); setVUV(upx,upy,upz); d = sqrt(sqr(centerx-eyex) + sqr(centery-eyey) + sqr(centerz-eyez)); setCOP(0,0,-d); } where sqr(a) = a*a. The only non-obvious part is the COP. Recall that this must be specified in Viewing Coordinates. By the construction the COP is along the N axis of VC, therefore it must be of the form (0,0,-d) and d>0. The distance is that between the eye and the center coordinates.
3*. Consider the following function:
void perspective(double fovy, double aspect, double zNear, double zFar);Creates a matrix for a symmetric perspective-view frustum. The fovy argument is the angle of the field of view in the x-z plane; its value must be in the range [0.0, 180.0]. The aspect ratio is teh width of the frustum divided by its height. The zNear and zFar values are the distances between the viewpoint and the clipping planes along the negative z axis. They should always be positive....The default viewpoint is at the origin and the line of sight points down the negative z axis
(a) Show how to implement this function using the functions of the abstract camera model.
(b) This function defines a fixed camera, because of the default viewpoint and line of sight. The manual says "...you can apply rotations or translations to change the default orientation of the viewing volume." What does this mean and how can it be used to get an arbitrarily positioned and oriented camera.