GACCUM_TRAN_MATRIX(3NCARG)
π¦ GACCUM_TRAN_MATRIX π¦
okay so bestie, welcome to the NCAR GRAPHICS corner of the 3NCARG manual π
this one's about gaccum_tran_matrix and honestly? it's giving matrix math main character energy β¨
β¨ NAME β¨
GACCUM_TRAN_MATRIX β Accumulate transformation matrix π
πΈ DESCRIPTION πΈ
gaccum_tran_matrix (Accumulate transformation matrix) β it builds a GKS segment transformation matrix by taking a matrix you already have and composing it with a shift vector, a rotation angle, and X and Y scale factors to make a whole new transformation matrix. no cap. π«Ά
and the rotation + scaling? those happen with respect to a user-defined fixed point, because obviously we're not just rotating into the void π
π SYNOPSIS π
#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);
π DESCRIPTION (cont.) β the actual arguments, bestie π
t_matrix(Gfloat, Input) β a2x3GKS transformation matrix. your starting point, your canvas, your blueprint πpoint.x(Gfloat, Input) β the X coordinate value for a fixed point, and that fixed point is what the scaling and rotation parts of the output transformation happen around.point.xis either in world coordinates or normalized device coordinates, depending on howcoord_switchis set (more on that below, don't worry π ).point.y(Gfloat, Input) β the Y coordinate value for that same fixed point used for the scaling and rotation parts of the output transformation. also either world coordinates or normalized device coordinates depending oncoord_switch. slay β¨shift.delta_x(Gfloat, Input) β the X component of a shift vector used for the scaling part of the output transformation.shift.delta_xis either in world coordinates or normalized device coordinates, depending on the setting ofcoord_switch. yes we know, it says the scaling part, that's just what the manpage says, we don't make the rules πshift.delta_y(Gfloat, Input) β the Y component of that shift vector, used for the scaling part of the output transformation. again: world coordinates or normalized device coordinates depending oncoord_switch.angle(Input) β the rotation angle, in radians, used for the rotation part of the output transformation. radians bestie, not degrees, do not come at me with 45 and expect a 45-degree rotation π§scale.delta_x(Gfloat, Input) β the X coordinate scale factor used in the scaling part of the output transformation.scale.delta_y(Gfloat, Input) β the Y coordinate scale factor used in the scaling part of the output transformation.coord_switch(Input) β a coordinate switch that tells us whether the values forpointandshiftare in world coordinates or normalized device coordinates. possible values include:GCOORD_WCβ World coordinates πGCOORD_NDCβ Normalized device coordinates π
tran_matrix(Gfloat, Output) β a2x3array holding the GKS transformation matrix, in a form you can feed straight into other GKS functions likegset_seg_tran. it's built by composing the scale, rotate, and shift inputs described above with the original input matrixt_matrix. iconic behavior honestly π
π USAGE π
if you're using world coordinates, then the shift vector and the fixed point get transformed by the current normalization transformation. periodt.
the order the transformations get applied in is: input matrix, then scale, then rotate, then shift. write that down π
elements tran_matrix[0][2] and tran_matrix[1][2] are in normalized device coordinates, and all the other elements of tran_matrix are unitless.
so here's the tea: gaccum_tran_matrix can build more general transformation matrices than geval_tran_matrix can. and the most common usage of gaccum_tran_matrix is to change the order in which scale, rotate, and shift get applied β because in geval_tran_matrix that order is locked in and you cannot move it, sorry babe π
the example below shows how to build a transformation matrix that shifts first and then rotates, which is exactly the kind of glow-up this function exists for π β¨
π₯ EXAMPLE π₯
assuming the input matrix t_matrix starts out as the identity, this 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 shifts by (.25,0.) first, and then rotates by 45 degrees. ate and left no crumbs π
π ACCESS π
to use the GKS C-binding routines, you load the ncarg_gks and ncarg_c libraries. that's it, that's the whole vibe.
π¦ SEE ALSO π¦
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 π
Copyright (C) 1987-2009 University Corporation for Atmospheric Research The use of this Software is governed by a License Agreement.
okay that's the whole page bestie, go forth and accumulate those transformation matrices responsibly π«Άπ
and that's a wrap on the UNIX version from March 1993 of GACCUM_TRAN_MATRIX(3NCARG) β mwah, no notes π
β¨
π¦ where this page comes from
- debian bookworm: libncarg-dev 6.6.2.dfsg.1-1
- debian trixie: libncarg-dev 6.6.2.dfsg.1-10+b2
- ubuntu jammy: libncarg-dev 6.6.2-10build2
- ubuntu questing: libncarg-dev 6.6.2.dfsg.1-10build2
- ubuntu resolute: libncarg-dev 6.6.2.dfsg.1-12
- ubuntu stonking: libncarg-dev 6.6.2.dfsg.1-12build2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms