geomobjs(3U)
πΈ NAME πΈ
PointObj, LineObj, BoxObj, MultiLineObj, FillPolygonObj, Extent β helper classes that manage geometric information for structured graphics
okay so bestie, welcome to geomobjs(3U) π this is straight out of the InterViews Reference Manual, section 3U, and it's literally the little squad of classes that hold all the geometry for you. let's get into it β¨
π SYNOPSIS π
#include <Unidraw/Graphic/geomobjs.h>
β¨ DESCRIPTION β¨
Unidraw defines several helper classes that store and manage geometric information. Structured graphics objects may use these helper classes to support their semantics. No cap.
PointObjstores a point π«ΆLineObjstores two pointsMultiLineObjstores any number of pointsBoxObjandFillPolygonObjdefine rectangular and polygonal areas, respectivelyExtentstores extent information β that is, the lower left corner and center of a bounding box, plus a fixed amount of extra space around the bounding box
and literally all of these classes provide operations for computing geometric information. it's giving math girlie, and she ate π
π POINTOBJ PUBLIC OPERATIONS π
PointObj(Coord = 0, Coord = 0),PointObj(PointObj*)β construct aPointObj, supplying either twoCoords or anotherPointObjto specify the instance's coordinates. those coords get stored in its_xand_ypublic members πfloat Distance(PointObj&)β return the distance between this and the givenPointObj. that's it. that's the whole job πΈ
π LINEOBJ PUBLIC OPERATIONS π
LineObj(Coord = 0, Coord = 0, Coord = 0, Coord = 0),LineObj(LineObj*)β construct aLineObj, supplying either two coordinate pairs or anotherLineObjto specify the instance's endpoints. those endpoints live in its_p1and_p2public members πboolean Contains(PointObj&),boolean Intersects(LineObj&)β return whether this contains the given point, and whether it intersects the given line, respectively. two for one, we love a bundle β¨int Same(PointObj& p1, PointObj& p2)β a helper function used inIntersects.Samereturns a positive value ifp1andp2fall on the same side of the line, 0 if both points fall on the line, or a negative value if the points are on opposite sides of the line. sign-coded fr fr π
π§ BOXOBJ PUBLIC OPERATIONS π§
BoxObj(Coord = 0, Coord = 0, Coord = 0, Coord = 0),BoxObj(BoxObj*)β construct aBoxObj, supplying either two coordinate pairs or anotherBoxObjto specify the instance's bottom-left and top-right corners. they're stored in its_left,_bottom,_right, and_toppublic members π¦boolean Contains(PointObj&),boolean Intersects(BoxObj&),boolean Intersects(LineObj&)β return whether this contains the given point, and whether it intersects the given box or line, respectively π¦BoxObj operator - (BoxObj&),BoxObj operator + (BoxObj&)β compute the intersection (-) or union (+) of this and the given box, returning the result. these operations do not affect this or their argument β they're not out here mutating anybody, they're just doing the math and handing you the answer πboolean Within(BoxObj&)β returntrueif this falls completely within the given box.Withinwill also returntrueif the boxes are identical. twins!! π―
π MULTILINEOBJ PUBLIC OPERATIONS π
MultiLineObj(Coord* = nil, Coord* = nil, int = 0)β create aMultiLineObj, optionally supplying coordinate arrays (and their size) that define the vertices of the multiline.
β οΈ real talk: the MultiLineObj does not copy these arrays β it stores them directly. so like, don't go freeing them behind its back, iykyk π
the MultiLineObj stores this information in its _x, _y, and _count public members.
void GetBox(BoxObj&)β calculate the bounding box circumscribing theMultiLineObj's vertices and store it in the argument πboolean Contains(PointObj&),boolean Intersects(BoxObj&),boolean Intersects(LineObj&)β return whether this contains the given point, and whether it intersects the given box or line, respectively πboolean Within(BoxObj&)β returntrueif this falls completely within theMultiLineObj's bounding box.Withinwill also returntrueif the boxes are identical πΈvoid SplineToMultiLine(Coord* cpx, Coord* cpy, int count),void ClosedSplineToMultiLine(Coord* cpx, Coord* cpy, int count)β linearize the open or closed B-Spline defined by the given set of control points and store the result in this. these operations store the linearized result in internal buffers and assign the addresses of these buffers to_xand_y; they do not delete_xand_yif they are non-nil prior to assignment π
π MULTILINEOBJ PROTECTED OPERATIONS π
void GrowBuf()β increase the size of the internal buffers used to store linearized splines. glow-up for your buffers β¨boolean CanApproxWithLine(double x0, double, y0, double x1, double y1, double x2, double y2)β return whether two connected line segments defined by the given three points can be approximated visually with a single line between the endpoints πvoid AddLine(double x0, double y0, double x1, double y1)β add a line to the internal buffer of vertices ποΈvoid AddBezierArc(double x0, double y0, double x1, double y1, double x2, double y2, double x3, double y3)β add lines approximating the appearance of a Bezier arc defined by the given points to the internal buffer of vertices π’void CalcSection(Coord cminus1x, Coord cminus1y, Coord cx, Coord cy, Coord cplus1x, Coord cplus1y, Coord cplus2x, Coord cplus2y)β add a Bezier arc to the internal buffer of vertices based on a series of four B-spline control points: the one before and the two after (cx,cy) π«
π FILLPOLYGONOBJ PUBLIC OPERATIONS π
FillPolygonObj(Coord* = nil, Coord* = nil, int = 0)β create a newFillPolygonObj, optionally specifying its vertices. if vertices are supplied, then the constructor usesNormalize(described below) to store a normalized set of vertices in theFillPolygonObj's_normx,_normy, and_normCountpublic members.FillPolygonObjis a subclass ofMultiLineObj; thus it stores the constructor arguments in its_x,_y, and_countpublic members π§virtual ~FillPolygonObj()β the destructor deletes the_normxand_normyarrays. clean up after yourself bestie π§Ήboolean Contains(PointObj&),boolean Intersects(BoxObj&),boolean Intersects(LineObj&)β return whether this contains the given point, and whether it intersects the given box or line, respectively π
π¨ FILLPOLYGONOBJ PROTECTED OPERATIONS π¨
void Normalize()β copy the vertices defined by_x,_y, and_countinto_normx,_normy, and_normCountsuch that (_normx[0],_normy[0]) is the lower-leftmost vertex and there are no redundant vertices. tidy, organized, main character energy π
π« EXTENT PUBLIC OPERATIONS π«
Extent(float left = 0, float bottom = 0, float cx = 0, float cy = 0, float tol = 0),Extent(Extent&)β construct a newExtent, optionally supplying its parameters explicitly or providing an existingExtentto copy. the parameters are stored in theExtent's_left,_bottom,_cx,_cy, and_tolpublic members π«Άboolean Undefined()β return whether the extent is undefined, that is, if (_left,_bottom) and (_cx,_cy) are the same point. if the corner and the center are the same spot... yeah girl, that's undefined πboolean Within(Extent&)β returntrueif the given extent circumscribes this.Withinwill also returntrueif the extents are identical π―void Merge(Extent&)β enlarge this extent to subsume area of the given extent. absorbing, periodt π«§
π SEE ALSO π
Graphic(3U)
and that's the whole page, bestie!! you're officially fluent in geometry helper classes π β¨
this lil love letter came to you from Unidraw, dated 2 February 1991 π go forth and compute geometric information, queen ππ
π¦ 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