Skip to content

[css-shapes] Basic shapes for regular polygons #13267

@Crissov

Description

@Crissov

https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes

Regular polygons are equiangular and equilateral; they can be distinguished into convex n-gons and star n-grams. The former are known as trigon/equilateral triangle, tetragon/square, pentagon, hexagon and so (g)on, the latter are known as pentagram, hexagaram etc. They are characterized by two positive integers: n > 2 for the number of edges/vertices or points/spokes and m < n/2 for the distance of neighboring points being connected, i.e. m = 1 for convex polygons. If m is a divisor of n or, more generally, if they are not coprime, the polygon degenerates to a simpler one. For odd n, these polygons have n mirror axes through their center, while even ones have twice as many.

I propose this be made available as a basic shape based upon the design of circle():

<star()> = star(
  <integer[3,]> <integer[1,]>?
  <radial-size>?
  <angle>?
  [ at <position> ]?
)

If the function is named star(), the second integer should default to 2, but if gon() was acceptable, it should be 1.

The position defaults to center and the first point to top center. The optional angle issues a clockwise rotation of the shape around its position.

This would not add new functionality as it is just a more convenient way to notate common shapes, i.e. “syntactic sugar”.
Notably, star(4 1) yields a square as a special, equiangular rhombus/diamond, not as a special, equilateral rectangle, i.e. it is standing on a tip.

Implementations could be allowed to treat this like a circle for sufficiently large n.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions