Provided by: ivtools-dev_1.2.11a1-2_amd64

**NAME**

PointObj, LineObj, BoxObj, MultiLineObj, FillPolygonObj, Extent - helper classes that manage geometric information for structured graphics

**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. PointObj stores a point, LineObj stores two points, and MultiLineObj stores any number of points. BoxObj and FillPolygonObj define rectangular and polygonal areas, respectively. Extent stores 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. All these classes provide operations for computing geometric information.

**POINTOBJ** **PUBLIC** **OPERATIONS**

PointObj(Coord=0,Coord=0)PointObj(PointObj*)Construct a PointObj, supplying either two Coords or another PointObj to specify the instance's coordinates, which are stored in its_xand_ypublic members.floatDistance(PointObj&)Return the distance betweenthisand the given PointObj.

**LINEOBJ** **PUBLIC** **OPERATIONS**

LineObj(Coord=0,Coord=0,Coord=0,Coord=0)LineObj(LineObj*)Construct a LineObj, supplying either two coordinate pairs or another LineObj to specify the instance's endpoints, which are stored in its_p1and_p2public members.booleanContains(PointObj&)booleanIntersects(LineObj&)Return whetherthiscontains the given point and intersects the given line, respectively.intSame(PointObj&p1,PointObj&p2)A helper function used in Intersects. Same returns 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.

**BOXOBJ** **PUBLIC** **OPERATIONS**

BoxObj(Coord=0,Coord=0,Coord=0,Coord=0)BoxObj(BoxObj*)Construct a BoxObj, supplying either two coordinate pairs or another BoxObj to specify the instance's bottom-left and top-right corners, which are stored in its_left,_bottom,_right, and_toppublic members.booleanContains(PointObj&)booleanIntersects(BoxObj&)booleanIntersects(LineObj&)Return whetherthiscontains the given point and intersects the given box or line, respectively.BoxObjoperator-(BoxObj&)BoxObjoperator+(BoxObj&)Compute the intersection (-) or union (+) ofthisand the given box, returning the result. These operations do not affectthisor their argument.booleanWithin(BoxObj&)Returntrueifthisfalls completely within the given box. Within will also returntrueif the boxes are identical.

**MULTILINEOBJ** **PUBLIC** **OPERATIONS**

MultiLineObj(Coord*=nil,Coord*=nil,int=0)Create a MultiLineObj, optionally supplying coordinate arrays (and their size) that define the vertices of the multiline. The MultiLineObj doesnotcopy these arrays but stores them directly. The MultiLineObj stores this information in its_x,_y, and_countpublic members.voidGetBox(BoxObj&)Calculate the bounding box circumscribing the MultiLineObj's vertices and store it in the argument.booleanContains(PointObj&)booleanIntersects(BoxObj&)booleanIntersects(LineObj&)Return whetherthiscontains the given point and intersects the given box or line, respectively.booleanWithin(BoxObj&)Returntrueifthisfalls completely within the MultiLineObj's bounding box. Within will also returntrueif the boxes are identical.voidSplineToMultiLine(Coord*cpx,Coord*cpy,intcount)voidClosedSplineToMultiLine(Coord*cpx,Coord*cpy,intcount)Linearize the open or closed B-Spline defined by the given set of control points and store the result inthis. These operations store the linearized result in internal buffers and assign the addresses of these buffers to_xand_y; they donotdelete_xand_yif they are non-nil prior to assignment.

**MULTILINEOBJ** **PROTECTED** **OPERATIONS**

voidGrowBuf()Increase the size of the internal buffers used to store linearized splines.booleanCanApproxWithLine(doublex0,double,y0,doublex1,doubley1,doublex2,doubley2)Return whether two connected line segments defined by the given three points can be approximated visually with a single line between the endpoints.voidAddLine(doublex0,doubley0,doublex1,doubley1)Add a line to the internal buffer of vertices.voidAddBezierArc(doublex0,doubley0,doublex1,doubley1,doublex2,doubley2,doublex3,doubley3)Add lines approximating the appearance of a Bezier arc defined by the given points to the internal buffer of vertices.voidCalcSection(Coordcminus1x,Coordcminus1y,Coordcx,Coordcy,Coordcplus1x,Coordcplus1y,Coordcplus2x,Coordcplus2y)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 new FillPolygonObj, optionally specifying its vertices. If vertices are supplied, then the constructor uses Normalize (described below) to store a normalized set of vertices in the FillPolygonObj's_normx,_normy, and_normCountpublic members. FillPolygonObj is a subclass of MultiLineObj; thus it stores the constructor arguments in its_x,_y, and_countpublic members.virtual~FillPolygonObj()The destructor deletes the_normxand_normyarrays.booleanContains(PointObj&)booleanIntersects(BoxObj&)booleanIntersects(LineObj&)Return whetherthiscontains the given point and intersects the given box or line, respectively.

**FILLPOLYGONOBJ** **PROTECTED** **OPERATIONS**

voidNormalize()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.

**EXTENT** **PUBLIC** **OPERATIONS**

Extent(floatleft=0,floatbottom=0,floatcx=0,floatcy=0,floattol=0)Extent(Extent&)Construct a new Extent, optionally supplying its parameters explicitly or providing a existing Extent to copy. The parameters are stored in the Extent's_left,_bottom,_cx,_cy, and_tolpublic members.booleanUndefined()Return whether the extent is undefined, that is, if (_left,_bottom) and (_cx,_cy) are the same point.booleanWithin(Extent&)Returntrueif the given extent circumscribesthis. Within will also returntrueif the extents are identical.voidMerge(Extent&)Enlarge this extent to subsume area of the given extent.

**SEE** **ALSO**

Graphic(3U)