Skip to main content

Polygon

WLJS
Wolfram Kernel
Execution environment

a 3D version of Polygon used in Graphics3D

Polygon[vertices_List | {vertices__List} | faces_List]

represents a single or a list of polygons

Types

Triangle

The most efficient one. It consists of 3 vertices

pol = Polygon[{{1, 0, 0}, {1, 1, 1}, {0, 0, 1}}];
pol // Graphics3D

Quad

4 vertices. It will be converted to the set of triangles on output

Pentagon

5 vertices. It will be converted to the set of triangles on output

Parameters

RGBColor

Opacity

Faces

The most efficient way of using Polygon for constructing complex objects is to wrap it into GraphicsComplex. It provides the list of faces and colors of each vertex as separate lists, while Polygon contains only the indexes, which forms each polygon

v = PolyhedronData["Dodecahedron", "Vertices"] // N;
i = PolyhedronData["Dodecahedron", "FaceIndices"];

GraphicsComplex[v, Polygon[i]] // Graphics3D

Dynamic updates

It is possible only using GraphicsComplex and keeping faces unchanged.