user
A pentagram is a star polygon, consisting of a central pentagon of which each side forms the base of an isosceles triangle. The vertex of each triangle, a point of the star, is 36 degrees.

Task

Draw (or print) a regular pentagram, in any orientation. Use a different color (or token) for stroke and fill, and background. For the fill it should be assumed that all points inside the triangles and the pentagon are inside the pentagram.

See also

* Angle sum of a pentagram
assistant
(formerly Perl 6)

**Works with**: rakudo version 2018.08

Generate an SVG file to STDOUT. Redirect to a file to capture and display it.

```
use SVG;

constant $dim = 200;
constant $sides = 5;

my @vertices = map { 0.9 * $dim * cis($_ * τ / $sides) }, ^$sides;

my @points   = map |*.reals.fmt("%0.3f"),
  flat @vertices[0, 2 ... *], @vertices[1, 3 ... *], @vertices[0];

say SVG.serialize(
    svg => [
        :width($dim*2), :height($dim*2),
        :rect[:width<100%>, :height<100%>, :style<fill:bisque;>],
        :polyline[ :points(@points.join: ','),
          :style("stroke:blue; stroke-width:3; fill:seashell;"),
          :transform("translate($dim,$dim) rotate(-90)")
        ],
    ],
);

```

See Pentagram (offsite svg image)

Ever wondered what a regular 7 sided star looks like? Change $sides to 7 and re-run.
See Heptagram