B4.Blocks

a1. orientation

# ==============================================================================
#Load data
# ==============================================================================
HERE = os.path.dirname(__file__)

FILE_I = os.path.join(HERE, 'data', 'form_dual.json')

mesh = Mesh.from_json(FILE_I)

#================================================
#Visualize
#================================================
artist = MeshArtist(mesh, layer="CSD2::DISCRETIZATION::normals")
artist.clear_layer()
artist.draw_edges()
artist.draw_vertexnormals(scale=1)

a2. offset

mesh = Mesh.from_json(FILE_I)

idos = mesh.copy()
edos = mesh.copy()

for vertex in mesh.vertices():
    point = mesh.vertex_coordinates(vertex)
    normal = mesh.vertex_normal(vertex)
    thickness = 0.1
    idos.vertex_attributes(vertex, 'xyz', add_vectors(point, scale_vector(normal, thickness)))
    edos.vertex_attributes(vertex, 'xyz', add_vectors(point, scale_vector(normal, -1* thickness)))

# ==============================================================================
#Output
# ==============================================================================

idos.to_json(FILE_O1,  pretty=True)
edos.to_json(FILE_O2)

a3. blocks

blocks = []

for face in idos.faces():
    bottom = idos.face_coordinates(face)
    top = edos.face_coordinates(face)

    f = len(bottom)

    faces = [
        list(range(f)),
        list(range(f + f - 1, f - 1, -1))]

    for i in range(f - 1):
        faces.append([i, i + f, i + f + 1, i + 1])
    faces.append([f - 1, f + f - 1, f, 0])

    block = Mesh.from_vertices_and_faces(bottom + top, faces)
    blocks.append(block)

Blocks of flat top surface

The block geometries generated using the intrados and extrados, which are offsets of the initial mesh, contain two main hexagonal faces that are not planar. If the blocks are to be milled using stone blanks, milling both sides of the stone would be not only time intensive, but also result in loss of precision during the flipping of the blocks.

One way to address this problem, would be to make one of the two hexagonal faces planar so that the block is only milled on one side and does not need to be flipped. This technique was used for the Armadillo Vault, where the inner face of the blocks had double curvature, while the top face remained flat.

HERE = os.path.dirname(__file__)
FILE_I = os.path.join(HERE, 'blocks.json')
FILE_O = os.path.join(HERE, 'blocksflat.json')

with open(FILE_I, 'r') as f:
    blocks = [Mesh.from_data(data) for data in json.load(f)]


for block in blocks:
    bottom = block.face_vertices(0)
    top = block.face_vertices(1)[::-1]

    bottom_points = block.vertices_attributes('xyz', keys=bottom)
    top_points = block.vertices_attributes('xyz', keys=top)

    plane = bestfit(top_points)

    top_new = []
    for a, b in zip(bottom_points, top_points):
        b = intersection_line_plane((a, b), plane)
        top_new.append(b)

    for vertex, point in zip(top, top_new):
        block.vertex_attributes(vertex, 'xyz', point)


with open(FILE_O, 'w+') as f:
    data = [block.to_data()for block in blocks]
    json.dump(data, f)

Last updated