Polygon

Polygon[{p1,,pn}]

represents a filled polygon with points pi.

Polygon[{p1,,pn}{{q1,,qm},}]

represents a polygon with holes {q1,,qm},.

Polygon[{poly1,poly2,}]

represents a collection of polygons polyi.

Polygon[{p1,,pn},data]

represents a polygon in which coordinates given as integers i in data are taken to be pi.

Details and Options

  • Polygon can be used as a geometric region and a graphics primitive.
  • Polygon[{p1,,pn}] is a plane region, representing all the points inside the closed curve with line segments {p1,p2},,{pn-1,pn} and {pn,p1}.
  • A point is an element of the polygon if a ray from the point in any direction in the plane crosses the boundary line segments an odd number of times.
  • Polygon[{p1,,pn}{{q1,,qm},}] specifies a polygon with holes consisting of an outer polygon Polygon[{p1,,pn}] and one or several inner polygons Polygon[{q1,,qm}],.
  • A point is an element of the polygon if it is in the outer polygon but not in any inner polygon.
  • Polygon[{poly1,poly2,}] is a collection of polygons polyi with or without holes and is treated as a union of polyi for geometric computations.
  • Polygon[{p1,,pn},data] effectively replaces integers i that appear as coordinates in data by the corresponding pi.
  • Polygon[{p1,,pn},{b1,,bn}]polygon boundary points {pb1,,pbk}
    Polygon[{p1,,pn},{{o1,,ok}{{i1,,il},}]outer polygon boundary points {po1,,pok} and inner polygon boundary {pi1,,pil} etc.
    Polygon[{p1,,pn},{{b1,,bn},{o1,,ok}{{i1,,il},},}]a collection of several polygons
  • As a geometric region, the points pi can have any embedding dimension, but must all lie in a plane and have the same embedding dimension.
  • In a graphic, the points pi can be Scaled, Offset, ImageScaled and Dynamic expressions.
  • Graphics rendering is affected by directives such as FaceForm, EdgeForm, Texture, Specularity, Opacity and color.
  • FaceForm[front,back] can be used to specify different styles for the front and back of polygons in 3D. The front is defined by the right-hand rule and the direction of the first three points.
  • The following options and settings can be used in graphics:
  • VertexColors Automaticvertex colors to be interpolated
    VertexNormals Automaticeffective vertex normals for shading
    VertexTextureCoordinates Nonecoordinates for textures
  • Polygon can be used with symbolic points in GeometricScene.

Examples

open allclose all

Basic Examples  (2)

A polygon:

Its graphic image:

Its area:

Differently styled 3D polygons:

Scope  (21)

Graphics  (11)

Specification  (2)

A collection of polygons:

Polygons with multiple vertices:

Styling  (6)

Color directives specify the face colors of polygons:

Texture can be used to specify a texture to be used on the faces of polygons:

Texture can work together with different Opacity:

Texture can work together with different Lighting:

FaceForm and EdgeForm can be used to specify the styles of the interiors and boundaries:

In 3D, different properties can be specified for the front and back of faces using FaceForm:

Use FaceForm to set front and back textures differently in 3D:

Colors can be specified at vertices using VertexColors:

Normals can be specified at vertices using VertexNormals for 3D polygons:

Coordinates  (3)

Use Scaled coordinates:

Use ImageScaled coordinates in 2D:

Use Offset coordinates in 2D:

Regions  (10)

Embedding dimension:

Geometric dimension:

Point membership test:

Get conditions for point membership:

Area:

Centroid:

Distance from a point:

Plot it:

Signed distance from a point:

Plot it:

Nearest point in the region:

Nearest points:

A polygon is bounded:

Get its range:

Integrate over a polygon:

Optimize over a polygon:

Solve equations in a polygon:

Options  (7)

VertexColors  (2)

Polygon with vertex colors:

Specify vertex colors for 3D polygons:

VertexNormals  (1)

Compute normal vectors using the cross product of edge vectors:

A triangle with normals pointing in the direction {1,-1,1}:

Using different normals will affect shading:

VertexTextureCoordinates  (4)

Texture-mapped polygon:

Texture mapping with 2D polygons:

Texture mapping with 3D polygons:

Repeat a texture by using non-unified texture coordinate values:

Texture mapping is preceded by VertexColors:

Applications  (3)

Define a polygon with vertices:

Regular polygons:

Star polygons:

Define the regular hexagon:

Regular hexagonal tiling:

Get face polygons from PolyhedronData:

Shrink each face with respect to the centroid:

Properties & Relations  (4)

GraphicsComplex offers an efficient way to generate a polygon with many shared vertices:

Applying Normal to the graphics complex produces ordinary polygons:

Polygon is a generalization of Triangle:

Polygon is a generalization of Rectangle:

A Simplex with three vertices is a special case of Polygon:

In any number of dimensions starting from 2:

Possible Issues  (3)

In 3D, if the vertices are not in a plane, the polygon triangulation can be unpredictable:

Degenerate polygons are not valid geometric regions:

Seams can sometimes appear between individual polygons as a result of antialiasing:

Using a single polygon object avoids any seams:

Neat Examples  (3)

Random triangle collections:

Digital petals:

A rotating star:

Wolfram Research (1988), Polygon, Wolfram Language function, https://reference.wolfram.com/language/ref/Polygon.html (updated 2019).

Text

Wolfram Research (1988), Polygon, Wolfram Language function, https://reference.wolfram.com/language/ref/Polygon.html (updated 2019).

CMS

Wolfram Language. 1988. "Polygon." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2019. https://reference.wolfram.com/language/ref/Polygon.html.

APA

Wolfram Language. (1988). Polygon. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Polygon.html

BibTeX

@misc{reference.wolfram_2024_polygon, author="Wolfram Research", title="{Polygon}", year="2019", howpublished="\url{https://reference.wolfram.com/language/ref/Polygon.html}", note=[Accessed: 19-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_polygon, organization={Wolfram Research}, title={Polygon}, year={2019}, url={https://reference.wolfram.com/language/ref/Polygon.html}, note=[Accessed: 19-December-2024 ]}