Computes a Koebe realization of a 3-dimensional polytope following Variational principles for circle patterns and Koebe's theorem. The input is the vertex-facet description of a polytope.
using Pkg
pkg"add https://github.com/saschatimme/KoebeRealizations.jl.git"
using KoebeRealizations
cube = Bool[
1 1 1 1 0 0 0 0
1 1 0 0 1 1 0 0
0 1 1 0 0 1 1 0
0 0 1 1 0 0 1 1
1 0 0 1 1 0 0 1
0 0 0 0 1 1 1 1
]
koebe_realization(cube)
8×3 Matrix{Float64}:
0.316228 -0.707107 0.948683
-0.948684 -0.707106 0.316228
-0.316228 -0.707107 -0.948683
0.948683 -0.707107 -0.316228
0.316228 0.707107 0.948683
-0.948683 0.707107 0.316228
-0.316228 0.707107 -0.948683
0.948683 0.707107 -0.316228
The input can also be a polytope from Polymake.jl
. In this case the function also returns a polymake polytope.
using KoebeRealizations, Polymake
ico = polytope.icosahedron()
Q = koebe_realization(ico)
Polymake.visual(Q)
Underneath, the algorithm to compute a Koebe realization computes a particular circle packing. This can be visualized as follows:
using KoebeRealizations
cube = Bool[
1 1 1 1 0 0 0 0
1 1 0 0 1 1 0 0
0 1 1 0 0 1 1 0
0 0 1 1 0 0 1 1
1 0 0 1 1 0 0 1
0 0 0 0 1 1 1 1
]
plot_circle_packing(cube)