Random Regular Polygon Set Generator

Generate rotated regular polygons with bounded side counts and lengths plus computed area metadata.

Description

Generate regular-polygon specifications with side count, side length, rotation, and calculated area.

A regular polygon has equal side lengths and equal interior angles. Its area can be determined from the number of sides and a common side length; rotating the shape does not change that area.1

This generator returns result.polygons entries containing sides, sideLength, rotationDegrees, and area. These are shape specifications rather than vertex coordinates or a rendered diagram. A drawing application must choose a center and construct vertices separately.

When to use Random Regular Polygon Set Generator

Use it for regular-polygon geometry exercises or shape specifications that will be drawn by another application.

How to use Random Regular Polygon Set Generator and understand its results

  1. Enter integer shapeCount from 1 through 256 and integer minimumSides and maximumSides from 3 through 100, with minimum no greater than maximum.
  2. Enter positive finite maximumSideLength no greater than 1e100, using one chosen length unit, then run.
  3. Read each polygon’s sides, sideLength, rotationDegrees, and area. Treat rotation as drawing metadata in degrees and area in squared length units.
n = minimumSides + floor(r1 × (maximumSides − minimumSides + 1)); s = M × (0.1 + 0.9 × r2); rotation = 360 × r3

Each polygon consumes three draws. The side-count bounds are inclusive; side length runs from 0.1M toward M.

area = n × s² / (4 × tan(π/n))

The regular-polygon-area calculator supplies area. Rotation affects orientation metadata, not the calculation.

json
{
  "input": {
    "shapeCount": 3,
    "minimumSides": 3,
    "maximumSides": 8,
    "maximumSideLength": 10
  },
  "randomDraw": 0.25,
  "output": {
    "result": {
      "polygons": [
        {
          "area": 10.562500000000002,
          "rotationDegrees": 90,
          "sideLength": 3.25,
          "sides": 4
        },
        {
          "area": 10.562500000000002,
          "rotationDegrees": 90,
          "sideLength": 3.25,
          "sides": 4
        },
        {
          "area": 10.562500000000002,
          "rotationDegrees": 90,
          "sideLength": 3.25,
          "sides": 4
        }
      ]
    }
  }
}

Equal side-count bounds fix n but still consume its draw. The maximum bounds side length, not overall width or distance from the center. Reversed side-count bounds, sides below three, nonpositive lengths, and invalid draws fail.

Limitations and assumptions

The default source is Math.random; no seed input or cryptographic entropy guarantee is provided. Repeated runs may select the same result, and the distribution depends on the random source.

The generator does not produce vertices, centers, perimeter, placement, nonoverlapping layouts, or images. Sampling is not uniform over polygon areas or all polygon shapes.

Very small length bounds can underflow squared measurements, and floating-point arithmetic can introduce small area differences. Repeated specifications are allowed.

Alternative or Complementary methods

Use the area calculator for an explicit polygon. A rectangle generator produces width/height specifications and perimeter without a regularity requirement.

References

  1. Contemporary Mathematics: Area — OpenStax, Rice University

Similar or alternative tools

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies