File:Circle packing with radius ratio 0.651.svg
Summary
| Description |
English: Periodic circle packing in the plane with three radii of circles, all within 0.651 of each other, conjectured by Connelly and Zhang (Discrete Comput. Geom. 2025) to have the closest ratio to 1 of any non-hexagonal triangulated packing |
| Date | |
| Source | Own work |
| Author | David Eppstein |
| SVG development |
Licensing
David Eppstein, the copyright holder of this work, hereby publishes it under the following license:
| This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication. | |
| The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.
|
Source code

This media was created with Python (general-purpose programming language)Category:Images with Python source code
Here is a listing of the source used to create this file.
Here is a listing of the source used to create this file.
from math import pi,acos,asin,sin,e
from PADS.CirclePack import flower,acxyz
from SVG import SVG,colors
import sys
G = {0: [1,4,8,3,11,5,9],
1: [0,9,10,2,6,4],
2: [1,10,3,8,7,6],
3: [0,8,2,10,11],
4: [0,1,6,5,8],
5: [0,11,8,4,6,9],
6: [1,2,7,10,9,5,4],
7: [2,8,11,10,6],
8: [0,4,5,11,7,2,3],
9: [0,5,6,10,1],
10: [1,9,6,7,11,3,2],
11: [0,3,10,7,8,5]}
internal = range(1,12)
tolerance = 1+10e-12 # how accurately to approximate things
radii = {i:1 for i in G}
# The main iteration for finding the correct set of radii
lastChange = 2
while lastChange > tolerance:
lastChange = 1
for k in internal:
theta = flower(radii,k,G[k])
hat = radii[k]/(1/sin(theta/(2*len(G[k])))-1)
newrad = hat * (1/(sin(pi/len(G[k]))) - 1)
kc = max(newrad/radii[k],radii[k]/newrad)
lastChange = max(lastChange,kc)
radii[k] = newrad
placements = {0:0, 1:radii[0]+radii[1]}
def place(p,q,r):
theta = acxyz(radii[p],radii[q],radii[r])
offset = (placements[q]-placements[p])/(radii[q]+radii[p])
offset *= e**(-1j*theta)
return placements[p] + offset*(radii[r]+radii[p])
for p,q,r in [[1,0,4],[1,4,6],[1,6,2],[6,4,5],[6,5,9],[2,6,7],[7,6,10],[2,7,8],[8,7,11],[11,10,3]]:
placements[r] = place(p,q,r)
Y = place(9,5,0)
X = place(11,3,0)-Y
svg = SVG(480+360j,sys.stdout)
scale = 32
reps = 4
mid = (placements[1]+placements[2])/2+X+2*Y
ctr = 240+180j
def enscale(p):
return (p-mid)*scale+ctr
def encircle(i):
for j in range(reps):
for k in range(reps):
svg.circle(enscale(placements[i]+j*X+k*Y),radii[i]*scale)
svg.group(stroke=colors.black)
svg.group(fill=colors.blue)
for i in [0,6,8,10]:
encircle(i)
svg.ungroup()
svg.group(fill=colors.yellow)
for i in [1,2,5,11]:
encircle(i)
svg.ungroup()
svg.group(fill=colors.red)
for i in [3,4,7,9]:
encircle(i)
svg.ungroup()
svg.ungroup()
svg.close()