MengerMesh

MengerMesh[n]

gives a mesh region representing the n-step Menger sponge.

MengerMesh[n,d]

gives the n-step Menger sponge in dimension d.

Details and Options

• MengerMesh is also known as Sierpiński carpet.
• MengerMesh[n] is generated from a unit square by repeatedly removing the middle square of the subsequent cells. »
• MengerMesh[n] is equivalent to MengerMesh[n,2].
• MengerMesh takes the same options as MeshRegion, with the following additions:
•  DataRange Automatic the range of mesh coordinates to generate

Examples

open allclose all

Basic Examples(2)

A 2D Menger mesh:

Areas of the approximations to the Menger mesh:

The formula:

A 3D Menger mesh:

Scope(3)

A 2D Menger mesh:

A 3D Menger mesh:

The n approximation of the Menger mesh:

Options(12)

DataRange(1)

DataRange allows you to specify the range of mesh coordinates to generate:

Specify a different range:

MeshCellHighlight(2)

MeshCellHighlight allows you to specify highlighting for parts of a MengerMesh:

Individual cells can be highlighted using their cell indices:

Or by the cell itself:

MeshCellLabel(2)

MeshCellLabel can be used to label parts of a MengerMesh:

Individual cells can be labeled using their cell indices:

Or by the cell itself:

MeshCellMarker(1)

MeshCellMarker can be used to assign values to parts of a MengerMesh:

Use MeshCellLabel to show the markers:

MeshCellShapeFunction(2)

MeshCellShapeFunction can be used to assign values to parts of a MengerMesh:

Individual cells can be drawn using their cell indices:

Or by the cell itself:

MeshCellStyle(2)

MeshCellStyle allows you to specify styling for parts of a MengerMesh:

Individual cells can be highlighted using their cell indices:

Or by the cell itself:

PlotTheme(2)

Use a theme with grid lines and a legend:

Use a theme to draw a wireframe:

Applications(1)

The Menger mesh is generated from a unit square by repeatedly removing the middle square of the cells:

In 3D:

Properties & Relations(7)

The output of MengerMesh is always a full-dimensional MeshRegion:

MengerMesh consists of rectangles in 2D:

Hexahedrons in 3D:

Find the area of the Menger mesh in 2D at each stage:

Guess the general formula:

Find the volume of the Menger mesh in 3D at each stage:

Each face of the MengerMesh in 3D (Menger sponge) is a MengerMesh in 2D (Sierpiński carpet):

Get 3D coordinates and faces:

Get 2D coordinates and faces:

Find the boundary mesh region of MengerMesh:

DataRange->range is equivalent to using RescalingTransform[{...},range]:

Possible Issues(1)

MengerMesh can be too large to generate:

Wolfram Research (2017), MengerMesh, Wolfram Language function, https://reference.wolfram.com/language/ref/MengerMesh.html.

Text

Wolfram Research (2017), MengerMesh, Wolfram Language function, https://reference.wolfram.com/language/ref/MengerMesh.html.

CMS

Wolfram Language. 2017. "MengerMesh." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/MengerMesh.html.

APA

Wolfram Language. (2017). MengerMesh. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MengerMesh.html

BibTeX

@misc{reference.wolfram_2024_mengermesh, author="Wolfram Research", title="{MengerMesh}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/MengerMesh.html}", note=[Accessed: 25-June-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_mengermesh, organization={Wolfram Research}, title={MengerMesh}, year={2017}, url={https://reference.wolfram.com/language/ref/MengerMesh.html}, note=[Accessed: 25-June-2024 ]}