def find_form(mesh): vertices = [ mesh.vertex_coordinates(vkey) for vkey in sorted(list(mesh.vertices())) ] edges = list(mesh.edges()) fixed = mesh.vertices_on_boundary() q = [1.0] * len(edges) loads = [[0.0, 0.0, 50.0 / len(vertices)]] * len(vertices) xyz, q, f, l, r = fd_numpy(vertices, edges, fixed, q, loads) for vkey, coordinates in zip(sorted(list(mesh.vertices())), xyz): mesh_move_vertex_to(mesh, coordinates, vkey)
def find_form(mesh, total_load): vertices = [mesh.vertex_coordinates(vkey) for vkey in mesh.vertices()] edges = list(mesh.edges()) fixed = mesh.vertices_on_boundary() q = [1.0] * len(edges) total_area = mesh.area() loads = [[0.0, 0.0, total_load * mesh.vertex_area(vkey) / total_area] for vkey in mesh.vertices()] xyz, q, f, l, r = fd_numpy(vertices, edges, fixed, q, loads) for vkey, coordinates in zip(mesh.vertices(), xyz): mesh_move_vertex_to(mesh, coordinates, vkey)
def fix_boundaries(mesh, polyline_points, t=0): polyline = Polyline(polyline_points) n = len(mesh.vertices_on_boundary()) for i, vkey in enumerate(mesh.boundaries()[0]): xyz = polyline.point((t + i / n) % 1.0) mesh_move_vertex_to(mesh, xyz, vkey)
def fix_boundaries(mesh): n = len(mesh.vertices_on_boundary()) for i, vkey in enumerate(mesh.boundaries()[0]): xyz = add_vectors(mesh.vertex_centroid(), circle_evaluate(2.0 * pi * i / n, 10)) mesh_move_vertex_to(mesh, xyz, vkey)