Skip to main content
4 of 6
Changed since not always correct.
Teg Louis
  • 74
  • 1
  • 3
  • 23

How to create a random belt polygon or belt polyhedron?

A zonogon is a convex polygon that is made up of parallel sides. Generating a random zonogon in Mathematica can be found here. A natural generalization of zonogons is called belt polygons. A belt polygon is a convex polygon that is made up of parallel line segments, but they are not necessarily the same length. I generalized SHuisman's solution to get the Mathematica code below for a random belt polygon (not always correct at making belt polygons):

ClearAll[CreateRandomBeltPolygon]
CreateRandomBeltPolygon[sides_?EvenQ, lendist : {min_, max_}] := 
 Module[{m, angles, dirs, lengths},
  m = sides/2;
  angles = RandomReal[{0, 1}, m];
  angles /= Total[angles]/(Pi);
  angles = Join[angles, angles];
  dirs = Accumulate[angles];
  dirs += RandomReal[{0, 2 Pi}];
  lengths = RandomReal[lendist, 2*m];
  Polygon[Accumulate[MapThread[AngleVector[{#1, #2}] &, {lengths, dirs}]]]
  ]
 Graphics[{EdgeForm[Thick],White,CreateRandomBeltPolygon[6, {0.5, 1}] }, AspectRatio->Automatic]

For example might give:

Belt polygon with 6 sides.

$\color{magenta}{\star}$ Boltyanski, V., Martini, H., & Soltan, P. S. (1997). [Combinatorial geometry of belt bodies. In Excursions into Combinatorial Geometry (pp. 319–363)]. Springer Berlin Heidelberg. https://doi.org/10.1007/978-3-642-59237-9_7

Teg Louis
  • 74
  • 1
  • 3
  • 23