irtk.scene.Mesh¶
- class irtk.scene.Mesh(v: torch.Tensor | ndarray | List | Tuple, f: torch.Tensor | ndarray | List | Tuple, uv: torch.Tensor | ndarray | List | Tuple, fuv: torch.Tensor | ndarray | List | Tuple, mat_id: str | None = None, to_world: torch.Tensor | ndarray | List | Tuple = torch.eye, use_face_normal: bool = True, can_change_topology: bool = False, radiance: torch.Tensor | ndarray | List | Tuple | None = None)¶
A class representing a mesh.
- __init__(v: torch.Tensor | ndarray | List | Tuple, f: torch.Tensor | ndarray | List | Tuple, uv: torch.Tensor | ndarray | List | Tuple, fuv: torch.Tensor | ndarray | List | Tuple, mat_id: str | None = None, to_world: torch.Tensor | ndarray | List | Tuple = torch.eye, use_face_normal: bool = True, can_change_topology: bool = False, radiance: torch.Tensor | ndarray | List | Tuple | None = None) None ¶
Initializes a Mesh object.
- Parameters:
v (TensorLike) – The vertex positions (float, shape (num_v, 3)).
f (TensorLike) – The face indices (int, shape (num_f, 3)).
uv (TensorLike) – The uv coordinates (float, shape (num_uv, 2)).
fuv (TensorLike) – The uv face indices (int, shape (num_f, 3)).
mat_id (Optional[str]) – The material ID.
to_world (TensorLike) – The transformation matrix to world coordinates (float).
use_face_normal (bool) – Whether to use face normal.
can_change_topology (bool) – Whether the topology can be changed. This might lead to certain optimizations.
radiance (Optional[TensorLike]) – The radiance if used as an emitter (float, shape (3, )).
- classmethod from_file(filename: str, mat_id: str | None = None, to_world: torch.Tensor | ndarray | List | Tuple = torch.eye, use_face_normal: bool = True, can_change_topology: bool = False, radiance: torch.Tensor | ndarray | List | Tuple | None = None, flip_tex: bool = True) Mesh ¶
Creates a Mesh object from a file.
- Parameters:
filename (str) – The filename of the mesh.
mat_id (Optional[str]) – The material ID.
to_world (TensorLike) – The transformation matrix to world coordinates (float).
use_face_normal (bool) – Whether to use face normal.
can_change_topology (bool) – Whether the topology can be changed.
radiance (Optional[TensorLike]) – The radiance if used as an emitter (float, shape (3, )).
flip_tex (bool) – Whether to flip the texture coordinates.
- Returns:
A Mesh object.
- Return type: