capytaine.ui.vtk.mesh_viewer module¶
3D display of a mesh with VTK. Based on meshmagick <https://github.com/LHEEA/meshmagick> by François Rongère.
- class capytaine.ui.vtk.mesh_viewer.MeshViewer[source]¶
Bases:
object
This class implements a viewer based on VTK
- add_line(p0, p1, color=(0, 0, 0))[source]¶
Add a line to the viewer
- Parameters:
p0 (array_like) – position of one end point of the line
p1 (array_like) – position of a second end point of the line
color (array_like, optional) – RGB color of the line. Default is black (0, 0, 0)
- Return type:
vtkPolyData
- add_plane(center, normal)[source]¶
Add a plane to the viewer
- Parameters:
center (array_like) – The origin of the plane
normal (array_like) – The normal of the plane
- add_point(pos, color=(0, 0, 0))[source]¶
Add a point to the viewer
- Parameters:
pos (array_like) – The point’s position
color (array_like, optional) – The RGB color required for the point. Default is (0, 0, 0) corresponding to black.
- Return type:
vtkPolyData
- add_polydata(polydata, color=(1, 1, 0), representation='surface')[source]¶
Add a polydata object to the viewer
- Parameters:
polydata (vtkPolyData) – the object to be added
color (array_like, optional) – the color of the object. Default is yellow (1, 1, 0)
representation (str) – the representation mode of the object (‘surface’ or ‘wireframe’). Default is ‘surface’.
- add_vector(point, value, scale=1, color=(0, 0, 0))[source]¶
Add a vector to the viewer
- Parameters:
point (array_like) – starting point position of the vector
value (float) – the magnitude of the vector
scale (float, optional) – the scaling to apply to the vector for better visualization. Default is 1.
color (array_like) – The color of the vector. Default is black (0, 0, 0)