---
name: "polygons"
section: "3"
platform: "linux"
package: "ivtools-dev"
version: "1.1.3-4"
release: "Debian 3.1 (Sarge)"
platforms: ["linux"]
url: "https://new.carta.tech/polygons"
---

# polygons(3)

structured graphics classes for rectangles and polygons

## 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\>**

## DESCRIPTION

Rect and Polygon serve as abstract base classes for rectangle and polygon structured graphics.  They are derived from Graphic and Vertices, respectively.  Predefined subclasses include S\_Rect, F\_Rect, and SF\_Rect, which draw stroked, filled, and stroked-filled rectangles, respectively; and S\_Polygon, F\_Polygon, and SF\_Polygon, which draw stroked, filled, and stroked-filled polygons, respectively. The stroked subclasses store a PSBrush, the filled subclasses store a PSPattern, and the stroked-filled subclasses store one of each.

## RECT PUBLIC OPERATIONS

- **void GetOriginal(Coord& x0, Coord& y0, Coord& x1, Coord& y1)**

  Return the rectangle's geometry, as specified in the constructor. (*x0, y0*) defines one corner of the rectangle, while (*x1*, *y1*) defines the opposing corner.

## RECT PROTECTED OPERATIONS

- **Rectangle(Coord x0, Coord y0, Coord x1, Coord y1, Graphic\* = nil)**

  The constructor is protected to disallow instantiation of the abstract base class.  A rectangle's geometry is defined by two points, corresponding to opposing corners of the rectangle.  The constructor 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\*)**

  Helper functions that return extent and hit detection information based on the bounding box that the rectangle defines.  s\_getExtent, s\_contains, and s\_intersects return information 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 the operations to help implement their getExtent, contains, and intersects operations.

## 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.

## 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.  The parameters are passed directly to the Vertices constructor.

## 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.

## SEE ALSO

Graphic(3U), Vertices(3U), geomobjs(3U), pspaint(3U)
