Graphics Reference
In-Depth Information
call), then at label D, the m _ ArmXform object concatenates M a with the top of the
matrix stack and loads the concatenated result into the WORLD ( M W )matrix. The
concatenated top of stack M t 1 is
=
=
=
.
M t 1
M a M t
M a I 4
M a
In this way, the top of the stack M t 1 is simply M a and is loaded into the M W
matrix processor. As pointed out by Equation (11.1), all vertices V i of triangles
that represent R a 0 and C p 0 will be transformed into V io according to
V io
=
V i M W M V M P
(11.2)
=
V i M a M V M P
.
The important lesson this tutorial demonstrates is that to control geometric objects
in computer graphics applications, we typically:
P p
Do not alter the basic geometry of the primitives (i.e., we do not change the
vertex positions of R a 0 or C p 0 ).
P a
C p0
R a0
Do define a transformation operator to transform the defined geometric
primitives (i.e., we defined m _ ArmXform ( M a ) to transform R a 0 and C p 0 ).
We can increase the complexity of the simple arm of Tutorial 11.1 by supporting
independent transformation control over the palm ( C p 0 ). As illustrated in Fig-
ure 11.3, we want the palm to be transformed with respect to the end of the arm,
or pivoted at the location P p . Notice that, in addition to the independent trans-
formation of the palm, when we transform the arm by changing M a , we would
expect the palm to follow M a .
Figure 11.3. Indepen-
dent transformation of the
palm.
Tutorial 11.2.
Project Name:
D3D _ ParentChild
Library Support:
UWB _ MFC _ Lib1
UWB _ D3D _ Lib10
Tutorial 11.2. Independent Control of the Palm
Goal. Work with two levels of transformations where the second level fol-
lows the transformation from the first level.
Approach. Implement the arm/palm control as defined by Figure 11.3.
Figure 11.4 is a screenshot of running Tutorial 11.2. In this tutorial, by activating
the appropriate radio button, we can choose to interactively control the entire
object (i.e., R a 0 and C p 0 ) or to independently transform only the palm object (i.e.,
C p 0 ). Listing 11.2 shows that the implementation of Tutorial 11.2 is similar to
that of Tutorial 11.1 with two important differences.
Figure 11.4.
Tutorial
11.2.
Search WWH ::




Custom Search