Graphics Reference
In-Depth Information
WPF
3
1
48
4
Trans
48, 48
1
48
1
3
4.8
4
Scale
4.8, 4.8
4.8
1
Canvas
Face
Minute hand
Hour hand
3
10
4
3
-1
4
3
0.96 -0.26
4
Scale
10 10
10
Rot 180
-1
Rot 15
0.26
0.96
1
1
1
3
-1
4
3
1
4
Circle
Rot 180
-1
Rot 180
-1
1
1
3
1.7
4
Scale
1.7, 0.7
Hand 1
0.7
1
Hand 2
Figure 10.18: A scene-graph representation of the XAML code for the clock.
The order of items in the tree is a little different from the textual order, but
there's a natural correspondence between the two. If you consider the hour hand
and look at all transformations that occur in its associated render transform or
in the render transform of anything containing it (i.e., the whole clock), those are
exactly the transforms you encounter as you read from the leaf node corresponding
to the hour hand up toward the root node.
Inline Exercise 10.20: Write down all transformations applied to the circle
template that's used as the clock face by reading the XAML program. Confirm
that they're the same ones you get by reading upward from the “Circle” box in
Figure 10.18.
In the scene graph we've drawn, the transformation matrices are the most
important elements. We're now going to discuss how these matrices and the coor-
dinates of the points in the geometry nodes interact.
Recall that there are two ways to think about transformations. The first is to say
that the minute hand, for instance, has a rotation operation applied to each of its
points, creating a new minute hand, which in turn has a translation applied to each
point, creating yet another new minute hand, etc. The tip of the minute hand is at
location ( 0, 9 ) , once and for all. The tip of the rotated minute hand is somewhere
else, and the tip of the translated and rotated minute hand is somewhere else again.
It's common to talk about all of these as if they were the same thing (“ Now the
tip of the minute hand is at ( 3, 17 ) ...”),butthatdoesn't really make sense—the tip
of the minute hand cannot be in two different places.
 
Search WWH ::




Custom Search