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

Function fit_into_unit_sphere

scripts/fem_check.py:112–123  ·  view source on GitHub ↗
(mesh)

Source from the content-addressed store, hash-verified

110 return values, sol_grads;
111
112def fit_into_unit_sphere(mesh):
113 bbox_min, bbox_max = mesh.bbox;
114 bbox_radius = numpy.linalg.norm(bbox_max - bbox_min) * 0.5;
115 bbox_center = 0.5 * (bbox_min + bbox_max);
116 if bbox_radius == 0.0:
117 raise IOError("Input mesh is degenerate to a single point.");
118
119 vertices = mesh.vertices;
120 tris = mesh.faces;
121 tets = mesh.voxels;
122 vertices = (vertices - bbox_center) / bbox_radius;
123 return pymesh.form_mesh(vertices, tris, tets);
124
125def main():
126 args = parse_args();

Callers 1

mainFunction · 0.85

Calls 3

IOErrorClass · 0.85
normMethod · 0.80
form_meshMethod · 0.45

Tested by

no test coverage detected