Graphics Reference
In-Depth Information
2. Set the WORLD matrix processor to be
M W =
S
(
r i ,
r i )
T
(
x i ,
y i )
and define a triangle fan centered at the origin (
(
0
,
0
)
) with radius of 1
.
0.
While both approaches draw the exact same circle, the second approach supports
interactive changing of the circle more efficiently, where we can simply change
the translation and scale factors to move or resize the circle. This is the approach
we will learn about. Tutorial 9.6 introduced the XformInfo class to implement
P a
M W =
T
(
p x ,−
p y )
S
(
s x ,
s y )
R
( θ )
T
(
p x ,
p y )
T
(
t x ,
t y )
R a0
C p0
to support translation and pivoted scaling/rotation of primitives. In this chapter,
we will continue with this discussion. In particular, we will examine controlling
of the transformation of defined geometric primitives. In computer graphics ap-
plications, we typically define geometric primitives to represent a physical object
and then work with transformation matrices to control the defined object. For ex-
ample, Figure 11.1 shows a simple geometric model of an arm and a connected
palm. In this simple example, the arm is represented by the 2
Figure 11.1. The sim-
ple arm geometry of Tuto-
rial 11.1.
×
3 rectangle
(
0
,−
1
) ,
(
3
,−
1
) ,
R a 0 =
(
3
,
1
) ,
(
,
) ,
0
1
and the palm is represented by the circle
center
=(
4
,
0
) ,
C p 0 =
radius
=
1
.
0
.
As illustrated in Figure 11.1,
we define the pivot position to be located at P a =
Tutorial 11.1.
Project Name:
D3D _ SimpleArm
Library Support:
UWB _ MFC _ Lib1
UWB _ D3D _ Lib10
(
0
,
0
)
such that the rotation of the arm can resemble that of a real physical arm.
Tutorial 11.1. Controlling the Simple Arm
Goal. Work with a set of defined geometric primitives and with controlling
the transformation of the defined primitives.
Approach. Define the geometry of the simple arm in Figure 11.1 and ma-
nipulate transformations to control the arm.
Figure 11.2 is a screenshot of running Tutorial 11.1. We see that we can in-
teractively control the transformation of the arm, where the rotation and scaling
operations are performed with respect the P a pivot position.
Figure 11.2.
Tutorial
11.1.
 
Search WWH ::




Custom Search