File: mesh_threshold.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 (16 lines) | stat: -rw-r--r-- 548 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
"""Extracts cells of a Mesh which satisfy
the threshold criterion: 37 < scalar < 37.5"""
from vedo import *

man = Mesh(dataurl+"man.vtk")

scals = man.vertices[:, 0] + 37  # pick y coords of vertices

# scals data is added to mesh points with automatic name PointScalars
man.cmap("cool", scals).add_scalarbar(title="threshold", horizontal=True)

# make a copy and threshold the mesh
cutman = man.clone().threshold("Scalars", 37, 37.5)

# distribute the meshes on the 2 renderers
show([(man, __doc__), cutman], N=2, elevation=-30, axes=11).close()