### IGPolygon2D

  An IGPolygon2D defines a collection of points connected with straight line segments; the area it defines is automatically closed.

  An IGPolygon2D object is area-enclosing geometry that may be filled or filled and framed. Setting the Boolean flag EOFill to TRUE specifies that an even-odd rule is used for determining what area is filled; setting it to FALSE specifies that a nonzero winding rule is used. IRawArray does not check whether allocation is successful. Therefore, before you construct an object of class IGPolygon2D, check to ensure that there is enough memory and use a reasonable size.

### IGPolygon2D - Member Functions and Data by Group

### Constructors & Destructor

Use the functions in this group to construct and destroy objects of class IGPolygon2D.

~IGPolygon2D

      public:
      virtual ~IGPolygon2D()

  Destroys the polygon of class IGPolygon2D.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

IGPolygon2D
  Constructs a polgyon of class IGPolygon2D.

  Overload 1
  Creates a polygon with the specified number of points and the specified fill rule.

      public:
      IGPolygon2D(unsigned long numPoints, bool EOFill = true)

  Use this constructor to create a polygon with the given number of points and fill rule. For this constructor, the number of points are specified as an unsigned long value.

  numPoints
    The number of points in the polygon.
  EOFill = true
    The fill rule.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 2
  Creates a polygon with the specified IGRect2D and fill.

      public:
      IGPolygon2D(const IGRect2D& g, bool EOFill = true)

  Use this constructor to create a polygon from the given 2D rectangle and fill rule values.

  g
    The rectangle to be copied.
  EOFill = true
    The fill rule.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 3
  Creates a polygon with number of points equal to zero.

      public:
      IGPolygon2D()

  Use this constructor to create an empty polygon, that is, a polygon with zero points.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 4
  Copy constructor.

      public:
      IGPolygon2D(const IGPolygon2D&)

  Use this constructor to create a polygon that is copied from the given one.

  const IGPolygon2D&
    The polygon to be copied.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 5
  Creates a polygon using the given number of points and fill rule values.

      public:
      IGPolygon2D(const IGPoint2DArray& pts, bool EOFill = true)

  Use this constructor to create a polygon with the given number of points and fill rule. For this constructor, the points are specified through an IGPoint2DArray.

  pts
    The array of points that make up the polygon.
  EOFill = true
    The fill rule.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Assignment Operator

Use this function to assign the given polygon.

operator =

      public:
      IGPolygon2D& operator =(const IGPolygon2D& Src)

  Assignment operator.

  Src
    The polygon to be copied.

Return
  A non-const reference to the left-hand side object.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Obtaining Information About the Polygon

Use the functions in this group to obtain information about a polygon, such as whether it is convex, whether it is comprised entirely of straight lines, whether it contains a given point, what its fill algorithm is, and whether it intersects a given rectangle.

contains

      public:
      bool contains(const IGPoint2D& p) const

  Tests whether the polygon contains the given IGPoint2D point.

  p
    The point to test for within the polygon.

Return
  TRUE if the polygon contains the given point.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

intersects

      public:
      bool intersects(const IGRect2D& g) const

  Tests whether the polygon intersects the given rectangle.

  g
    The rectangle to test for intersection.

Return
  TRUE if the polygon intersects the given rectangle.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

isConvex

      public:
      bool isConvex() const

  Tests whether the polygon is convex.

Return
  TRUE if the polygon is convex.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

isRectilinear

      public:
      bool isRectilinear() const

  Tests whether the polygon is comprised completely of straight lines.

Return
  TRUE if the polygon is comprised completely of straight lines.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Setting and Getting the Fill

Use the functions in this group to set and get the fill factor for the polygon.

eOFill

      public:
      bool eOFill() const

  Returns a Boolean specifying the filling algorithm.

Return
  TRUE if the filling algorithm is the even-odd rule.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

setEOFill

      public:
      void setEOFill(bool EOFill)

  Sets the flag that specifies the filling algorithm.

  EOFill
    The flag indicating the filling algorithm. Use true for the even-odd rule or false for the nonzero window number rule.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Streaming an Object In and Out

Use the functions and operators in this group to stream the polygon object in and out. The functions are readFromStream and writeToStream. The operators are operator >>= and operator <<=.

operator <<=

      public:
      IDataStream& operator <<=(IDataStream&)

  Operator that streams in the polygon object using the given polymorphic stream.

  IDataStream
    The stream used to stream in the polygon.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

operator >>=

      public:
      IDataStream& operator >>=(IDataStream&) const

  Operator that streams out the polygon object using the polymorphic stream.

  IDataStream
    The stream used to stream out the polygon.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

readFromStream

      public:
      void readFromStream(IDataStream& toWhere)

  Streams in the polygon object using the polymorphic streaming specified by fromWhere.

  fromWhere
    The stream used to stream in the polymorphic object.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

writeToStream

      public:
      void writeToStream(IDataStream& toWhere) const

  Streams out the polygon object using the polymorphic stream specified by toWhere.

  toWhere
    The stream used to stream out the polygon.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Testing Two Polygons for Equality and Inequality

Use the functions in this group to test two polygons for equality or inequality.

operator !=

      public:
      bool operator !=(const IGPolygon2D& Src) const

  Tests whether the two polygons are not equal.

  Src
    The polygon to be compared to this one.

Return
  TRUE if the two polygons are not equal.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

operator ==

      public:
      bool operator ==(const IGPolygon2D& Src) const

  Tests whether the two polygons are equal.

  Src
    The polygon to be compared to this one.

Return
  TRUE if the two polygons are equal.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### IGPolygon2D - Inherited Member Functions and Data

#### Inherited Public Functions

  IGPolyline2D

  -     virtual ~IGPolyline2D()

  -     void
          addBefore( unsigned long index,
                     const IGPoint2D& tobeadded )

  -     void append(const IGPoint2D& p)

  -     IGRect2D bounds() const

  -     void
          dragPosition( GCoordinate parametric,
                        const IGPoint2D& toPoint )

  -     IGPoint2D evaluate(GParametric u) const

  -     IGPolyline2D(const IGPoint2DArray& points)

  -     IGPolyline2D()

  -     IGPolyline2D(unsigned long numPoints)

  -     IGPolyline2D(const IGPolyline2D&)

  -     GParametric nearestParametric(const IGPoint2D& p) const

  -     unsigned long numberOfPoints() const

  -     bool operator !=(const IGPolyline2D& Src) const

  -     IGPolyline2D& operator =(const IGPolyline2D& Src)

  -     bool operator ==(const IGPolyline2D& Src) const

  -     IGPoint2D point(unsigned long index) const

  -     void points(IGPoint2DArray& pts) const

  -     void removePoint(unsigned long index)

  -     void reverseDirection()

  -     void setPoint(unsigned long index, const IGPoint2D& p)

  -     void setPoints(const IGPoint2DArray& newPoints)

  -     void transformBy(const IGrafMatrix& transform)

#### Inherited Public Data

  - None

#### Inherited Protected Functions

  - None

#### Inherited Protected Data

  - None