Graphics Reference
In-Depth Information
Figure 4.4.
Transforming from world to
camera coordinates.
1
2
1
2
1
2
1
2
(
)
+
(
)
=-
T
:
x
¢
=-
x
-
5
y
-
5
x
+
y
wor
Æ
cam
1
2
1
2
1
2
1
2
(
)
-
(
)
= -
y
¢
=-
x
-
5
y
-
5
x
-
y
+
52
As a quick check we compute T(5,5) = (0,0) and T(5 -
2
,5 -
2
) = (0,2), which clearly
are the correct values.
Next, we work through a three-dimensional example.
4.2.2 Example.
Assume that the camera is located at
p
= (5,1,2), looking in direc-
tion
v
= (-1,-2,-1), and that the view plane is a distance d = 3 in front of the camera.
The problem again is to find T
worÆcam
.
Solution.
Using equations (4.2) we get
1
6
(
)
u
=
-
121
,
-
,
-
3
1
30
1
6
(
)
(
)
uww
=
=
-
125
,
-
,
,
where
w
=--
125
,
,
2
1
5
=¥=
(
)
uuu
210
,, .
1
3
2
It follows that
¢=
-
2
5
1
5
(
)
+
(
)
T
:
x
x
-
5
y
-
1
wor
Æ
cam
-
1
30
-
2
30
5
30
(
)
+
(
)
+
(
)
y
¢=
x
-
5
y
-
1
z
-
2
¢=
-
1
6
-
2
6
-
1
6
(
)
+
(
)
+
(
)
z
x
-
5
y
-
1
z
-
2
.