cartoreader_lite.postprocessing.geometry#

Functions

create_tri_mesh(mesh)

Creates a Trimesh from an unstructured grid

project_points(mesh, points)

Projects a set of points onto a triangulated surface mesh

cartoreader_lite.postprocessing.geometry.create_tri_mesh(mesh: pyvista.core.pointset.UnstructuredGrid) trimesh.base.Trimesh#

Creates a Trimesh from an unstructured grid

Parameters

mesh (pv.UnstructuredGrid) – mesh to convert. Will be automatically triangulated

Returns

The converted trimesh

Return type

trimesh.Trimesh

cartoreader_lite.postprocessing.geometry.project_points(mesh: Union[trimesh.base.Trimesh, pyvista.core.pointset.UnstructuredGrid], points: numpy.ndarray) Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray]#

Projects a set of points onto a triangulated surface mesh

Parameters
  • mesh (Union[trimesh.Trimesh, pv.UnstructuredGrid]) – A mesh to project on. Will be converted to a trimesh, if it is not one already (see create_tri_mesh())

  • points (np.ndarray) – Points to project [Nx3]

Returns

The returned triplet will consist of:

  • The projected points [Nx3]

  • The projection distance [N]

  • The triangle index on which the projection ended up [N]

Return type

Tuple[np.ndarray, np.ndarray, np.ndarray]