File size: 1,462 Bytes
b0e88cf | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | # EVOLVE-BLOCK-START
import numpy as np
def hexagon_packing_11():
"""
Constructs a packing of 11 disjoint unit regular hexagons inside a larger regular hexagon, maximizing 1/outer_hex_side_length.
Returns
inner_hex_data: np.ndarray of shape (11,3), where each row is of the form (x, y, angle_degrees) containing the (x,y) coordinates and angle_degree of the respective inner hexagon.
outer_hex_data: np.ndarray of shape (3,) of form (x,y,angle_degree) containing the (x,y) coordinates and angle_degree of the outer hexagon.
outer_hex_side_length: float representing the side length of the outer hexagon.
"""
n = 11
# Simple grid arrangement of inner hexagons
inner_hex_data = np.array(
[
[0, 0, 0], # center
[-2.5, 0, 0], # left
[2.5, 0, 0], # right
[-1.25, 2.17, 0], # top-left
[1.25, 2.17, 0], # top-right
[-1.25, -2.17, 0], # bottom-left
[1.25, -2.17, 0], # bottom-right
[-3.75, 2.17, 0], # far top-left
[3.75, 2.17, 0], # far top-right
[-3.75, -2.17, 0], # far bottom-left
[3.75, -2.17, 0], # far bottom-right
]
)
outer_hex_data = np.array([0, 0, 0]) # centered at origin
outer_hex_side_length = 8 # large enough to contain all inner hexagons
return inner_hex_data, outer_hex_data, outer_hex_side_length
# EVOLVE-BLOCK-END
|