exception kaolin.io.utils.NonHomogeneousMeshError(message)

Bases: Exception

Raised when expecting a homogeneous mesh but a heterogenous mesh is encountered.

kaolin.io.utils.heterogeneous_mesh_handler_naive_homogenize(*args, **kwargs)

Same as mesh_handler_naive_triangulate(), see docs. .. deprecated:: 0.14.0

kaolin.io.utils.heterogeneous_mesh_handler_skip(*args, **kwargs)

Skip heterogeneous meshes.

kaolin.io.utils.mesh_handler_naive_triangulate(vertices, face_vertex_counts, *features, face_assignments=None)

Triangulate a list of faces containing polygons of varying number of edges using naive fan triangulation.

  • vertices (torch.FloatTensor) – Vertices with shape (N, 3).

  • face_vertex_counts (torch.LongTensor) – Number of vertices for each face with shape (M) for M faces.

  • features – Variable length features that need to be handled as 1D Tensor (num_face_vertices), with one feature per face vertex. For example, faces as a tensor [face0_vertex0_id, face0_vertex1_id, face0_vertex2_id, face1_vertex0_id...] or as UV indices: [face0_vertex0_uv_idx, face0_vertex1_uv_idx, ...].

  • face_assignments (dict) – mapping from key to torch.LongTensor, where each value of the tensor corresponds to a face index. These indices will be expanded and rewritten to include triangulated face indices. Two modes are supported for face_assignments: 1) if 1D tensor, each face idx will be replaced with indices of faces it was split into 2) if 2D tensor, expects shape (K, 2), where [x, i] will be replaced with index of the first face [x, i] was split into, effectively supporting tensors containing (start,end].


Homogeneous list of attributes with exactly same type and number as function inputs.

  • vertices (torch.Tensor): unchanged vertices of shape (N, 3)

  • face_vertex_counts (torch.LongTensor): tensor of length new_num_faces filled with 3.

  • features (torch.Tensor): of same type as input and shape (new_num_faces, 3)

  • face_assignments (dict): returned only if face_assignments is set, with each value containing

    new face indices equivalent to the prior assignments (see two modes for face_assignments)

Return type