Graphics Reference
In-Depth Information
coordinates, which are relative to the world frame of reference, are computed
relative to the camera's axial system, and then used to develop a perspective
projection. Before explaining how this is achieved in 3D, let's examine the
simple case of changing axial systems in two dimensions.
7.5.1 2D Change of Axes
Figure 7.15 shows a point
P
(
x
,
y
) relative to the
XY
-axes, but we require to
know the coordinates relative to the
X
Y
-axes. To do this, we need to know
the relationship between the two coordinate systems, and ideally we want to
apply a technique that works in 2D and 3D. If the second coordinate system
is a simple translation (
t
x
,t
y
) relative to the reference system, as shown in
Figure 7.15, the point
P
(
x
,
y
) has coordinates relative to the translated system
(
x
−
t
x
,y
−
t
y
):
⎡
⎤
⎡
⎤
⎡
⎤
x
y
1
10
t
x
01
−t
y
00 1
−
x
y
1
⎣
⎦
=
⎣
⎦
·
⎣
⎦
(7.72)
If the
X
Y
-axes are rotated
β
relative to the
XY
-axes, as shown in Figure 7.16,
apoint
P
(
x
,
y
) relative to the
XY
-axes has coordinates (
x
,y
) relative to the
rotated axes given by
⎡
⎤
⎡
⎤
⎡
⎤
x
y
1
cos(
−
β
)
−
sin(
−
β
)0
x
y
1
⎣
⎦
=
⎣
⎦
·
⎣
⎦
sin(
−
β
)
cos(
−
β
)0
0
0
1
which simplifies to
⎡
⎣
⎤
⎦
=
⎡
⎣
⎤
⎦
·
⎡
⎣
⎤
⎦
x
y
1
cos(
β
) in
β
)0
x
y
1
−
sin(
β
)
β
)0
0
(7.73)
0
1
Y
Y
′
P
(
x, y
) =
P
′
(
x
′,
y
′
)
t
y
X
′
t
x
X
Fig. 7.15.
The
X
Y
-axes are translated by (
t
x
,t
y
).