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 vtkPointSet.

Parameters:
var_inpvtkPointSet, MatrixLike[float], optional

Flexible input type. Can be a 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, default: False

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.

force_floatbool, default: True

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

validatebool | MeshValidationFields | sequence[MeshValidationFields], default: False

Validate the mesh using validate_mesh() after initialization. Set this to True to validate all fields, or specify any combination of fields allowed by validate_mesh.

Added in version 0.47.

Examples#

Download Python source code | Download Jupyter notebook

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

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

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

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

Attributes#

PointSet.area

Return 0.0 since a PointSet has no area.

PointSet.volume

Return 0.0 since a PointSet has no volume.

Inherited Attributes#

DataSet.active_normals

Return the active normals as an array.

DataSet.active_scalars

Return the active scalars as an array.

DataSet.active_scalars_info

Return the active scalar’s association and name.

DataSet.active_scalars_name

Return the name of the active scalars.

DataSet.active_tensors

Return the active tensors array.

DataSet.active_tensors_info

Return the active tensor’s field and name: [field, name].

DataSet.active_tensors_name

Return the name of the active tensor array.

DataSet.active_texture_coordinates

Return the active texture coordinates on the points.

DataSet.active_vectors

Return the active vectors array.

DataSet.active_vectors_info

Return the active vector’s association and name.

DataSet.active_vectors_name

Return the name of the active vectors array.

DataObject.actual_memory_size

Return the actual size of the dataset object.

DataSet.array_names

Return a list of array names for the dataset.

DataSet.arrows

Return a glyph representation of the active vector data as arrows.

DataSet.bounding_sphere

Compute the radius and center of a bounding sphere.

DataSet.bounds

Return the bounding box of this dataset.

_BoundsSizeMixin.bounds_size

Return the size of each axis of the object’s bounding box.

DataSet.cell

A generator that provides an easy way to loop over all cells.

DataSet.cell_data

Return cell data as DataSetAttributes.

DataSet.center

Set or return the center of the bounding box.

DataSet.dimensionality

Return the number of spatial dimensions spanned by this dataset’s points.

DataSet.distinct_cell_types

Return the set of distinct cell types in this dataset.

DataObject.field_data

Return FieldData as DataSetAttributes.

DataSet.has_nonlinear_cells

Return True if the mesh contains any non-linear cells.

DataSet.is_empty

Return True if there are no points.

DataSet.length

Return the length of the diagonal of the bounding box.

DataSet.max_cell_dimensionality

Return the maximum spatial dimensionality of all cells in this mesh.

DataObject.memory_address

Get address of the underlying VTK C++ object.

DataSet.min_cell_dimensionality

Get the minimum spatial dimensionality of all cells in this mesh.

DataSet.n_arrays

Return the number of arrays present in the dataset.

DataSet.n_cells

Return the number of cells in the entire dataset.

DataSet.n_points

Return the number of points in the entire dataset.

DataSet.number_of_cells

Return the number of cells.

DataSet.number_of_points

Return the number of points.

DataSet.point_data

Return point data as DataSetAttributes.

DataSet.points

Return a reference to the points as a NumPy object.

DataObject.user_dict

Set or return a user-specified data dictionary.

Methods#

PointSet.cast_to_polydata([deep])

Cast this dataset to polydata.

PointSet.cast_to_unstructured_grid()

Cast this dataset to pyvista.UnstructuredGrid.

PointSet.cell_data_to_point_data(*args, **kwargs)

Raise PointSets do not have cells.

PointSet.cell_quality(*args, **kwargs)

Raise extract all edges are not supported.

PointSet.cell_validator(*args, **kwargs)

Raise cell operations are not supported.

PointSet.compute_cell_sizes(*args, **kwargs)

Raise extract all edges are not supported.

PointSet.contour(*args, **kwargs)

Raise dimension reducing operations are not supported.

PointSet.decimate_boundary(*args, **kwargs)

Raise cell operations are not supported.

PointSet.delaunay_3d([alpha, tol, offset, ...])

Construct a 3D Delaunay triangulation of the mesh.

PointSet.explode([factor])

Push each individual cell away from the center of the dataset.

PointSet.extract_all_edges(*args, **kwargs)

Raise extract all edges are not supported.

PointSet.extract_geometry(*args, **kwargs)

Raise extract geometry are not supported.

PointSet.extract_surface(*args, **kwargs)

Raise extract surface are not supported.

PointSet.find_cells_along_line(*args, **kwargs)

Raise cell operations are not supported.

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

Plot a PyVista, NumPy, or VTK object.

PointSet.point_data_to_cell_data(*args, **kwargs)

Raise PointSets do not have cells.

PointSet.point_is_inside_cell(*args, **kwargs)

Raise cell operations are not supported.

PointSet.remove_cells(*args, **kwargs)

Raise cell operations are not supported.

PointSet.separate_cells(*args, **kwargs)

Raise cell operations are not supported.

PointSet.shrink(*args, **kwargs)

Raise cell operations are not supported.

