Function Repository Resource:

NestedIncirclePolygons

Source Notebook

Create a graphic of nested circles and polygons inside an initial regular polygon

Contributed by: Eric Weisstein

ResourceFunction["NestedIncirclePolygons"][{n1,n2,}]

displays a nested sequence of circles alternating with regular ni-gons.

Details and Options

ResourceFunction["NestedIncirclePolygons"] takes the following options:
"StartingRadius"1.specifies the radius of the initial polygon
"Stylings"{Orange,Directive[FaceForm[Opacity[0]],EdgeForm[Black]]}styles to apply to the circles and polygons

Examples

Basic Examples (2) 

Nest a single circle inside a square:

In[1]:=
ResourceFunction["NestedIncirclePolygons"][{4}]
Out[1]=

Nest a circle inside a triangle inside a circle inside a square:

In[2]:=
ResourceFunction["NestedIncirclePolygons"][{4, 3}]
Out[2]=

Options (2) 

StartingRadius (1) 

Specify a different starting radius:

In[3]:=
Table[Graphics[
  First[ResourceFunction["NestedIncirclePolygons"][Range[3, 8], "StartingRadius" -> i]], PlotRange -> 3], {i, 1., 3., 1}]
Out[3]=

Stylings (1) 

Specify styles to be applied to the circles and polygons:

In[4]:=
ResourceFunction["NestedIncirclePolygons"][Range[3, 8], "Stylings" -> {Directive[Red], FaceForm[Directive[Green, Opacity[0.2]]]}]
Out[4]=

Applications (2) 

Nest a sequence of regular n-gons, increasing n to create a two-dimensional Kepler model:

In[5]:=
ResourceFunction["NestedIncirclePolygons"][Range[3, 8]]
Out[5]=

Nest in reverse:

In[6]:=
ResourceFunction["NestedIncirclePolygons"][Range[8, 3, -1]]
Out[6]=

Neat Examples (1) 

Nest random regular polygons:

In[7]:=
ResourceFunction["NestedIncirclePolygons"][RandomInteger[{3, 8}, 12]]
Out[7]=

Version History

  • 1.0.1 – 24 August 2021
  • 1.0.0 – 28 April 2020

Related Resources

License Information