(mesh, bd_vertex_indices, bd_vertex_positions)
| 82 | return x; |
| 83 | |
| 84 | def tutte_3D(mesh, bd_vertex_indices, bd_vertex_positions): |
| 85 | assembler = pymesh.Assembler(mesh); |
| 86 | L = assembler.assemble("laplacian"); |
| 87 | |
| 88 | is_constraint = np.zeros(mesh.num_vertices, dtype=bool); |
| 89 | is_constraint[bd_vertex_indices] = True; |
| 90 | is_variable = np.logical_not(is_constraint); |
| 91 | |
| 92 | M, rhs = init_harmonic_system(L, bd_vertex_indices, bd_vertex_positions, is_variable); |
| 93 | x = solve(M, rhs, "SparseLU", 1e-6); |
| 94 | |
| 95 | out_vertices = np.zeros((mesh.num_vertices, 3)); |
| 96 | out_vertices[is_constraint,:] = bd_vertex_positions; |
| 97 | out_vertices[is_variable,:] = x; |
| 98 | |
| 99 | return pymesh.form_mesh(out_vertices, np.zeros((0, 3)), mesh.voxels); |
| 100 | |
| 101 | def main(): |
| 102 | args = parse_args(); |
no test coverage detected