class_docstr: `FeatureConnector` for triangle meshes.
  
  During `_generate_examples`, the feature connector accepts as input any of:
  
    * `str`: path to a {obj,stl,ply,glb} triangle mesh.
    * `trimesh.Trimesh`: A triangle mesh object.
    * `trimesh.Scene`: A scene object containing multiple TriangleMesh
       objects.
    * `dict:` A dictionary containing the vertices and faces of the mesh (see
       output format below).
  
  Output:
    A dictionary containing:
    # TODO(b/156112246): Add additional attributes (vertex normals, colors,
    # texture coordinates).
  
    * 'vertices': A `float32` tensor with shape `[N, 3]` denoting the vertex
    coordinates, where N is the number of vertices in the mesh.
    * 'faces': An `int64` tensor with shape `[F, 3]` denoting the face vertex
    indices, where F is the number of faces in the mesh.
  
    Note: In case the input specifies a Scene (with multiple meshes), the output
    will be a single TriangleMesh which combines all the triangle meshes in the
    scene.
class_docstr_tok: ["`","FeatureConnector","`","for","triangle","meshes",".","During","`","_generate_examples","`",",","the","feature","connector","accepts","as","input","any","of",":","*","`","str","`",":","path","to","a","{","obj",",","stl",",","ply",",","glb","}","triangle","mesh",".","*","`","trimesh.Trimesh","`",":","A","triangle","mesh","object",".","*","`","trimesh.Scene","`",":","A","scene","object","containing","multiple","TriangleMesh","objects",".","*","`","dict",":","`","A","dictionary","containing","the","vertices","and","faces","of","the","mesh","(","see","output","format","below",")",".","Output",":","A","dictionary","containing",":","#","TODO","(","b\/156112246",")",":","Add","additional","attributes","(","vertex","normals",",","colors",",","#","texture","coordinates",")",".","*","'vertices","'",":","A","`","float32","`","tensor","with","shape","`","[","N",",","3","]","`","denoting","the","vertex","coordinates",",","where","N","is","the","number","of","vertices","in","the","mesh",".","*","'faces","'",":","An","`","int64","`","tensor","with","shape","`","[","F",",","3","]","`","denoting","the","face","vertex","indices",",","where","F","is","the","number","of","faces","in","the","mesh",".","Note",":","In","case","the","input","specifies","a","Scene","(","with","multiple","meshes",")",",","the","output","will","be","a","single","TriangleMesh","which","combines","all","the","triangle","meshes","in","the","scene","."]
code: def _convert_to_trimesh_feature(self, obj):
      if isinstance(obj, triangle_mesh.Trimesh):
          vertices = np.array(obj.vertices)
          faces = np.array(obj.faces, dtype=np.uint64)
      elif isinstance(obj, triangle_mesh.Scene):
          # Concatenate all the vertices and faces of the triangle meshes in the
          # scene.
          # TODO(b/156117488): Change to a different merging algorithm to avoid
          # duplicated vertices.
          vertices_list = [
              np.array(mesh.vertices) for mesh in obj.geometry.values()
          ]
          faces_list = np.empty(
              (len(obj.geometry.values())), dtype=np.dtype(object)
          )
          for idx, mesh in enumerate(obj.geometry.values()):
              faces_list[idx] = np.array(mesh.faces, dtype=np.uint64)
          faces_offset = np.cumsum(
              [vertices.shape[0] for vertices in vertices_list],
              dtype=np.uint64,
          )
          faces_list[1:] += faces_offset[:-1]
          vertices = np.concatenate(vertices_list, axis=0)
          faces = np.concatenate(faces_list, axis=0)
      else:
          raise ValueError("obj should be either a Trimesh or a Scene")
      return {
          "vertices": vertices.astype(np.float32),
          "faces": faces,
      }
  
file_path: graphics/tensorflow_graphics/datasets/features/trimesh_feature.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  import six
  import tensorflow.compat.v2
  from tensorflow_datasets import features
  from tensorflow_graphics.io import triangle_mesh
label_desc: Use image node_id 3 for calling the TriangleMesh obj's underlying member method code with example usage: obj._convert_to_trimesh_feature(obj) and returns: dict