2 added 81 characters in body
source | link

Challenge

My challenge, is for you to generate a Menger Sponge based on the level/iteration given. You need to draw it in 3d, anyway you can.see the Specifications below!

3D Specifications

  • You can use existing 3D libraries

Examples

Inputs: 0, 1, 2, 3

Outputs:

Diagram


Background Information

What is a Menger Sponge

In mathematics, the Menger sponge (also known as the Menger universal curve) is a fractal curve. It is a three-dimensional generalization of the Cantor set and Sierpinski carpet

Properties

See https://en.wikipedia.org/wiki/Menger_sponge#Properties (too long to copy and paste)

How do I construct the sponge?

Diagram

  1. Begin with a cube (first image).

  2. Divide every face of the cube into 9 squares, like a Rubik's Cube. This will sub-divide the cube into 27 smaller cubes.

  3. Remove the smaller cube in the middle of each face, and remove the smaller cube in the very center of the larger cube, leaving 20 smaller cubes (second image). This is a level-1 Menger sponge (resembling a Void Cube).

  4. Repeat steps 2 and 3 for each of the remaining smaller cubes, and continue to iterate ad infinitum.

The second iteration gives a level-2 sponge (third image), the third iteration gives a level-3 sponge (fourth image), and so on. The Menger sponge itself is the limit of this process after an infinite number of iterations.

Credit

Background info taken from this wikipedia page on Menger Sponges.


Good Luck!

Remember this is the shortest program wins!


HELP

I need help with specifications for the 3d output:

Since 3D is now required (invalidating existing answers), I think the question is now unclear. There is a lot you need to specify for 3D including but not limited to viewing angle, projection, lighting, shading.

Challenge

My challenge, is for you to generate a Menger Sponge based on the level/iteration given. You need to draw it in 3d, anyway you can.

Examples

Inputs: 0, 1, 2, 3

Outputs:

Diagram


Background Information

What is a Menger Sponge

In mathematics, the Menger sponge (also known as the Menger universal curve) is a fractal curve. It is a three-dimensional generalization of the Cantor set and Sierpinski carpet

Properties

See https://en.wikipedia.org/wiki/Menger_sponge#Properties (too long to copy and paste)

How do I construct the sponge?

Diagram

  1. Begin with a cube (first image).

  2. Divide every face of the cube into 9 squares, like a Rubik's Cube. This will sub-divide the cube into 27 smaller cubes.

  3. Remove the smaller cube in the middle of each face, and remove the smaller cube in the very center of the larger cube, leaving 20 smaller cubes (second image). This is a level-1 Menger sponge (resembling a Void Cube).

  4. Repeat steps 2 and 3 for each of the remaining smaller cubes, and continue to iterate ad infinitum.

The second iteration gives a level-2 sponge (third image), the third iteration gives a level-3 sponge (fourth image), and so on. The Menger sponge itself is the limit of this process after an infinite number of iterations.

Credit

Background info taken from this wikipedia page on Menger Sponges.


Good Luck!

Remember this is the shortest program wins!


HELP

I need help with specifications for the 3d output:

Since 3D is now required (invalidating existing answers), I think the question is now unclear. There is a lot you need to specify for 3D including but not limited to viewing angle, projection, lighting, shading.

Challenge

My challenge, is for you to generate a Menger Sponge based on the level/iteration given. You need to draw it in 3d, see the Specifications below!

3D Specifications

  • You can use existing 3D libraries

Examples

Inputs: 0, 1, 2, 3

Outputs:

Diagram


Background Information

What is a Menger Sponge

In mathematics, the Menger sponge (also known as the Menger universal curve) is a fractal curve. It is a three-dimensional generalization of the Cantor set and Sierpinski carpet

Properties

See https://en.wikipedia.org/wiki/Menger_sponge#Properties (too long to copy and paste)

How do I construct the sponge?

Diagram

  1. Begin with a cube (first image).

  2. Divide every face of the cube into 9 squares, like a Rubik's Cube. This will sub-divide the cube into 27 smaller cubes.

  3. Remove the smaller cube in the middle of each face, and remove the smaller cube in the very center of the larger cube, leaving 20 smaller cubes (second image). This is a level-1 Menger sponge (resembling a Void Cube).

  4. Repeat steps 2 and 3 for each of the remaining smaller cubes, and continue to iterate ad infinitum.

The second iteration gives a level-2 sponge (third image), the third iteration gives a level-3 sponge (fourth image), and so on. The Menger sponge itself is the limit of this process after an infinite number of iterations.

Credit

Background info taken from this wikipedia page on Menger Sponges.


Good Luck!

Remember this is the shortest program wins!


HELP

I need help with specifications for the 3d output:

Since 3D is now required (invalidating existing answers), I think the question is now unclear. There is a lot you need to specify for 3D including but not limited to viewing angle, projection, lighting, shading.

1
source | link

Challenge

My challenge, is for you to generate a Menger Sponge based on the level/iteration given. You need to draw it in 3d, anyway you can.

Examples

Inputs: 0, 1, 2, 3

Outputs:

Diagram


Background Information

What is a Menger Sponge

In mathematics, the Menger sponge (also known as the Menger universal curve) is a fractal curve. It is a three-dimensional generalization of the Cantor set and Sierpinski carpet

Properties

See https://en.wikipedia.org/wiki/Menger_sponge#Properties (too long to copy and paste)

How do I construct the sponge?

Diagram

  1. Begin with a cube (first image).

  2. Divide every face of the cube into 9 squares, like a Rubik's Cube. This will sub-divide the cube into 27 smaller cubes.

  3. Remove the smaller cube in the middle of each face, and remove the smaller cube in the very center of the larger cube, leaving 20 smaller cubes (second image). This is a level-1 Menger sponge (resembling a Void Cube).

  4. Repeat steps 2 and 3 for each of the remaining smaller cubes, and continue to iterate ad infinitum.

The second iteration gives a level-2 sponge (third image), the third iteration gives a level-3 sponge (fourth image), and so on. The Menger sponge itself is the limit of this process after an infinite number of iterations.

Credit

Background info taken from this wikipedia page on Menger Sponges.


Good Luck!

Remember this is the shortest program wins!


HELP

I need help with specifications for the 3d output:

Since 3D is now required (invalidating existing answers), I think the question is now unclear. There is a lot you need to specify for 3D including but not limited to viewing angle, projection, lighting, shading.