GACCUM_TRAN_MATRIX(3NCARG)

๐Ÿ“ฆ version 6.6.2, in epel 9, fedora 43, fedora 44

๐Ÿ’… 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) โ€” a 2x3 GKS 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.x is either in world coordinates or normalized device coordinates depending on how the argument coord_switch is 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 as point.x: it's either in world coordinates or normalized device coordinates depending on how coord_switch is 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_x is either in world coordinates or normalized device coordinates depending on the setting of coord_switch described 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 on coord_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 arguments point and shift (both described above, keep up ๐Ÿ’–) are in world coordinates or normalized device coordinates. The possible values include:
    • GCOORD_WC โ€” World coordinates
    • GCOORD_NDC โ€” Normalized device coordinates
  • tran_matrix (Gfloat, Output) โ€” a 2x3 array that holds the GKS transformation matrix in a form you can feed straight into other GKS functions, like gset_seg_tran. This matrix gets constructed by composing the scale, rotate, and shift input (all described above) with the original input matrix t_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 (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