Graphics Reference
In-Depth Information
and after the ScaleLocal() function call, the concatenated matrix at the top of
the stack, M t 2 ,is
M t 2 =
SM t 1 =
STM t .
Because in this case the top of matrix stack was initialized to the identity matrix,
or M t =
I 4 ,
M t 2 =
I 4 ST
=
ST
.
We see that at label C, we are computing the M a operator of Equation (9.6).
In exactly the same manner, at label D we are computing the M b operator of
Equation (9.7).
In this tutorial, we observe the push and pop functionality for saving and
restoring matrices. In addition, we see that the matrix stack can be used as an
implicit target for concatenating transformation operators. In this case, we com-
pute transformation operators without explicitly managing matrices. From now
on, we will work almost exclusively with the matrix stack when computing trans-
formation operators.
Tutorial 9.4. Pivoted Scaling/Rotation
Tutorial 9.4.
Project Name:
D3D _ PivotedRotation
Library Support:
UWB _ MFC _ Lib1
UWB _ D3D _ Lib8
Goals. Verify and implement the pivoted scaling and rotation transforma-
tion.
Approach. Allow the user to select pivot positions; construct the corre-
sponding transformation operator; examine the transformation results.
Figure 9.13 is a screenshot of running Tutorial 9.4. This tutorial implements the
transformation
M c =
S
(
s x ,
s y )
R
( θ )
T
(
t x ,
t y )
(9.8)
and draws
V i M c ,
where, similar to Tutorial 9.1, V i are
Figure 9.13.
Tutorial
V a =(
0
,
0
) ,
9.4.
V b =(
2
,
0
) ,
rectangle vertices:
=(
,
) ,
V c
2
3
V d =(
0
,
3
) .
Once again, the slider bars on the application window control the corresponding
transformation parameters (e.g., TranslateX controls t x ). By manipulating the
 
Search WWH ::




Custom Search