Command: polygon

Syntax

{<entity> = } polygon {
    <pcommand>
    ...
}

Description

Create a polygon graphic entity.

Parameters

Switches

Notes

This command always creates a graphic entity. Duplicate consecutive vertices are ignored.

The symbology of polygon egdes may be changed by using relevant assignments within the command block, e.g. def_color=blue.

During edge definition, a vector phrase beginning with a @ will indicate a n invisible edge. A phrase beginning with $ indicates a line styled edge, using line style def_ls. If neither prefix is present, the line style given by the -ls switch will be used. Warnings are given if polygon edges cross or when slivers are detected.

Examples

Create an unnamed triangular polygon entity.

polygon {gc, e:1000, w:500&n:500, r}

Create an unnamed polygon entity, whose edges are defined interactively.

polygon -col=red, -fil=green, -pc {
    pseries; # Command
    r; # Point phrase "return to start"
}

Create a named polygon entity in a command block. The polygon is a regular polygon of 2000 edges.

angle_mode = "radians"
numeric nedges = 2000, radius = 1000
numeric ang = 0, delta = 2*pi/nedges
entity bigp = polygon -fil=red {
    for i=1,nedges { #Command
        (radius*cos(ang), radius*sin(ang), 0); # Point phrase
        ang = ang + delta; # Command
    }
}

Add a circular hole to the previous polygon.

polygon -par=bigp {
    circle -c=p0, -r=250
}

See Also

Commands:

entity, gstructure, point, prism

Identifiers:

angle_mode (string), def_color (color), def_fragment (numeric), def_ls (linestyle), def_rank (numeric)