GFA(3NCARG)

✨ GFA ✨ β€” the fill-a-polygon glow-up πŸŽ€

okay bestie, welcome to GFA, a lil routine from the NCAR Graphics crew (that's the 3NCARG manual, bestie, we're fancy) πŸ’…. She's the output primitive that fills up polygonal areas β€” like, you hand her a shape and she colors it in. Very coloring-book, very main character. πŸ–οΈβœ¨


NAME

GFA β€” output primitive for filling polygonal areas. That's it, that's her whole job description. πŸ’–


SYNOPSIS

CALL GFA (N, X, Y)

C-BINDING SYNOPSIS

for my C girlies 🫢 (yes there's a C version, we're inclusive here):

#include <ncarg/gks.h>

void gfill_area(const Gpoint_list *point_list);

DESCRIPTION

here's the tea on the arguments, no cap β˜•:

  • N β€” (Integer, Input) β€” how many points are in the polygon you wanna fill. N must be greater than two. fr fr, a polygon needs at least three points, you cannot vibe-check a shape with two dots, it's giving line segment πŸ’€
  • X (N) β€” (Real Array, Integer) β€” the X world coordinates of the polygon. the whole squad of them. πŸ’œ
  • Y (N) β€” (Real Array, Integer) β€” the Y world coordinates of the polygon. matching set, obviously. πŸ’œ

USAGE

so the area that gets filled is delimited by the sequence of straight line segments connecting the successive points (X(1), Y(1)), (X(2), Y(2)), ..., (X(N), Y(N)). πŸ¦‹

and then β€” plot twist β€” the last point in the polygon gets connected back to the first point with a straight line segment, but only in the case that (X(N), Y(N)) does not equal (X(l), Y(l)). so if you don't close the loop yourself, she'll close it for you. she's thoughtful like that. πŸŽ€

okay but what even IS the "inside" tho 😭

real talk: if you hand her a polygon whose edges cross each other, it gets ambiguous as to what counts as the "inside" of the polygon. messy. chaotic. the algorithm used in GKS handles it like this:

for a given point, draw a ray starting at that point and going to infinity in any direction. then count the intersections:

  • if the number of intersections between the ray and the polygon is odd β†’ the point is within the polygon 🌸
  • otherwise β†’ it is outside πŸ™ˆ

and one lil caveat: if the straight line passes through a polygon vertex tangentially, the intersection count is not affected. noted. πŸ’…

so if a point is within the polygon, it gets included in the area to be filled. simple as that, periodt. ✨

styles, styles, styles πŸ’–

several interior styles can be selected β€” hollow, solid, and various hatch patterns. she contains multitudes. πŸ‘‘

for those, go read the man pages for gsfais and gsfasi. iykyk.

note well, bestie, this one MATTERS: by default in GKS, the interior fill style is hollow, or no fill. so if you call GFA and do not get a filled interior as you expected, you will probably need to call GSFAIS to set the fill style to something other than "hollow". like. she's not broken, she's just not filled in yet. go tell her what you want. πŸ˜­πŸ’€

ACCESS

to use GKS routines, load the NCAR GKS-0A library ncarg_gks. that's the whole vibe check. πŸ”₯


SEE ALSO

Online: gsfais, gsfasi, gscr, gsfaci, gqfais, gqfasi, gfill_area

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.


and that's the whole page, bestie!! 🫢✨ this was the GFA(3NCARG) manual, coming at you from the UNIX corner of the world, dated March 1993 β€” yes she's vintage, yes she still slays, we love a timeless icon πŸ‘‘πŸ’– mwah, go fill some polygons πŸ’…πŸŒˆ