PointSet.slice(*args, **kwargs)

Raise dimension reducing operations are not supported.

PointSet.slice_along_axis(*args, **kwargs)

Raise dimension reducing operations are not supported.

PointSet.slice_along_line(*args, **kwargs)

Raise dimension reducing operations are not supported.

PointSet.slice_implicit(*args, **kwargs)

Raise dimension reducing operations are not supported.

PointSet.slice_orthogonal(*args, **kwargs)

Raise dimension reducing operations are not supported.

PointSet.tessellate(*args, **kwargs)

Raise cell operations are not supported.

PointSet.threshold([value, scalars, invert, ...])

Apply a vtkThreshold filter to the input dataset.

PointSet.threshold_percent([percent, ...])

Threshold the dataset by a percentage of its range on the active scalars array.

PointSet.triangulate(*args, **kwargs)

Raise cell operations are not supported.

Inherited Methods#

DataObject.add_field_data

Add field data.

DataObject.cast_to_multiblock

Convert this DataObject to a MultiBlock.

DataSet.cast_to_pointset

Extract the points of this dataset and return a pyvista.PointSet.

DataSet.cast_to_poly_points

Extract the points of this dataset and return a pyvista.PolyData.

DataSet.cell_neighbors

Get the cell neighbors of the ind-th cell.

DataSet.cell_neighbors_levels

Get consecutive levels of cell neighbors.

_PointSetBase.center_of_mass

Return the coordinates for the center of mass of the mesh.

DataSet.clear_cell_data

Remove all cell arrays.

DataSet.clear_data

Remove all arrays from point/cell/field data.

DataObject.clear_field_data

Remove all field data.

DataSet.clear_point_data

Remove all point arrays.

DataObject.copy

Return a copy of the object.

DataObject.copy_attributes

Copy the data attributes of the input dataset object.

DataSet.copy_from

Overwrite this dataset in-place with the new dataset’s geometries and data.

DataSet.copy_meta_from

Copy pyvista meta data onto this object from another object.

DataObject.copy_structure

Copy the structure (geometry and topology) of the input dataset object.

DataObject.deep_copy

Overwrite this data object with another data object as a deep copy.

DataSet.find_cells_intersecting_line

Find the index of cells that intersect a line.

DataSet.find_cells_within_bounds

Find the index of cells in this mesh within bounds.

DataSet.find_closest_cell

Find index of closest cell in this mesh to the given point.

DataSet.find_closest_point

Find index of closest point in this mesh to the given point.

DataSet.find_containing_cell

Find index of a cell that contains the given point.

DataSet.get_array

Search both point, cell, and field data for an array.

DataSet.get_array_association

Get the association of an array.

DataSet.get_cell

Return a pyvista.Cell object.

DataSet.get_data_range

Get the min and max of a named array.

DataObject.head

Return the header stats of this dataset.

DataSet.intersect_with_line

Locate points and cell ids that intersect a line.

DataSet.point_cell_ids

Get the cell IDs that use the ind-th point.

DataSet.point_neighbors

Get the point neighbors of the ind-th point.

DataSet.point_neighbors_levels

Get consecutive levels of point neighbors.

_PointSetBase.points_to_double

Convert the points datatype to double precision.

DataSet.rename_array

Change array name by searching for the array then renaming it.

DataObject.save

Save this vtk object to file.

DataSet.set_active_scalars

Find the scalars by name and appropriately sets it as active.

DataSet.set_active_tensors

Find the tensors by name and appropriately sets it as active.

DataSet.set_active_vectors

Find the vectors by name and appropriately sets it as active.

_PointSetBase.shallow_copy

Create a shallow copy from a different dataset into this one.

DataSet.to_arrow

Return this dataset’s point or cell arrays as a pyarrow.Table.

DataSet.to_pandas

Return this dataset’s point or cell arrays as a pandas.DataFrame.

Filters#

DataSetFilters.align

Align a dataset to another.

DataSetFilters.align_xyz

Align a dataset to the x-y-z axes.

DataSetFilters.bounding_box

Return a bounding box for this dataset.

DataObjectFilters.cell_centers

Generate points at the center of the cells in this dataset.

DataObjectFilters.clip

Clip a dataset by a plane by specifying the origin and normal.

DataObjectFilters.clip_box

Clip a dataset by a bounding box defined by the bounds.

DataSetFilters.clip_scalar

Clip a dataset by a scalar.

DataObjectFilters.clip_slab

Clip a dataset by a slab of finite thickness around a plane.

DataSetFilters.clip_surface

Clip any mesh type using a pyvista.PolyData surface mesh.

DataSetFilters.color_labels

Add RGB(A) scalars to labeled data.

DataSetFilters.compute_boundary_mesh_quality

Compute metrics on the boundary faces of a mesh.

DataSetFilters.compute_derivative

Compute derivative-based quantities of point/cell scalar field.

DataSetFilters.compute_implicit_distance

Compute the implicit distance from the points to a surface.

DataSetFilters.connectivity

Find and label connected regions.

