parameters: (vertices, faces, camera_proj, camera_rot=None, camera_trans=None,
                       camera_transform=None)
return_statement: return face_vertices_camera, face_vertices_image, face_normals
docstring: r"""Wrapper function to move and project vertices to cameras then index them with faces.
  
      Args:
          vertices (torch.Tensor):
              the meshes vertices, of shape :math:`(\text{batch_size}, \text{num_vertices}, 3)`.
          faces (torch.LongTensor):
              the meshes faces, of shape :math:`(\text{num_faces}, \text{face_size})`.
          camera_proj (torch.Tensor):
              the camera projection vector, of shape :math:`(3, 1)`.
          camera_rot (torch.Tensor, optional):
              the camera rotation matrices,
              of shape :math:`(\text{batch_size}, 3, 3)`.
          camera_trans (torch.Tensor, optional):
              the camera translation vectors,
              of  shape :math:`(\text{batch_size}, 3)`.
          camera_transform (torch.Tensor, optional):
              the camera transformation matrices,
              of shape :math:`(\text{batch_size}, 4, 3)`.
              Replace `camera_trans` and `camera_rot`.
      Returns:
          (torch.Tensor, torch.Tensor, torch.Tensor):
              The vertices in camera coordinate indexed by faces,
              of shape :math:`(\text{batch_size}, \text{num_faces}, \text{face_size}, 3)`.
              The vertices in camera plan coordinate indexed by faces,
              of shape :math:`(\text{batch_size}, \text{num_faces}, \text{face_size}, 2)`.
              The face normals, of shape :math:`(\text{batch_size}, \text{num_faces})`.
docstring_summary: r"""Wrapper function to move and project vertices to cameras then index them with faces.
docstring_tokens: r Wrapper function to move and project vertices to cameras then index them with faces .
function: def prepare_vertices(vertices, faces, camera_proj, camera_rot=None, camera_trans=None,
                       camera_transform=None):
      r"""Wrapper function to move and project vertices to cameras then index them with faces.
  
      Args:
          vertices (torch.Tensor):
              the meshes vertices, of shape :math:`(\text{batch_size}, \text{num_vertices}, 3)`.
          faces (torch.LongTensor):
              the meshes faces, of shape :math:`(\text{num_faces}, \text{face_size})`.
          camera_proj (torch.Tensor):
              the camera projection vector, of shape :math:`(3, 1)`.
          camera_rot (torch.Tensor, optional):
              the camera rotation matrices,
              of shape :math:`(\text{batch_size}, 3, 3)`.
          camera_trans (torch.Tensor, optional):
              the camera translation vectors,
              of  shape :math:`(\text{batch_size}, 3)`.
          camera_transform (torch.Tensor, optional):
              the camera transformation matrices,
              of shape :math:`(\text{batch_size}, 4, 3)`.
              Replace `camera_trans` and `camera_rot`.
      Returns:
          (torch.Tensor, torch.Tensor, torch.Tensor):
              The vertices in camera coordinate indexed by faces,
              of shape :math:`(\text{batch_size}, \text{num_faces}, \text{face_size}, 3)`.
              The vertices in camera plan coordinate indexed by faces,
              of shape :math:`(\text{batch_size}, \text{num_faces}, \text{face_size}, 2)`.
              The face normals, of shape :math:`(\text{batch_size}, \text{num_faces})`.
      """
      # Apply the transformation from camera_rot and camera_trans or camera_transform
      if camera_transform is None:
          assert camera_trans is not None and camera_rot is not None, \
              "camera_transform or camera_trans and camera_rot must be defined"
          vertices_camera = camera.rotate_translate_points(vertices, camera_rot,
                                                           camera_trans)
      else:
          assert camera_trans is None and camera_rot is None, \
              "camera_trans and camera_rot must be None when camera_transform is defined"
          padded_vertices = torch.nn.functional.pad(
              vertices, (0, 1), mode='constant', value=1.
          )
          vertices_camera = (padded_vertices @ camera_transform)
      # Project the vertices on the camera image plan
      vertices_image = camera.perspective_camera(vertices_camera, camera_proj)
      face_vertices_camera = ops.mesh.index_vertices_by_faces(vertices_camera, faces)
      face_vertices_image = ops.mesh.index_vertices_by_faces(vertices_image, faces)
      face_normals = ops.mesh.face_normals(face_vertices_camera, unit=True)
      return face_vertices_camera, face_vertices_image, face_normals
function_tokens: def prepare_vertices ( vertices , faces , camera_proj , camera_rot = None , camera_trans = None , camera_transform = None ) : # Apply the transformation from camera_rot and camera_trans or camera_transform if camera_transform is None : assert camera_trans is not None and camera_rot is not None , "camera_transform or camera_trans and camera_rot must be defined" vertices_camera = camera . rotate_translate_points ( vertices , camera_rot , camera_trans ) else : assert camera_trans is None and camera_rot is None , "camera_trans and camera_rot must be None when camera_transform is defined" padded_vertices = torch . nn . functional . pad ( vertices , ( 0 , 1 ) , mode = 'constant' , value = 1. ) vertices_camera = ( padded_vertices @ camera_transform ) # Project the vertices on the camera image plan vertices_image = camera . perspective_camera ( vertices_camera , camera_proj ) face_vertices_camera = ops . mesh . index_vertices_by_faces ( vertices_camera , faces ) face_vertices_image = ops . mesh . index_vertices_by_faces ( vertices_image , faces ) face_normals = ops . mesh . face_normals ( face_vertices_camera , unit = True ) return face_vertices_camera , face_vertices_image , face_normals