Note
Go to the end to download the full example code.
Vertex voronoi example in slam¶
# Authors:
# Guillaume Auzias <guillaume.auzias@univ-amu.fr>
# Julien Barrès <julien.barres@etu.univ-amu.fr>
# License: MIT
# sphinx_gallery_thumbnail_number = 2
- NOTE: there is no visualization tool in slam, but we provide at the
end of this script exemplare code to do the visualization with an external solution
Importation of slam modules
import slam.io as sio
import slam.vertex_voronoi as svv
import numpy as np
mesh = sio.load_mesh("../examples/data/example_mesh.gii")
mesh.apply_transform(mesh.principal_inertia_transform)
<trimesh.Trimesh(vertices.shape=(2328, 3), faces.shape=(4652, 3))>
vert_vor = svv.vertex_voronoi(mesh)
print(mesh.vertices.shape)
print(vert_vor.shape)
print(np.sum(vert_vor) - mesh.area)
-percent polygon with obtuse angle 29.4067067927773
(2328, 3)
(2328,)
0.0
VISUALIZATION USING EXTERNAL TOOLS¶
# Visualization visb_sc = splt.visbrain_plot(
mesh=mesh, tex=vert_vor, caption=”vertex voronoi”, cblabel=”vertex voronoi”
) visb_sc.preview()
Total running time of the script: (0 minutes 0.525 seconds)