capytaine.new_meshes.visualization module

capytaine.new_meshes.visualization.show_3d(mesh, *, backend=None, **kwargs)[source]

Dispatch the 3D viewing to one of the available backends below.

capytaine.new_meshes.visualization.show_matplotlib(mesh, ax=None, bounding_box=None, normal_vectors=False, scale_normal_vector=None, color_field=None, cmap=None, cbar_label=None, **kwargs)[source]

Visualize the mesh using Matplotlib.

Parameters:
  • ax (matplotlib axis) – The 3d axis in which to plot the mesh. If not provided, create a new one.

  • bounding_box (tuple[tuple[int]], optional) – Min and max coordinates values to display in each three dimensions.

  • normal_vectors (bool, optional) – If True, display normal vector.

  • scale_normal_vector (array of shape (nb_faces, ), optional) – Scale separately each of the normal vectors.

  • color_field (array of shape (nb_faces, ), optional) – Scalar field to be plot on the mesh (optional).

  • cmap (matplotlib colormap, optional) – Colormap to use for scalar field plotting.

  • cbar_label (string, optional) – Label for colorbar show color field scale

  • Other parameters are passed to Poly3DCollection.

capytaine.new_meshes.visualization.show_pyvista(mesh, *, plotter=None, normal_vectors=False, display_free_surface=True, water_depth=inf, color_field=None, cbar_label='', **kwargs) pv.Plotter | None[source]

Visualize the mesh using PyVista.

PyVista default keyboards controls: https://docs.pyvista.org/api/plotting/plotting

Parameters:
  • mesh (Mesh) – The mesh object to visualize.

  • plotter (pv.Plotter, optional) – If provided, use this PyVista plotter and return it at the end. Otherwise a new one is created and the 3D view is displayed at the end.

  • normal_vectors (bool, optional) – If True, display normal vector (default: True)

  • display_free_surface (bool, optional) – If True, display free surface and if water_depth is finite display the sea bottom. (default: True)

  • water_depth (float, optional) – Where to display the sea bottom if display_free_surface is True

  • color_field (array of shape (nb_faces, ), optional) – Scalar field to be plot on the mesh.

  • cmap (matplotlib colormap, optional) – Colormap to use for scalar field plotting.

  • cbar_label (string, optional) – Label for colorbar show color field scale

  • kwargs (additional optional arguments) – Additional arguments passed to PyVista’s add_mesh methods for customization (e.g. mesh color).