Graphics Reference
In-Depth Information
10.4
The World Coordinate Window
In order to properly support WC design space, in our programs we must identify
a rectangular region of interest, or the
window
inside the WC:
⎧
⎨
center
=(
cx
wc
,
cy
wc
)
,
WC window
=
width
=
W
wc
,
⎩
height
=
H
wc
.
We must then construct a corresponding
M
w
2
n
to transform this region to the
NDC space.
In general, we transform the center of the region to the origin
(
T
(
−
cx
wc
,−
cy
wc
)
) and then scale the width and height of the region to the NDC
2
2
2
×
2 square (
S
(
W
wc
,
H
wc
)
):
2
W
wc
,
2
H
wc
)
.
M
w
2
n
=
T
(
−
cx
wc
,−
cy
wc
)
S
(
(10.10)
10.4.1
Vertices in Different Coordinate Spaces
As programmers working with graphics APIs, we specify vertices in the WC, or
V
wc
. As illustrated in Figure 10.16, this vertex undergoes different transforms
until it reaches the DC, or
V
dc
, before being displayed on the output drawing
area:
M
w
2
n
−→
M
n
2
d
−→
V
wc
V
ndc
V
dc
,
V
wc
=(x
wc,
y
wc
)
V
ndc
=(x
ndc,
y
ndc
)
V
dc
=(x
dc,
y
dc
)
WC
W
indow
M
n2d
M
w2n
1
H
dc
H
wc
2
(cx
wc,
cy
wc
)
1
-1
-1
W
wc
W
dc
2
WC
NDC
DC
Figure 10.16.
Transformation of a vertex between different coordinate systems.
Search WWH ::
Custom Search