File: boundaries.py

package info (click to toggle)
vedo 2025.5.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 10,404 kB
  • sloc: python: 64,792; javascript: 1,932; xml: 437; sh: 139; makefile: 6
file content (19 lines) | stat: -rw-r--r-- 656 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""Extract points on the boundary of a mesh.
Add an ID label to all vertices."""
from vedo import *

# Load a mesh from a URL, compute normals, and clean duplicate points
b = Mesh(dataurl+'290.vtk')
b.compute_normals().clean().linewidth(0.1)

# Get the point IDs on the boundary of the mesh
pids = b.boundaries(return_point_ids=True)

# Create a Points object to represent the boundary points
pts = Points(b.vertices[pids]).c('red5').ps(10)

# Create a Label object for all the vertices in the mesh
labels = b.labels('id', scale=10).c('green2')

# Show the mesh, boundary points, vertex labels, and docstring 
show(b, pts, labels, __doc__, zoom=2).close()