# Platonic solids

Excerpt

## 1 Manual

### 1.1 Introduction

In this paper, we describe the utilization and genesis of an interactive website 1 you can use to create, display and manipulate Platonic solids and other polyhedra.

“In geometry, a polyhedron [...] is a three-dimensional shape with flat polygonal faces, straight edges and sharp corners or vertices”2.

“In three-dimensional space, a Platonic solid is a regular, convex polyhedron”3.

The polyhedron is dynamically created by simulating physical masses (vertices) con­nected by springs and dampers (edges) covered by a convex hull (faces).1 You can use the left mouse button to drag single vertices around and watch the “rubber polyhedra” dilate, translate, and rotate, in order to pull the vertex back into its hull. Pressing the right mouse button, you can orbit the camera around the scenery (section 2.4). With the mouse wheel you can zoom in and out.

You can choose different polyhedra via a button list (figure 1.1).

Abbildung in dieser Leseprobe nicht enthalten

Figure 1.1: Choose a polyhedron.

The website has been programmed in Unity 4 in C#, compiled for WebGL, and should run in every2 modern browser.

### 1.2 Polyhedra

In this chapter we describe the different polyhedra you can choose on the website.

#### 1.2.1 Tetrahedron

The Platonic solid with four vertices is called a regular tetrahedron or triangular pyra­mid. Obviously, the vertices are forced into a configuration of the four (Greek: tetra-) equivalent equilateral triangular faces depicted in figure 1.2.

Abbildung in dieser Leseprobe nicht enthalten

Figure 1.2: Tetrahedron (nvertices =4)

The colors of the vertex spheres are dynamically chosen depending on the vertex po­sitions in the corresponding RGB color cube (figure 2.6). The colors of the faces are defined by the face normal vectors. Since the center perpendicular of every triangular face pierces the opposite vertex (sphere) both have the same color.

#### 1.2.2 Triangular dipyramid

There is no Platonic solid with five vertices. Nevertheless, the corresponding simulation creates the highly symmetrical polyhedron in figure 1.3. It is called a triangular dipyra­mid, because it can be ”constructed” by ”gluing” two (Greek: di-) triangular pyramids (tetrahedrons) base-to-base.

Abbildung in dieser Leseprobe nicht enthalten

Figure 1.3: Triangular dipyramid (nvertices =5)

#### 1.2.3 Octahedron

The six vertices of this simulation inflate into a regular octahedron (figure 1.4), which is one of the Platonic solids. The octahedron (Greek for ”eight faces”) is also called a square dipyramid because it can be dissected into two pyramids with square bases. Seen from another angle of view, the octahedron also is a triangular antiprism, because there are (four) pairs of opposing parallel triangles, of which one has its vertices where the other one has its edges.

Abbildung in dieser Leseprobe nicht enthalten

Figure 1.4: Octahedron, square dipyramid, triangular antiprism (nvertices =6)

#### 1.2.4 Square antiprism

Yes - there is a Platonic solid with eight vertices; the regular hexahedron, aka the cube. But no - interestingly, this polyhedron simulation does not create a cube, if you ask it to arrange eight vertices in a minimum energy state. The astonishing result is the square antiprism shown in figure 1.5, which consists of two squares3 (a ”bottom square” and a ”top square”) that have been rotated (45°) into paraphase and eight triangles connecting the edges of the bottom square with the vertices of the top square and vice versa4. Obviously, this ”twisting” of the squares leads to a stable equilibrium of the contradicting forces of the springs, while the cube, where the vertices of the squares would ”face each other directly”, produces an indifferent equilibrium that will never be reached in a simulation with random initial positions.

Abbildung in dieser Leseprobe nicht enthalten

Figure 1.5: Not a cube, but a square antiprism (n vertices =8)

#### 1.2.5 Icosahedron

In a simulation with twelve vertex spheres, all of them find their positions at the vertices of the regular icosahedron (Greek for ”twenty faces”) shown in figure 1.6, which is another one of the Platonic solids.

Abbildung in dieser Leseprobe nicht enthalten

Figure 1.6: Icosahedron (n vertices =12)

#### 1.2.6 Not a dodecahedron

The Platonic solid with 20 vertices and twelve (Greek: dodeca-) faces is called a regular dodecahedron. But again (as with the square antiprism) the 20 vertices minimum energy configuration depicted in figure 1.7 is not a dodecahedron. We have not even found a proper name for that irregular polyhedron. At first glance it seems to consist of triangles and three squares (adjacent triangles of the same color). But if you look more carefully at the ”squares” you can discover that the colors of the adjacent triangles do not have the exact same color. Strange . . . !

