next up previous
Next: o_projs32 Up: o_projs32 Previous: o_projs32

4. Projections on a slanted viewplane

To make an interesting picture of a scene, for example a street with houses, it's often desirable to use a slanted viewplane. Then even an orthographic projection becomes interesting.

To compute a projection on a viewplane numerically, the viewplane has to have some sort of coordinate system. For simplicity, we'll always assume that the viewplane goes through the origin in R$ ^ 3$ and that its coordinate system has the same origin and scale as the ordinary coordinate system in all of R$ ^ 3$. As usual, our goal will be to start with a point in R$ ^ 3$, project it on the viewplane, and get a pair of numbers that can be used for plotting. We are not interested in the actual three-dimensional position of the image points on the viewplane, but rather just the two-dimensional location of the image points in the coordinate system of the viewplane.

A coordinate system for a plane is best described by giving its two standard basis vectors as vectors in R$ ^ 3$. In other words, we give the unit vector v in R$ ^ 3$ that is $ (1,0)$ in the coordinate system of the plane, and the unit vector w in R$ ^ 3$ that is $ (0,1)$ in the coordinate system of the plane. The two vectors v and w constitute the coordinate frame of the coordinate system for the plane. (The coordinate frame information would normally also include the location in R$ ^ 3$ of the origin of the plane, but we don't need that information since we're assuming the origin of the viewplane is the origin in R$ ^ 3$.)

In notation, let's continue to write vectors in lower case if they are known to be unit vectors, and in upper case otherwise.



Problem: Project an object orthographically on a slanted viewplane through the origin.

Case 1: We are given a coordinate frame for the viewplane--orthonormal vectors v and w.



Method (i): Given a point x$ = (x,y,z)$ in the object, its projection in terms of the viewplane coordinates is $ ($x$ \cdot$   v$ ,$x$ \cdot$   w$ )$. Reason: As you may recall, these are the projections of x in the directions of v and w.



Method (ii): In outline: We find a $ 3 \times 3$ rotation matrix $ P$ taking the viewplane to the $ x,y$-plane, with v$ \mapsto$   i and w$ \mapsto$   j. We apply $ P$ to the object, and then project on the $ x,y$-plane. The two numbers we get are the desired ones, since they are the same ones we would get by projecting on the original slanted viewplane and finding the image points in terms of the coordinate system of the viewplane. See Figure [*].

Details: Let n$ =$   v$ \times$   w. Then n is a unit normal to the viewplane, and v$ ,$w$ ,$n are an orthonormal set of vectors in R$ ^ 3$. We want a rotation matrix $ P$ taking v$ \mapsto$   i, w$ \mapsto$   j, n$ \mapsto$   k, i.e., v$ P
=$   i, w$ P
=$   j, n$ P
=$   k. The other direction is easier, since then standard basis vectors are going to other vectors. In other words, we find $ Q$ taking i$ \mapsto$   v, j$ \mapsto$   w, k$ \mapsto$   n; $ Q$ is simply the $ 3 \times 3$ matrix $ Q = \left[\begin{array}{c}\mbox{\bf v}\\  \mbox{\bf w}\\  \mbox{\bf n}\end{array}\right]$. Then $ P = Q ^ {-1} = Q
^ t = [$v$ ^ t\vert$w$ ^ t\vert$n$ ^ t]$. To find the projection of x, we first find x$ P$ and then project on the $ x,y$-plane by discarding the third coordinate.

But notice that x$ P
=$   x$ [$v$ ^ t\vert$w$ ^ t\vert$n$ ^ t] = ($x$ \cdot$   v$ ,$x$ \cdot$   w$ ,$   x$ \cdot$   n$ )$, which projects to $ ($x$ \cdot$   v$ ,$   x$ \cdot$   w$ )$, the same answer as in the earlier method.



Why bother with the second method? One answer is that if we want to do hidden-line elimination later, the third-coordinate information can be used to tell which points on the object are closer to the viewplane than others. Another answer is that if we want to do, say, a perspective projection, then the first method no longer applies, but the idea of rotating does. See Figure [*].

Figure: Rotating an orthographic view
\begin{figure}\vspace{4.5in}
\end{figure}

Case 1$ '$: We are given non-unit vectors V and W along the positive axes of the viewplane.

Method: Just normalize V and W by letting v$ =$   V$ /\vert$V$ \vert$ and w$ =$   W$ /\vert$W$ \vert$.

