Meshes
The Panopti Mesh
object represents a triangular surface mesh. To add a mesh to your scene:
import panopti
import trimesh # just for io
import numpy as np
viewer = panopti.connect(server_url="http://localhost:8080", viewer_id='client')
mesh = trimesh.load('mesh.obj')
verts = mesh.vertices # (V, 3) ndarray
faces = mesh.faces # (F, 3) ndarray
viewer.add_mesh(
vertices=verts,
faces=faces,
name="MyMesh"
)
BaseViewer.add_mesh
add_mesh
Adds a Mesh object to the viewer.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vertices
|
ndarray
|
(V, 3) array of vertex coordinates. |
required |
faces
|
ndarray
|
(F, 3) array of face indices. |
required |
name
|
str
|
Name for the mesh. |
required |
visible
|
bool
|
Whether the mesh is visible. |
True
|
position
|
Union[Tuple[float, float, float], ndarray]
|
Position of the mesh (XYZ). |
(0, 0, 0)
|
rotation
|
Union[Tuple[float, float, float], ndarray]
|
Rotation of the mesh (XYZ). |
(0, 0, 0)
|
scale
|
Union[Tuple[float, float, float], ndarray]
|
Scale of the mesh in (XYZ). |
(1.0, 1.0, 1.0)
|
vertex_colors
|
ndarray
|
(V, 3) array of vertex colors. |
None
|
face_colors
|
ndarray
|
(F, 3) array of face colors. |
None
|
material
|
Optional[Any]
|
Panopti material object. |
None
|
Returns:
Name | Type | Description |
---|---|---|
Mesh |
Mesh
|
The created panopti mesh object. |
Mesh.update(**kwargs)
update
Updates this mesh's attributes and propagate updates to the viewer.
Example:
Mesh.delete()
delete
Deletes this mesh from the viewer.
Mesh.trans_mat property
trans_mat
Returns the 4x4 transformation matrix corresponding to the object's position, rotation, and scale in the viewer.
Mesh.viewer_verts property
viewer_verts
Returns the Mesh's vertices under the transformation given by trans_mat
.