1GACCUM_TRAN_MATRIX(3NCARG) NCAR GRAPHICS GACCUM_TRAN_MATRIX(3NCARG)
2
3
4
6 gaccum_tran_matrix (Accumulate transformation matrix) - Constructs a
7 GKS segment transformation matrix by starting with an existing matrix
8 and composing it with a shift vector, a rotation angle, and X and Y
9 scale factors to create a new transformation matrix. The rotation and
10 scaling are done with respect to a user-defined fixed point.
11
13 #include <ncarg/gks.h>
14
15 void gaccum_tran_matrix(const Gtran_matrix t_matrix, const Gpoint
16 *point, const Gvec *shift, Gdouble angle, const Gvec *scale, Gco‐
17 ord_switch coord_switch, Gtran_matrix tran_matrix);
18
20 t_matrix (Gfloat, Input) - A 2x3 GKS transformation matrix.
21
22 point.x (Gfloat, Input) - X coordinate value for a fixed point to
23 be used for the scaling and rotation parts of the output
24 transformation. point.x is either in world coordinates or
25 normalized device coordinates depending on the setting of
26 the argument coord_switch described below.
27
28 point.y (Gfloat, Input) - Y coordinate value for a fixed point to
29 be used for the scaling and rotation parts of the output
30 transformation. point.y is either in world coordinates or
31 normalized device coordinates depending on the setting of
32 the argument coord_switch described below.
33
34 shift.delta_x
35 (Gfloat, Input) - The X component of a shift vector to be
36 used for the scaling part of the output transformation.
37 shift.delta_x is either in world coordinates or normalized
38 device coordinates depending on the setting of the argument
39 coord_switch described below.
40
41 shift.delta_y
42 (Gfloat, Input) - The Y component of a shift vector to be
43 used for the scaling part of the output transformation.
44 shift.delta_y is either in world coordinates or normalized
45 device coordinates depending on the setting of the argument
46 coord_switch described below.
47
48 angle (Input) - The rotation angle, in radians, to be used for
49 the rotation part of the output transformation.
50
51 scale.delta_x
52 (Gfloat, Input) - X coordinate scale factor to be used in
53 the scaling part of the output transformation.
54
55 scale.delta_y
56 (Gfloat, Input) - Y coordinate scale factor to be used in
57 the scaling part of the output transformation.
58
59 coord_switch
60 (Input) - A coordinate switch to indicate whether the val‐
61 ues for the arguments point and shift (described above) are
62 in world coordinates or normalized device coordinates.
63 Possible values include:
64
65 GCOORD_WC
66 World coordinates
67
68 GCOORD_NDC
69 Normalized device coordinates
70
71 tran_matrix (Gfloat, Output) - A 2x3 array that contains
72 the GKS transformation matrix in a form that
73 can be used as input to other GKS functions
74 such as gset_seg_tran. This matrix is con‐
75 structed by composing the scale, rotate, and
76 shift input, described above, with the original
77 input matrix t_matrix.
78
80 If world coordinates are used, the shift vector and the fixed point are
81 transformed by the current normalization transformation.
82
83 The order in which the transformations are applied is: input matrix,
84 scale, rotate, and shift.
85
86 Elements tran_matrix[0][2] and tran_matrix[1][2] are in normalized
87 device coordinates and the other elements of tran_matrix are unitless.
88
89 gaccum_tran_matrix can be used to construct more general transformation
90 matrices than geval_tran_matrix. The most common usage of gac‐
91 cum_tran_matrix is to change the order in which the operations of
92 scale, rotate, and shift are applied (which is fixed in
93 geval_tran_matrix). The example below shows how to construct a trans‐
94 formation matrix that shifts first and then rotates.
95
97 Assuming that the input matrix t_matrix is initially the identity, the
98 following code
99
100 pi = 3.1415926;
101 point.x = point.y = 0.5;
102 shift.delta_x = 0.25;
103 shift.delta_y = 0.;
104 scale.delta_x = 1.0;
105 scale.delta_y = 1.0;
106 gaccum_tran_matrix(t_matrix,&point,&shift,0.,&scale,GCOORD_WC,tout);
107 for( i = 0; i < 2; i++ ) {
108 for( j = 0; j < 3; j++ ) {
109 t_matrix[i][j] = tout[i][j];
110 }
111 }
112 shift.delta_x = 0.;
113 shift.delta_y = 0.;
114 gaccum_tran_matrix(t_matrix,&point,&shift,45.*pi/180.,&scale,GCOORD_WC,tout);
115
116 would produce a transformation matrix in tout that would shift by
117 (.25,0.) first, and then rotate by 45 degrees.
118
120 To use the GKS C-binding routines, load the ncarg_gks and ncarg_c
121 libraries.
122
124 Online: geval_tran_matrix(3NCARG), gclose_seg(3NCARG), gcre‐
125 ate_seg(3NCARG), gcopy_seg_ws(3NCARG), gdel_seg(3NCARG),
126 ginq_name_open_seg(3NCARG), ginq_set_seg_names(3NCARG),
127 gset_seg_tran(3NCARG), gks(3NCARG), ncarg_gks_cbind(3NCARG)
128
129 Hardcopy: User's Guide for NCAR GKS-0A Graphics; NCAR Graphics Funda‐
130 mentals, UNIX Version
131
133 Copyright (C) 1987-2009
134 University Corporation for Atmospheric Research
135 The use of this Software is governed by a License Agreement.
136
137
138
139UNIX March 1993 GACCUM_TRAN_MATRIX(3NCARG)