Remark: If we need the information that comes from n, instead of finding v$ ,$w and then n it is simpler to let N$ =$   V$ \times$   W and then normalize N, if we are working by hand.



Case 2: We are given a normal vector N to the viewplane.

Method?? This isn't enough information, since we don't know how the coordinate system of the viewplane is situated. It could be turned various ways and we would still have the same normal. If we make a projection of a house and pick a viewplane coordinate system at random, then when we plot the results on a screen the house might be turned sideways or upside down.



Case 2$ '$: We are given a normal vector N to the viewplane and an up-vector--a vector U in R$ ^ 3$ whose image is supposed to be ``up'' in the picture. In other words, the projection of U on the viewplane is supposed to be in the positive w direction, since that's the ``$ y$-axis'' of the viewplane.

Method: Observe that the v direction of the viewplane is perpendicular to U. It is also perpendicular to N. So, not worrying about normalizing, do this:

Step (1): find V$ =$   U$ \times$   N. (We should ask why it's this order instead of the opposite, but this order is the one that makes V point in the correct direction, as you can see from a picture.)

Step (2): Let W$ =$   N$ \times$   V.

Step 3: Normalize V and W (and N, if you are using the rotation method). We are now in Case 1.

Note: To remember which way around the cross products go, think this way: V is like i, W is like j, and N is like k, and U is sort of like j also since it is to project to the W direction. Then Step 1 is like j$ \times$   k$ =$   i and Step 2 is like k$ \times$   i$ =$   j.

Also observe that it might seem more natural to normalize vectors as soon as you compute them, but by hand it's easier to save normalization to the end, as in Step 3.



Example: Suppose that a house is described by giving its vertices in R$ ^ 3$, with the $ x,y$-plane as the ground. In order to make an interesting picture, the viewplane $ x+y+z=0$ is to be used. What coordinate frame and rotation matrix should be used?

Solution: Since the $ x.y$-plane is the ground, take U$ =$   k. The viewplane normal is N$ = (1,1,1)$. Then
V$ =$   U$ \times$   N$ =$   k$ \times$   N$ = \det \left[\begin{array}{ccc}\mbox{\bf i}&\mbox{\bf j}&\mbox{\bf k}\\  0&0&1\\  1&1&1\end{array}\right]
= (-1,1,0)$
W$ =$   N$ \times$   V$ = \det \left[\begin{array}{ccc}\mbox{\bf i}&\mbox{\bf j}&\mbox{\bf k}\\  1&1&1\\  -1&1&0\end{array}\right]
= (-1,-1,2)$
v$ =$   V$ /\vert$V$ \vert = (-\frac 1{\sqrt 2},\frac 1{\sqrt 2},0)$
w$ =$   W$ /\vert$W$ \vert = (-\frac 1{\sqrt 6},-\frac 1{\sqrt 6},\frac 2{\sqrt 6})$
n$ =$   N$ /\vert$N$ \vert = ( -\frac 1{\sqrt 3}, -\frac 1{\sqrt 3}, -\frac 1{\sqrt 3})$. Then
$ P = \left[\begin{array}{ccc}
-\frac 1{\sqrt 2}&-\frac 1{\sqrt 6}&-\frac 1{\sqr...
... -\frac 1{\sqrt 3}\\
0&\frac 2{\sqrt 6}& -\frac 1{\sqrt 3}
\end{array}\right]$.

As a check, we could verify that v$ P
=$i, w$ P
=$j, n$ P
=$k, and, since U is supposed to project perpendicularly on the positive w-axis of the viewplane, U$ P$ should project perpendicularly on the positive $ y$-axis of the $ x,y$-plane.



Problem. Make a perspective projection of an object on a slanted viewplane through the origin.

Method: Again, we are either given a coordinate frame for the viewplane or else we need to find one. This time, it is best to find the rotation $ P$ that takes the coordinate frame and normal to i$ ,$j$ ,$k in R$ ^ 3$. We must rotate the viewpoint as well as the object! Then we do a perspective projection on the $ x,y$-plane. See Figure [*].

Figure: Rotating a perspective view
\begin{figure}\vspace{4.5in}
\end{figure}

Note: With oblique projections it is rare to use a slanted viewplane, because it is desirable to have a face of the object be parallel to the viewplane and the object is usually not given slanted. (Remember that if a face is parallel to the viewplane then its projection is undistorted, and this possibility is one of the main virtues of oblique projections.)




next up previous
Next: o_projs32 Up: o_projs32 Previous: o_projs32
Kirby A. Baker 2002-01-28