Graphics Reference
In-Depth Information
(
)
u 1
=
uu
-
uu uu
,
-
uu
2331 0
,
.
3223
2233
3321
It is also easy to show that u 1 is a positive scalar multiple of (u 32 ,-u 31 ,0) (Exercise
4.2.1), so that
1
(
)
u 1
=
uu
,
-
,
0
.
(4.3)
32
31
2
2
uu
+
31
32
Although this characterization of u 1 is useful and easier to remember than the cross
product, it is not as efficient because it involves taking a square root.
Note that there is one case where our construction does not work, namely, when
the camera is looking in a direction parallel to the z-axis. In that case the orthogonal
projection of the z-axis on the view plane is the zero vector. In this case one can arbi-
trarily use the orthogonal projection of the y-axis on the view plane to define u 2 . For-
tunately, in practice it is rare that one runs into this case. If one does, what will happen
is that the picture on the screen will most likely suddenly flip around to some unex-
pected orientation. Such a thing would not happen with a real camera. One can
prevent it by keeping track of the frames as the camera moves. Then when the camera
moves onto the z-axis one could define the new frame from the frames at previous
nearby positions using continuity. This involves a lot of extra work though which is
usually not worth it. Of course, if it is important to avoid these albeit rare occurrences
then one can do the extra work or require that the user specify the desired up direc-
tion explicitly.
Finally, given the frame F = ( u 1 , u 2 , u 3 , p ) for the camera, then the world-to-camera
coordinate transformation T worÆcam in Figure 4.1 is the map
) (
) =-
TTT
(
(
)
qqpuuu
Æ-
qp
M,
(4.4)
123
where M is the 3 ¥ 3 matrix that has the vectors u i as its columns.
We begin with a two-dimensional example.
4.2.1 Example. Assume that the camera is located at p = (5,5), looking in direc-
tion v = (-1,-1), and that the view plane is a distance d = 2 in front of the camera. See
Figure 4.4. The problem is to find T worÆcam .
Solution. Let u 2 = v /| v | = (-1/ ,-1/ ) ( u 2 plays the role of u 3 here). The “up” direc-
tion is determined by e 2 in this case, but all we have to do is switch the first and
second coordinate of u 2 and change one of the signs, so that u 1 = (-1/
2
2
2
,1/
2
). We
now have the camera frame ( u 1 , u 2 , p ). It follows that T = T worÆcam is the map
1
2
1
2
1
2
1
2
Ê
ˆ
--
Á
Á
˜
˜
(
) Æ-
(
)
xy
,
x
55
,
y
-
.
-
Ë
¯
In other words,
Search WWH ::




Custom Search