GACCUM_TRAN_MATRIX(3NCARG)
๐ GACCUM_TRAN_MATRIX ๐
okay bestie, welcome to a page straight out of NCAR GRAPHICS โจ and yes, the manual name is literally NCAR Graphics, we're doing vintage graphics programming today and it's giving main character energy fr fr.
This one's about gaccum_tran_matrix, aka Accumulate transformation matrix โ and no cap, it's the one you call when you want to build a GKS segment transformation matrix by starting with a matrix you already have and composing it with a shift vector, a rotation angle, and X and Y scale factors, so you end up with a brand new transformation matrix ๐ฆ. The rotation and the scaling? Both happen with respect to a user-defined fixed point. Iconic. Periodt.
๐ธ 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 ๐
okay so here's the tea on every single argument, don't skip, they all matter ๐ซถ
t_matrix(Gfloat, Input) โ a2x3GKS transformation matrix. This is your starting point, your base, your before-pic.point.x(Gfloat, Input) โ the X coordinate value for a fixed point that gets used for the scaling and rotation parts of the output transformation. And here's the thing:point.xis either in world coordinates or normalized device coordinates depending on how the argumentcoord_switchis set (more on that below, we'll get there ๐ ).point.y(Gfloat, Input) โ the Y coordinate value for that same fixed point, used for the scaling and rotation parts of the output transformation. Same deal aspoint.x: it's either in world coordinates or normalized device coordinates depending on howcoord_switchis set.shift.delta_x(Gfloat, Input) โ the X component of a shift vector, used for the scaling part of the output transformation. And yep,shift.delta_xis either in world coordinates or normalized device coordinates depending on the setting ofcoord_switchdescribed below.shift.delta_y(Gfloat, Input) โ the Y component of that shift vector, used for the scaling part of the output transformation. Also either in 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, we don't do degrees here ๐ญ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 the routine whether the values for the argumentspointandshift(both described above, keep up ๐) are in world coordinates or normalized device coordinates. The possible values include:GCOORD_WCโ World coordinatesGCOORD_NDCโ Normalized device coordinates
tran_matrix(Gfloat, Output) โ a2x3array that holds the GKS transformation matrix in a form you can feed straight into other GKS functions, likegset_seg_tran. This matrix gets constructed by composing the scale, rotate, and shift input (all described above) with the original input matrixt_matrix. Slay.
๐ฆ USAGE ๐ฆ
so if you're using world coordinates, the shift vector and the fixed point get transformed by the current normalization transformation. Just how it is โจ
The order in which the transformations are applied is: input matrix, scale, rotate, and shift. That order. In that sequence. Don't come for me, that's the order ๐
Elements tran_matrix[0][2] and tran_matrix[1][2] are in normalized device coordinates, and the other elements of tran_matrix are unitless. Noted, bestie ๐
Also, gaccum_tran_matrix can be used to construct more general transformation matrices than geval_tran_matrix can. The most common usage of gaccum_tran_matrix is to change the order in which the operations of scale, rotate, and shift are applied โ because that order is fixed in geval_tran_matrix, lowkey rigid of it. The example below shows how to construct a transformation matrix that shifts first and then rotates. Obsessed with the flexibility honestly ๐ฅ
๐ EXAMPLE ๐
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. Two steps, one matrix, chef's kiss ๐
๐ฅ ACCESS ๐ฅ
To use the GKS C-binding routines, load the ncarg_gks and ncarg_c libraries. That's the whole vibe check โ
๐ 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
iykyk, go read those next bestie ๐โจ
๐ 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, you ate it, no crumbs left ๐
โจ one last thing though โ this was the UNIX version, dated March 1993, and the page goes by GACCUM_TRAN_MATRIX(3NCARG). Byeee, go build something cute with your transformation matrices ๐๐ฆ๐
๐ฆ where this page comes from
- epel 9: ncl-devel 6.6.2-59.el9 ยท LicenseRef-Callaway-BSD
- fedora 43: ncl-devel 6.6.2-58.fc43 ยท LicenseRef-Callaway-BSD
- fedora 44: ncl-devel 6.6.2-62.fc44 ยท LicenseRef-Callaway-BSD
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms