Engee documentation
Notebook

Construction of the Silashi polyhedron (Silahedron)

This demo shows how to build a Silashi polyhedron (Silahedron) using the function mesh3d() from the library Plots.jl.

Introduction

Силаэдр - is a non-convex toroidal polyhedron for which the following equality from the Euler-Poincaré characterisation holds
$$h = \frac{(f-4)(f-3)}{12},$$ where $f = 7$ is the number of faces of the polyhedron and $h=1$ is the number of holes of the surface in which it is embedded.
This equality follows from the condition that in such a polyhedron each face has a common edge with any other face.

A sylahedron has 7 hexagonal faces, 14 vertices and 21 edges. In the example, we will construct this polyhedron in Cartesian coordinate system using the available vertex coordinates.

Vertex coordinates

First, let us introduce notations for faces and vertices. Vertices have consecutive numerical designations from 0 to 13, pair-congruent faces have consecutive alphanumerical designations: A1, A2, B1, B2, B1, B2, B1, B2, and an unpaired edge has the letter designation G.
The polyhedron sweep below shows the corresponding designations and colour palette, which will be used further on in the construction of the silahedron.

net_of_szilassi_polyhedro.png

Let us add to the Engee workspace the variables characterising the Cartesian coordinates of the Silahedron vertices. These coordinates are determined from the conditions that the geometric centre of the polyhedron is located at the origin and the length of its smallest face is equal to one.

In [ ]:
# Координаты вершин: 
#           координаты [x, y, z]    № вершины
Вершины = [
            [12,  0, 12],           # 0
            [-12, 0, 12],           # 1
            [0, 12.6, -12],         # 2
            [0, -12.6, -12],        # 3
            [2, -5, -8],            # 4
            [-2, 5, -8],            # 5
            [3.75, 3.75, -3],       # 6
            [-3.75, -3.75, -3],     # 7
            [4.5, -2.5, 2],         # 8
            [-4.5, 2.5, 2],         # 9
            [7, 0, 2],              # 10
            [-7, 0, 2],             # 11
            [7, 2.5, 2],            # 12
            [-7, -2.5, 2]           # 13
          ];

# извлечение векторов координат вершин по осям
Вершины_матрица = Base.stack(Вершины, dims = 1);
Вершины_x = Вершины_матрица[:, 1];
Вершины_y = Вершины_матрица[:, 2];
Вершины_z = Вершины_матрица[:, 3];

In the vector Вершины the vectors of coordinates for vertices with ordinal numbers specified in the comments are given. For convenience of their construction, the coordinates along the axes are extracted into separate vectors.

Vertex connection

To construct faces using the Plots.mesh3d() function, it is necessary to define three vectors (I, J, K) whose corresponding indices are the vertices of the triangle belonging to the face of the polyhedron. For example, in face A1 there are 4 non-intersecting triangles formed by vertices 0-10-12, 0-4-10, 4-2-10 and 4-3-2.
Thus, let us divide each face of the silahedron into non-intersecting triangles, and write the vertices forming them in the corresponding indices of vectors I, J, K. For correct display of colour filling of faces during construction, the vertices of triangles should be entered into vectors without changing the direction of vertex traversal for one face.

In [ ]:
# разбиение граней на треугольники:
# грань А1 (состоит из треугольников 0-10-12, 0-4-10, 4-2-10, 4-3-2)
А1_i = [0,  0,  4,  4];
А1_j = [10, 4,  2,  3];
A1_k = [12, 10, 10, 2];
Соединения_А1 = (А1_i, А1_j, A1_k);

# грань А2
А2_i = [1,  1,  5,  5];
А2_j = [11, 5,  3,  2];
A2_k = [13, 11, 11, 3];
Соединения_А2 = (А2_i, А2_j, A2_k);

# грань Б1
Б1_i = [0, 0,  0,  4];
Б1_j = [8, 1,  13, 8];
Б1_k = [4, 13, 8,  7];
Соединения_Б1 = (Б1_i, Б1_j, Б1_k);

# грань Б2
Б2_i = [1, 1,  1,  5];
Б2_j = [9, 0,  12, 9];
Б2_k = [5, 12, 9,  6];
Соединения_Б2 = (Б2_i, Б2_j, Б2_k);

# грань В1
В1_i = [10, 10, 10, 5];
В1_j = [8,  7,  6,  2];
В1_k = [7,  6,  2,  6];
Соединения_В1 = (В1_i, В1_j, В1_k);

# грань В2
В2_i = [11, 11, 11, 7];
В2_j = [9,  6,  7,  4];
В2_k = [6,  7,  3,  3];
Соединения_В2 = (В2_i, В2_j, В2_k);

# грань Г
Г_i = [11, 10, 8,  8];
Г_j = [8,  9,  11, 9];
Г_k = [13, 12, 9,  10];
Соединения_Г = (Г_i, Г_j, Г_k);

# вектора значений для построения граней
Соединения = [Соединения_А1, Соединения_А2, Соединения_Б1, 
              Соединения_Б2, Соединения_В1, Соединения_В2, Соединения_Г];
Радуга =  [:red, :orange, :yellow, :green, :cyan, :blue, :purple];
Подпись = ["A1", "A2",    "Б1",    "Б2",   "В1",  "В2",  "Г"    ];

The obtained vectors are combined into tuples for passing to the function mesh3d(), colour palette variables and polyhedron faces designations are defined.

Construction of silahedron

Connect the library Plots.jl and the backend for building:

In [ ]:
# подключение библиотеки и бэкенда
using Plots;
plotlyjs();

Let's introduce the function Грань() to construct vertices and faces by index:

In [ ]:
# функция для построения вершин и граней
function Грань(номер)
    if номер == 0 
        Plots.scatter3d(Вершины_x, Вершины_y, Вершины_z;
                        label="вершины", color = :black, markersize = 1,
                        xlabel = "x", ylabel = "y", zlabel = "z",
                        camera = (130, 20))
    else
        Plots.mesh3d!(Вершины_x, Вершины_y, Вершины_z;
                      connections = Соединения[номер],
                      color = Радуга[номер], label = Подпись[номер])
    end
end;

Let's build vertices and obtained faces in the loop:

In [ ]:
# построение вершин
Plots.scatter3d(Вершины_x, Вершины_y, Вершины_z;
                label="вершины", color = :black, markersize = 1)

# построение граней в цикле
for N in 1:7
    Грань(N)
end

# оформление сцены
plot!(xlabel = "x", ylabel = "y", zlabel = "z", camera = (130, 20))
Out[0]:

The connected backend provides construction of a polyhedron with high interactivity. Silahedron can be scaled, rotated, display of elements (faces and vertices) can be switched on and off.

Finally, let's create an animation of sequential construction of silahedron faces:

In [ ]:
# анимация последовательного построения граней
анимация = @animate for N in [0, 7, 6, 5, 2, 1, 3, 4]
    Грань(N)
end;

gif(анимация, "Силаэдр.gif", fps = 1)
[ Info: Saved animation to /user/start/examples/math_and_optimization/silaedr/Силаэдр.gif
Out[0]:
No description has been provided for this image

Conclusion

In this example, we have looked at constructing the Silasci polyhedron from coordinates using the function mesh3d() from the library Plots.jl.