# 55. `plugins.polygon` — Polygonal facets.

class `plugins.polygon.``Polygon`(border, normal=2, holes=[])

  A Polygon is a flat surface bounded by a closed PolyLine.

  The border is specified as a Coords object with shape (nvertex,3) specifying the vertex coordinates in order. While the Coords are 3d, only the first 2 components are used.

  `nelems`()

    Return the number of elements in the Geometry.

    Returns: | int – The number of elements in the Geometry. This is an abstract method that should be reimplemented by the derived class.

  `npoints`()

    Return the number of points and edges.

  `vectors`()

    Return the vectors from each point to the next one.

  `angles`()

    Return the angles of the line segments with the x-axis.

  `externalAngles`()

    Return the angles between subsequent line segments.

    The returned angles are the change in direction between the segment ending at the vertex and the segment leaving. The angles are given in degrees, in the range ]-180,180]. The sum of the external angles is always (a multiple of) 360. A convex polygon has all angles of the same sign.

  `isConvex`()

    Check if the polygon is convex and turning anticlockwise.

    Returns:

    - +1 if the Polygon is convex and turning anticlockwise,
    - -1 if the Polygon is convex, but turning clockwise,
    - 0 if the Polygon is not convex.
  `internalAngles`()

    Return the internal angles.

    The returned angles are those between the two line segments at each vertex. The angles are given in degrees, in the range ]-180,180]. These angles are the complement of the

  `reverse`()

    Return the Polygon with reversed order of vertices.

  `fill`()

    Fill the surface inside the polygon with triangles.

    Returns a TriSurface filling the surface inside the polygon.

  `area`()

    Compute area inside a polygon.

## 55.1. Functions defined in module plugins.polygon

`plugins.polygon.``projected`(X, N)

  Returns 2-D coordinates of a set of 3D coordinates.

  The returned 2D coordinates are still stored in a 3D Coords object. The last coordinate will however (approximately) be zero.