pyblenderSDIC.meshes.TriangleMesh3D.visualize#

TriangleMesh3D.visualize(pattern_path: str | None = None, highlighted_triangles: Integral | Sequence[Integral] | None = None, highlight_color: Sequence[float] = [0.5, 0.5, 0.5], intersect_points: IntersectPoints | None = None, intersect_color: Sequence[float] = [0.0, 0.0, 1.0], display_edges: bool = True, edges_color: Sequence[float] = [0.2, 0.2, 0.2]) None[source]#

Visualize the mesh using Open3D.

This method displays the 3D mesh using Open3D’s interactive viewer. Optionally, it can highlight specific mesh triangles in and show 3D intersection points. Furthermore, it can visualize the mesh with a pattern if provided.

../../_images/trimesh3d_visualize.png

Example of a mesh with highlighted triangles and intersection vertices.#

from pyblenderSDIC.mesh import TriangleMesh3D

# Create a TriangleMesh3D instance
mesh = TriangleMesh3D(vertices=..., triangles=...)

# Visualize the mesh with highlighted triangles and intersection vertices
mesh.visualize(pattern_path="path/to/pattern.png", highlighted_triangles=[0, 1, 2], intersect_points=intersect_points)
Parameters:
  • pattern_path (Optional[str], optional) – The path to the texture pattern image file to be applied to the mesh. If None, no texture is applied. Default is None.

  • highlighted_triangles (Optional[Union[Integral, Sequence[Integral]]], optional) – The indices of the triangles to be highlighted in the mesh. If a single integer is provided, it highlights that triangle. If a sequence of integers is provided, it highlights all specified triangles. If None, no triangles are highlighted. Default is None.

  • highlight_color (Sequence[float], optional) – The RGB color to use for highlighting the specified triangles. Each value should be in the range [0, 1]. Default is [0.5, 0.5, 0.5].

  • intersect_points (Optional[IntersectPoints], optional) – An IntersectPoints object containing the 3D intersection points to be visualized. If None, no intersection points are visualized. Default is None.

  • intersect_color (Sequence[float], optional) – The RGB color to use for the intersection vertices. Each value should be in the range [0, 1]. Default is [0.0, 0.0, 1.0].

  • display_edges (bool, optional) – If True, the edges of the mesh will be displayed. Default is True.

  • edges_color (Sequence[float], optional) – The RGB color to use for the edges of the mesh. Each value should be in the range [0, 1]. Default is [0.2, 0.2, 0.2].