MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / tutte_3D

Function tutte_3D

scripts/map_to_sphere.py:84–99  ·  view source on GitHub ↗
(mesh, bd_vertex_indices, bd_vertex_positions)

Source from the content-addressed store, hash-verified

82 return x;
83
84def 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
101def main():
102 args = parse_args();

Callers 1

mainFunction · 0.85

Calls 4

assembleMethod · 0.95
init_harmonic_systemFunction · 0.85
solveFunction · 0.85
form_meshMethod · 0.45

Tested by

no test coverage detected