(support_mesh, print_dir, support_length)
| 28 | return mesh; |
| 29 | |
| 30 | def add_base(support_mesh, print_dir, support_length): |
| 31 | Z_dir = np.array([0.0, 0.0, 1.0]); |
| 32 | vertices = support_mesh.vertices.reshape((-1, 3), order="C"); |
| 33 | faces = support_mesh.faces.reshape((-1, 3), order="C"); |
| 34 | |
| 35 | height = np.dot(print_dir, vertices.T).ravel(); |
| 36 | projection = vertices - np.outer(height, print_dir); |
| 37 | |
| 38 | if np.all(print_dir == Z_dir): |
| 39 | rot = Quaternion().to_matrix(); |
| 40 | else: |
| 41 | rot = Quaternion.fromData(print_dir, Z_dir).to_matrix(); |
| 42 | projection = np.dot(rot, projection.T); |
| 43 | bbox_min = np.amin(projection, axis=1) - Z_dir * 0.15; |
| 44 | bbox_max = np.amax(projection, axis=1) + Z_dir * 0.15; |
| 45 | base = generate_box_mesh(bbox_min, bbox_max); |
| 46 | base_vertices = np.dot(rot.T, base.vertices.T).T\ |
| 47 | + print_dir * np.amin(height); |
| 48 | |
| 49 | num_support_vertices = support_mesh.num_vertices; |
| 50 | vertices = np.vstack([vertices, base_vertices]); |
| 51 | faces = np.vstack([faces, base.faces + num_support_vertices]); |
| 52 | |
| 53 | return form_mesh(vertices, faces); |
| 54 | |
| 55 | def generate_supports(wire_network, print_dir, support_length, |
| 56 | support_thickness, tol): |
no test coverage detected