DataObjectFilters.convex_hull

Compute the convex hull from this mesh’s points.

DataObjectFilters.ctp

Transform cell data into point data.

DataObjectFilters.elevation

Generate scalar values on a dataset.

DataSetFilters.extract_cells

Return a subset of the grid.

DataSetFilters.extract_cells_by_type

Extract cells of a specified type.

DataSetFilters.extract_feature_edges

Extract edges from the surface of the mesh.

DataSetFilters.extract_largest

Extract largest connected set in mesh.

DataSetFilters.extract_points

Return a subset of the grid (with cells) that contains any of the given point indices.

DataSetFilters.extract_values

Return a subset of the mesh based on the values of point or cell data.

DataObjectFilters.flip_normal

Flip mesh about the normal.

DataObjectFilters.flip_x

Flip mesh about the x-axis.

DataObjectFilters.flip_y

Flip mesh about the y-axis.

DataObjectFilters.flip_z

Flip mesh about the z-axis.

DataSetFilters.gaussian_splatting

Splat points into a volume using a Gaussian distribution.

DataSetFilters.glyph

Copy a geometric representation (called a glyph) to the input dataset.

DataSetFilters.integrate_data

Integrate point and cell data.

DataSetFilters.interpolate

Interpolate values onto this mesh from a given dataset.

DataSetFilters.merge

Join one or many other grids to this grid.

DataSetFilters.merge_points

Merge duplicate points in this mesh.

DataSetFilters.oriented_bounding_box

Return an oriented bounding box (OBB) for this dataset.

DataSetFilters.outline

Produce an outline of the full extent for the input dataset.

DataSetFilters.outline_corners

Produce an outline of the corners for the input dataset.

DataSetFilters.pack_labels

Renumber labeled data such that labels are contiguous.

DataSetFilters.partition

Break down input dataset into a requested number of partitions.

DataSetFilters.plot_over_circular_arc

Sample a dataset along a circular arc and plot it.

DataSetFilters.plot_over_circular_arc_normal

Sample a dataset along a circular arc defined by a normal and polar vector and plot it.

DataSetFilters.plot_over_line

Sample a dataset along a high resolution line and plot.

DataObjectFilters.ptc

Transform point data into cell data.

DataObjectFilters.reflect

Reflect a dataset across a plane.

DataSetFilters.remove_nan_cells

Remove cells whose scalar values are NaN.

DataObjectFilters.resize

Resize the dataset’s bounds.

DataObjectFilters.rotate

Rotate mesh about a point with a rotation matrix or Rotation object.

DataObjectFilters.rotate_vector

Rotate mesh about a vector.

DataObjectFilters.rotate_x

Rotate mesh about the x-axis.

DataObjectFilters.rotate_y

Rotate mesh about the y-axis.

DataObjectFilters.rotate_z

Rotate mesh about the z-axis.

DataObjectFilters.sample

Resample array data from a passed mesh onto this mesh.

DataSetFilters.sample_over_circular_arc

Sample a dataset over a circular arc.

DataSetFilters.sample_over_circular_arc_normal

Sample a dataset over a circular arc defined by a normal and polar vector and plot it.

DataSetFilters.sample_over_line

Sample a dataset onto a line.

DataSetFilters.sample_over_multiple_lines

Sample a dataset onto a multiple lines.

DataObjectFilters.scale

Scale the mesh.

DataSetFilters.select_enclosed_points

Mark points as to whether they are inside a closed surface.

DataSetFilters.select_interior_points

Mark points from this mesh as inside or outside relative to a closed surface.

DataSetFilters.sort_labels

Sort labeled data by number of points or cells.

DataSetFilters.split_bodies

Find, label, and split connected bodies/volumes.

DataSetFilters.split_values

Split mesh into separate sub-meshes using point or cell data.

DataSetFilters.streamlines

Integrate a vector field to generate streamlines.

DataSetFilters.streamlines_evenly_spaced_2D

Generate evenly spaced streamlines on a 2D dataset.

DataSetFilters.streamlines_from_source

Generate streamlines of vectors from the points of a source mesh.

DataSetFilters.surface_indices

Return the surface indices of a grid.

DataSetFilters.texture_map_to_plane

Texture map this dataset to a user defined plane.

DataSetFilters.texture_map_to_sphere

Texture map this dataset to a user defined sphere.

DataObjectFilters.transform

Transform this mesh with a 4x4 transform.

DataObjectFilters.translate

Translate the mesh.

DataObjectFilters.validate_mesh

Validate this mesh’s array data, points, and cells.

DataSetFilters.voxelize

Voxelize mesh to UnstructuredGrid.

DataSetFilters.voxelize_binary_mask

Voxelize mesh as a binary ImageData mask.

DataSetFilters.voxelize_rectilinear

Voxelize mesh to create a RectilinearGrid voxel volume.

DataSetFilters.warp_by_scalar

Warp the dataset’s points by a point data scalars array’s values.

DataSetFilters.warp_by_vector

Warp the dataset’s points by a point data vectors array’s values.