polygons(3U)
β¨ polygons β the structured graphics glow-up for rects & polys β¨
okay so bestie, welcome to polygons(3U) from the InterViews Reference Manual π this is the page about drawing rectangles and polygons in Unidraw, and honestly? it's giving foundational. let's get into it π«Ά
πΈ NAME πΈ
Rect, S_Rect, F_Rect, SF_Rect, Polygon, S_Polygon, F_Polygon, SF_Polygon β structured graphics classes for rectangles and polygons π
β¨ SYNOPSIS β¨
#include <Unidraw/Graphic/polygons.h>
like that's it, that's the include, slay π
π¦ DESCRIPTION π¦
so Rect and Polygon are the abstract base classes for rectangle and polygon structured graphics respectively. no cap. and the way that Rect is derived from Graphic, while Polygon is derived from Vertices? iconic lineage fr fr π
the predefined subclasses are where it gets juicy:
S_Rect,F_Rect, andSF_Rectdraw stroked, filled, and stroked-filled rectangles respectively πS_Polygon,F_Polygon, andSF_Polygondraw stroked, filled, and stroked-filled polygons respectively β¨
and the storage tea β β the stroked subclasses store a PSBrush, the filled subclasses store a PSPattern, and the stroked-filled subclasses store one of each. main character energy honestly π
π RECT PUBLIC OPERATIONS π
void GetOriginal(Coord& x0, Coord& y0, Coord& x1, Coord& y1)β returns the rectangle's geometry exactly as it was specified in the constructor.(x0, y0)defines one corner of the rectangle, and(x1, y1)defines the opposing corner. so like, the og vibes, preserved π
π RECT PROTECTED OPERATIONS π
Rectangle(Coord x0, Coord y0, Coord x1, Coord y1, Graphic* = nil)β okay so this constructor is protected on purpose, to disallow instantiation of the abstract base class (no making a bareRecthappen, bestie, it's not that kind of party π). a rectangle's geometry is defined by two points, corresponding to opposing corners of the rectangle. it also takes an optional graphic from which to obtain an initial set of graphics state β¨void s_getExtent(float&, float&, float&, float&, float&, Graphic*)void f_getExtent(float&, float&, float&, float&, float&, Graphic*)boolean s_contains(PointObj&, Graphic*)boolean f_contains(PointObj&, Graphic*)boolean s_intersects(BoxObj&, Graphic*)boolean f_intersects(BoxObj&, Graphic*)
these are the helper functions π they return extent and hit detection information based on the bounding box that the rectangle defines. s_getExtent, s_contains, and s_intersects return info that accounts for the width of a brush, as would be necessary if the rectangle is stroked β while f_getExtent, f_contains, and f_intersects assumes that the rectangle is filled. subclasses can use these operations to help implement their own getExtent, contains, and intersects operations. teamwork makes the dream work fr π«Ά
π RECT SUBCLASS PUBLIC OPERATIONS π
S_Rect(Coord x0, Coord y0, Coord x1, Coord y1, Graphic* = nil)F_Rect(Coord x0, Coord y0, Coord x1, Coord y1, Graphic* = nil)SF_Rect(Coord x0, Coord y0, Coord x1, Coord y1, Graphic* = nil)
constructors for the various predefined Rect subclasses π pick your fighter: stroked, filled, or both π
π§ POLYGON PROTECTED OPERATIONS π§
Polygon(Coord* x, Coord* y, int count, Graphic* = nil)βPolygon's constructor is protected to prevent instantiation of the abstract base class. and listen, the parameters are passed directly to theVerticesconstructor. no extra steps, no middleman, just straight through π₯
β POLYGON SUBCLASS PUBLIC OPERATIONS β
S_Polygon(Coord* x, Coord* y, int count, Graphic* = nil)F_Polygon(Coord* x, Coord* y, int count, Graphic* = nil)SF_Polygon(Coord* x, Coord* y, int count, Graphic* = nil)
constructors for the various predefined Rect subclasses. (yes bestie, the original really does say Rect here, we are reporting the lore exactly as written, no editing the canon π)
π SEE ALSO π
Graphic(3U), Vertices(3U), geomobjs(3U), pspaint(3U) β go read these next, they're the supporting cast and they ate π
and that's the whole page, babe! this one came from the Unidraw era, dated 2 February 1991 β vintage but still serving β¨ mwah, go draw some rectangles πππ¦
π¦ where this page comes from
- debian bookworm: ivtools-dev 2.0.11d.a1-1+b4
- debian trixie: ivtools-dev 2.0.11d.a1-3+b4
- ubuntu jammy: ivtools-dev 2.0.11d.a1-1build1
- ubuntu noble: ivtools-dev 2.0.11d.a1-3build1
- ubuntu questing: ivtools-dev 2.0.11d.a1-3build7
- ubuntu resolute: ivtools-dev 2.0.11d.a1-3build9
- ubuntu stonking: ivtools-dev 2.1.1+git.2025.07.26.a1-1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms