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

Method convert_to_voxel_attribute

tools/MeshUtils/AttributeUtils.cpp:218–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

216}
217
218VectorF AttributeUtils::convert_to_voxel_attribute(Mesh& mesh,
219 const VectorF& attribute) {
220 const size_t dim = mesh.get_dim();
221 const size_t num_vertices = mesh.get_num_vertices();
222 const size_t num_faces = mesh.get_num_faces();
223 const size_t num_voxels = mesh.get_num_voxels();
224
225 size_t attr_size = attribute.size();
226
227 if (attr_size == num_vertices || attr_size == dim*num_vertices) {
228 return convert_vertex_attribute_to_voxel_attribute(mesh, attribute);
229 } else if (attr_size == num_faces || attr_size == dim*num_faces) {
230 throw NotImplementedError(
231 "Converting face attribute to voxel attribute is not supported yet.");
232 } else if (attr_size == num_voxels || attr_size == dim*num_voxels) {
233 return attribute;
234 } else {
235 throw RuntimeError("Unknow attribute type.");
236 }
237}
238
239VectorF AttributeUtils::convert_to_voxel_attribute_from_name(Mesh& mesh,
240 const std::string& attribute_name) {

Callers 1

Calls 8

NotImplementedErrorClass · 0.85
RuntimeErrorClass · 0.85
get_dimMethod · 0.45
get_num_verticesMethod · 0.45
get_num_facesMethod · 0.45
get_num_voxelsMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected