Vertex voronoi example in slam

# Authors:
# Guillaume Auzias <guillaume.auzias@univ-amu.fr>
# Julien Barrès <julien.barres@etu.univ-amu.fr>

# License: BSD (3-clause)
# sphinx_gallery_thumbnail_number = 2

Importation of slam modules

import slam.io as sio
import slam.plot as splt
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)

Out:

<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)

Out:

    -percent polygon with obtuse angle  29.4067067927773
(2328, 3)
(2328,)
9.094947017729282e-13

Visualization

visb_sc = splt.visbrain_plot(
    mesh=mesh, tex=vert_vor, caption="vertex voronoi", cblabel="vertex voronoi"
)
visb_sc.preview()
example vertex voronoi

Total running time of the script: ( 0 minutes 1.035 seconds)

Gallery generated by Sphinx-Gallery