-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Submesh 3/n: Add submeshing functionality
Summary: Copypasting the docstring: ``` Split a mesh into submeshes, defined by face indices of the original Meshes object. Args: face_indices: Let the original mesh have verts_list() of length N. Can be either - List of length N. The n-th element is a list of length num_submeshes_n (empty lists are allowed). Each element of the n-th sublist is a LongTensor of length num_faces. - List of length N. The n-th element is a possibly empty padded LongTensor of shape (num_submeshes_n, max_num_faces). Returns: Meshes object with selected submeshes. The submesh tensors are cloned. Currently submeshing only works with no textures or with the TexturesVertex texture. Example: Take a Meshes object `cubes` with 4 meshes, each a translated cube. Then: * len(cubes) is 4, len(cubes.verts_list()) is 4, len(cubes.faces_list()) is 4, * [cube_verts.size for cube_verts in cubes.verts_list()] is [8, 8, 8, 8], * [cube_faces.size for cube_faces in cubes.faces_list()] if [6, 6, 6, 6], Now let front_facet, top_and_bottom, all_facets be LongTensors of sizes (2), (4), and (12), each picking up a number of facets of a cube by specifying the appropriate triangular faces. Then let `subcubes = cubes.submeshes([[front_facet, top_and_bottom], [], [all_facets], []])`. * len(subcubes) is 3. * subcubes[0] is the front facet of the cube contained in cubes[0]. * subcubes[1] is a mesh containing the (disconnected) top and bottom facets of cubes[0]. * subcubes[2] is a clone of cubes[2]. * There are no submeshes of cubes[1] and cubes[3] in subcubes. * subcubes[0] and subcubes[1] are not watertight. subcubes[2] is. ``` Reviewed By: bottler Differential Revision: D35440657 fbshipit-source-id: 8a6d2d300ce226b5b9eb440688528b5e795195a1
- Loading branch information
1 parent
8596fca
commit 050f650
Showing
2 changed files
with
249 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters