Polygons are used in many domains, including graphics to represent general shapes, geometry to represent regions and geography to represent areas. Polygons are simple yet powerful enough to approximate essentially any 2D shape.  The Wolfram Language provides comprehensive support for polygon representation, visualization and computation. All the common definitions of polygons can easily be used, and polygons are deeply integrated in the system, including graphics, geometry and geography.

Polygon polygon or collection of polygons with or without holes

Graphics »

Graphics, Graphics3D visualize polygons in 2D and 3D with different styles

GraphicsComplex  ▪  VertexColors  ▪  VertexNormals  ▪  EdgeForm  ▪  FaceForm

Polygon Representation

CanonicalizePolygon convert to a canonical polygon representation

PolygonCoordinates  ▪  OuterPolygon  ▪  InnerPolygon

Triangle  ▪  Rectangle  ▪  Parallelogram  ▪  RegularPolygon  ▪  Simplex

SSSTriangle  ▪  SASTriangle  ▪  ASATriangle  ▪  AASTriangle

Alternate Polygon Constructors

CrossingPolygon a polygon defined by ray crossing count

WindingPolygon a polygon defined by winding count

CrossingCount  ▪  WindingCount

General Polygon Classes

RandomPolygon generate different classes of random polygons (convex, simple, etc.)

PolygonDecomposition decompose a polygon into different classes of polygons

SimplePolygonQ  ▪  ConvexPolygonQ

Measures »

Area give the area of a polygon

Perimeter give the perimeter of a polygon

RegionMeasure  ▪  RegionCentroid  ▪  RegionMoment  ▪  MomentOfInertia  ▪  ...

Operations »

RegionUnion, RegionIntersection union, intersection operations on polygons

Rotate, Translate, Scale geometric transformations of polygons

RegionDifference  ▪  BooleanRegion  ▪  TransformedRegion  ▪  ...


RegionMember test membership or give conditions for membership

RegionEqual  ▪  RegionDisjoint  ▪  RegionWithin  ▪  RandomPoint

Distance »

RegionDistance minimum distance from a point to a polygon

RegionNearest  ▪  SignedRegionDistance  ▪  ...

Mesh Parts & Components »

MeshCells vertices, edges and faces of the polyhedron

ConnectedMeshComponents split a polyhedron into connected components

MeshPrimitives  ▪  MeshCellCount  ▪  DimensionalMeshComponents  ▪  ...

Region Representation »

Region geometric representation and automatic visualization of polygons

ImplicitRegion  ▪  RegionBounds  ▪  ConstantRegionQ  ▪  BoundingRegion  ▪  ...

Solving with Polygons »

Solve find curve crossings etc.

NSolve  ▪  Reduce  ▪  Minimize  ▪  NMinimize  ▪  Integrate  ▪  NIntegrate  ▪  ...

Import and Export »

"PLY" import and export polygons

"STL"  ▪  "OBJ"  ▪  "OFF"  ▪  "DXF"  ▪  ...