pyvista.PointSet#

class PointSet(*args, **kwargs)[source]#

Concrete class for storing a set of points.

This is a concrete class representing a set of points that specifies the interface for datasets that explicitly use “point” arrays to represent geometry. This class is useful for improving the performance of filters on point clouds, but not plotting.

For further details see VTK: vtkPointSet Details.

Parameters:
var_inpvtk.vtkPointSet, Sequence, optional

Flexible input type. Can be a vtk.vtkPointSet, in which case this PointSet object will be copied if deep=True and will be a shallow copy if deep=False.

List, numpy array, or sequence containing point locations. Must be an (N, 3) array of points.

deepbool, optional

Whether to copy the input points, or to create a PointSet from them without copying them. Setting deep=True ensures that the original arrays can be modified outside the mesh without affecting the mesh. Default is False.

force_floatbool, optional

Casts the datatype to float32 if points datatype is non-float. Default True. Set this to False to allow non-float types, though this may lead to truncation of intermediate floats when transforming datasets.

Notes

This class requires vtk>=9.1.0. This is an abstract class in vtk<9.1.0 and cannot be instantiated.

Examples

Create a simple point cloud of 10 points from a numpy array.

>>> import numpy as np
>>> import pyvista
>>> rng = np.random.default_rng()
>>> points = rng.random((10, 3))
>>> pset = pyvista.PointSet(points)

Plot the pointset. Note: this casts to a pyvista.PolyData internally when plotting.

>>> pset.plot(point_size=10)
../../../_images/pyvista-PointSet-1_00_00.png

Methods

PointSet.cast_to_polydata([deep])

Cast this dataset to polydata.

PointSet.plot([off_screen, full_screen, ...])

Plot a PyVista, numpy, or vtk object.

Attributes