GFA(3NCARG)
π NAME π
GFA (aka Fill area) β the output primitive that literally fills polygonal areas, no cap. It's giving "color inside the lines" but make it Unix β¨
π SYNOPSIS π
CALL GFA (N, X, Y)
πΈ C-BINDING SYNOPSIS πΈ
#include <ncarg/gks.h>
void gfill_area(const Gpoint_list *point_list);
β¨ DESCRIPTION β¨
N(Integer, Input) β bestie, this is the number of points in the polygon you wanna fill. Heads up:Nmust be greater than two. Two points is not a polygon, it's a line, and we don't do that here πX (N)(Real Array, Integer) β the X world coordinates of the polygon, allNof them.Y (N)(Real Array, Integer) β the Y world coordinates of the polygon. Same energy, different axis π¦
π₯ USAGE π₯
So the area that gets filled? It's 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 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)). Like, if you already closed the loop yourself, she's not gonna double-close it. She's respectful like that π«Ά
Now here's the messy part, and honestly it's kind of iconic. When you hand her a polygon whose edges cross each other, it becomes ambiguous as to what actually counts as the "inside" of the polygon. Like, is that a bow or a pretzel? Nobody knows. So the algorithm used in GKS is as follows: for a given point, draw a ray starting at that point and going to infinity in any direction. If the number of intersections between the ray and the polygon is odd</>, the point is within the polygon, otherwise it's outside. Simple. Demure. Mindful.
Oh and if the straight line passes through a polygon vertex tangentially, the intersection count is not affected β she's not gonna let a graze ruin the vibe check. And if a point is within the polygon, it is included in the area to be filled. Periodt. π
Several interior styles (hollow, solid, and various hatch patterns) can be selected, so you have options, queen π See the man pages for gsfais and gsfasi for these.
Note well, and I mean it: By default in GKS, the interior fill style is hollow, or no fill. So if you callGFAand do not get a filled interior as you expected, you will probably need to callGSFAISto set the fill style to something other than"hollow". Not me spending an hour debugging an empty polygon π It's always GSFAIS. It's literally always GSFAIS.
π§ ACCESS π§
To use GKS routines, load the NCAR GKS-0A library ncarg_gks. That's the whole assignment bestie, go get it β
π 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 π
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 that π this was NCAR Graphics, GFA(3NCARG), straight outta the UNIX manual and dated March 1993 β vintage but she still serves β¨ bye bestie, go fill some polygons π
π¦ 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