Modules | PY
Iso
Scalar field isocontours and isobands.
The Iso module is the scalar field pipeline. It is driven by field crossings rather than by polygon intersections, so it is a tier of its own: the curves a field traces on a mesh, and the mesh recut so those curves are edges.
import trueform as tf
Isocontours
Extract isocontour curves from scalar fields on meshes.
Single Isocontour
scalar_field = tf.distance(tf.Point(mesh.points), plane)
paths, points = tf.isocontours(mesh, scalar_field, 0.0)
Multiple Isocontours
thresholds = np.array([0.0, 0.5, 1.0], dtype=np.float32)
paths, points = tf.isocontours(mesh, scalar_field, thresholds)
Curves are returned as (paths, points) tuples where paths is an OffsetBlockedArray of index sequences and points is a numpy array of coordinates.
Isobands
Extract regions between consecutive threshold values from scalar fields:
(faces, points), labels, face_labels = tf.isobands(mesh, scalar_field, [-1.0, 0.0, 1.0])
# Select specific bands
(faces, points), labels, face_labels = tf.isobands(
mesh, scalar_field, cut_values, selected_bands=[1, 3])
# With curves
(faces, points), labels, face_labels, (paths, curve_pts) = tf.isobands(
mesh, scalar_field, cut_values, return_curves=True)
labels is the band each output face lies in, face_labels the index of the original face it came from.
For implementation details, see the C++ Iso documentation.
