55. plugins.polygon — Polygonal facets.

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

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.


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.

Return the number of points and edges.


Return the vectors from each point to the next one.


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


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.


Check if the polygon is convex and turning anticlockwise.


  • +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.

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


Return the Polygon with reversed order of vertices.


Fill the surface inside the polygon with triangles.

Returns a TriSurface filling the surface inside the polygon.


Compute area inside a polygon.

55.1. Functions defined in module plugins.polygon

plugins.polygon.projected(X, N)[source]

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.