Abbildung in dieser Leseprobe nicht enthalten

Figure 1.7: Not a dodecahedron (nvertices =20)

#### 1.2.7 Corona

This program has been written in 2020 (the first year of the corona virus). The polyhe­dron with 128 vertices in figure 1.8 looks a little bit like the virus.

Abbildung in dieser Leseprobe nicht enthalten

Figure 1.8: Corona (n vertices = 128)

## 2 Under the hood

### 2.1 Coordinate system

Unity uses a left-handed coordinate system:

- The thumb of your left hand points to your right (red x-axis in figure 2.1).
- The index finger of your left hand points up (green y-axis in figure 2.1).
- The middle finger of your left hand points away from you (blue z-axis in figure 2.1).

Abbildung in dieser Leseprobe nicht enthalten

Figure 2.1: Coordinate system

### 2.2 Spheres

We model the vertices of the polyhedron as tiny spheres. Since the user is free to choose any polyhedron we do not know the number of spheres we have to create. Therefore, we generate the spheres programmatically during the initialization of the program.

Unity can create a few 3D primitives by itself:

- Cube
- Sphere
- Capsule
- Cylinder
- Plane

Therefore, we can use a standard Sphere object as a prefab (figure 2.2)

Abbildung in dieser Leseprobe nicht enthalten

Figure 2.2: Standard Sphere object as a prefab create a new empty GameObject called Spheres (figure 2.3)

Abbildung in dieser Leseprobe nicht enthalten

Figure 2.3: Empty GameObject (Spheres)

add a Mesh Filter and a Mesh Renderer as Mesh components to the empty Spheres GameObject (figure 2.4)

Abbildung in dieser Leseprobe nicht enthalten

Figure 2.4: Mesh Filter and Mesh Renderer of Spheres and attach a script by the name of Spheres_class (figure 2.5).

Abbildung in dieser Leseprobe nicht enthalten

Figure 2.5: Script(Spheres_class)

In the script (section 2.2.1) we declare a public GameObject array of spheres that will contain the vertex sphere objects to be instantiated (and therefore has an initial size of zero in figure 2.5) and the public GameObject new_sphere that we manually connect to the sphere_prefab in figure 2.5.

#### 2.2.1 Spheres_class

The Spheres_class script is attached to the empty Spheres GameObject. It creates the spheres and the springs connecting the spheres to each other and the origin. In every simulation step, it computes the common center of mass of all spheres and colorizes the spheres according to their position with respect to the common center of mass.

Unity scripts automatically import some standard types from predefined namespaces of which we only use the UnityEngine:

Abbildung in dieser Leseprobe nicht enthalten

Every Unity script derives from the MonoBehaviour base class:

Abbildung in dieser Leseprobe nicht enthalten

Before we define the Start function, we declare some (global) objects and variables as properties. The array of spheres will be populated with the instantiated sphere objects:

Abbildung in dieser Leseprobe nicht enthalten

The new_sphere object has been initialized with the sphere_prefab in figure 2.5 and will serve as an instantiation template for a new sphere:

Abbildung in dieser Leseprobe nicht enthalten

The initial polyhedron is an icosahedron with an initial5 vertex count of twelve:

Abbildung in dieser Leseprobe nicht enthalten

The center is computed in every simulation step as the current center of mass:

Abbildung in dieser Leseprobe nicht enthalten

##### 2.2.1.1 Start

The start function is called before the first simulation step. It creates the spheres and the springs:

Abbildung in dieser Leseprobe nicht enthalten

[...]

1 Additionally, every vertex is connected to the origin via a soft spring (section 2.2.1.1), ensuring that the polyhedron will always finally return to the center of the screen.

2 Except for - who would have guessed - Internet Explorer which does not support WebAssem­bly.

3 You can easily identify the squares as two adjacent triangles of the same color (same plane normal).

4 You have to try out this simulation! It is really cute to watch the vertices swarm around, until they have come to an agreement on which of them makes up the bottom and top squares.

5 Since we want to access the number of vertices in other classes as well n_spheres has to be a static variable.

Excerpt out of 34 pages

Details

Title
Platonic solids
Subtitle
Interactive Website
College
University of Applied Sciences Bremen
Author
Year
2020
Pages
34
Catalog Number
V958287
ISBN (eBook)
9783346303806
Language
English
Keywords
unity, platonic solids, interactive, website, webgl, c#
Quote paper
Prof. Dr.-Ing. Jörg Buchholz (Author), 2020, Platonic solids, Munich, GRIN Verlag, https://www.grin.com/document/958287