Add new point to PolyData in PyVista / Best way to process XYZ to TIN

971 Views Asked by At

Is it possible to add new point (X, Y, Z) to PolyData points array, without creating new PolyData? I want to make new Triangulate Surface (TIN) really fast, but creating a new PolyData from NumPy array takes around 1 second. Meanwhile, e.g. function extrude (which creates new nodes) takes around 0.002s (technically I want to add 1 new node with known coordinates).

After I update PolyData I'm using "delaunay_2d" function (which takes also around 0.002s) and plot the results (TIN surface).

Or maybe somebody know other way to update and process XYZ data to TIN and visulize it around 10 times per second in Python 3? PyVista seems to be really, really cool, but I can't manage to make such a trivial thing: (

1

There are 1 best solutions below

2
On BEST ANSWER

It's possible to modify the points on a mesh with:

>>> import numpy as np
>>> import pyvista as pv
>>> mesh = pv.Sphere()
>>> print(mesh.n_points)
>>> mesh.points = np.vstack((mesh.points, [0, 0, 0]))
>>> print(mesh.n_points)
842
843