GACCUM_TRAN_MATRIX(3NCARG) | NCAR GRAPHICS | GACCUM_TRAN_MATRIX(3NCARG) |
GACCUM_TRAN_MATRIX - Accumulate transformation matrix
gaccum_tran_matrix (Accumulate transformation matrix) - Constructs a GKS segment transformation matrix by starting with an existing matrix and composing it with a shift vector, a rotation angle, and X and Y scale factors to create a new transformation matrix. The rotation and scaling are done with respect to a user-defined fixed point.
#include <ncarg/gks.h>
void gaccum_tran_matrix(const Gtran_matrix t_matrix, const Gpoint *point, const Gvec *shift, Gdouble angle, const Gvec *scale, Gcoord_switch coord_switch, Gtran_matrix tran_matrix);
If world coordinates are used, the shift vector and the fixed point are transformed by the current normalization transformation.
The order in which the transformations are applied is: input matrix, scale, rotate, and shift.
Elements tran_matrix[0][2] and tran_matrix[1][2] are in normalized device coordinates and the other elements of tran_matrix are unitless.
gaccum_tran_matrix can be used to construct more general transformation matrices than geval_tran_matrix. The most common usage of gaccum_tran_matrix is to change the order in which the operations of scale, rotate, and shift are applied (which is fixed in geval_tran_matrix). The example below shows how to construct a transformation matrix that shifts first and then rotates.
Assuming that the input matrix t_matrix is initially the identity, the following code
pi = 3.1415926;
point.x = point.y = 0.5;
shift.delta_x = 0.25;
shift.delta_y = 0.;
scale.delta_x = 1.0;
scale.delta_y = 1.0;
gaccum_tran_matrix(t_matrix,&point,&shift,0.,&scale,GCOORD_WC,tout);
for( i = 0; i < 2; i++ ) {
for( j = 0; j < 3; j++ ) {
t_matrix[i][j] = tout[i][j];
}
}
shift.delta_x = 0.;
shift.delta_y = 0.;
gaccum_tran_matrix(t_matrix,&point,&shift,45.*pi/180.,&scale,GCOORD_WC,tout);
would produce a transformation matrix in tout that would shift by (.25,0.) first, and then rotate by 45 degrees.
To use the GKS C-binding routines, load the ncarg_gks and ncarg_c libraries.
Online: geval_tran_matrix(3NCARG), gclose_seg(3NCARG), gcreate_seg(3NCARG), gcopy_seg_ws(3NCARG), gdel_seg(3NCARG), ginq_name_open_seg(3NCARG), ginq_set_seg_names(3NCARG), gset_seg_tran(3NCARG), gks(3NCARG), ncarg_gks_cbind(3NCARG)
Hardcopy: User's Guide for NCAR GKS-0A Graphics; NCAR Graphics Fundamentals, UNIX Version
Copyright (C) 1987-2009
University Corporation for Atmospheric Research
The use of this Software is governed by a License Agreement.
March 1993 | UNIX |