pyvista.PointSet#
- class PointSet(points=None, deep=False, force_float=True)[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
- points
Sequence
,optional
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. Settingdeep=True
ensures that the original arrays can be modified outside the mesh without affecting the mesh. Default isFalse
.- force_floatbool,
optional
Casts the datatype to
float32
if points datatype is non-float. DefaultTrue
. Set this toFalse
to allow non-float types, though this may lead to truncation of intermediate floats when transforming datasets.
- points
Notes
This class requires
vtk>=9.1.0
. This is an abstract class invtk<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)
Methods
PointSet.add_field_array
(scalars, name[, deep])Add field data.
PointSet.add_field_data
(array, name[, deep])Add field data.
PointSet.cast_to_pointset
([deep])Get a new representation of this object as a
pyvista.PointSet
.PointSet.cast_to_polydata
([deep])Cast this dataset to polydata.
Get a new representation of this object as a
pyvista.UnstructuredGrid
.PointSet.cell_bounds
(ind)Return the bounding box of a cell.
PointSet.cell_centers
([vertex, progress_bar])Generate points at the center of the cells in this dataset.
Transform cell data into point data.
Return the number of points in a cell.
PointSet.cell_points
(ind)Return the points in a cell.
PointSet.cell_type
(ind)Return the type of a cell.
PointSet.center_of_mass
([scalars_weight])Return the coordinates for the center of mass of the mesh.
Remove all arrays from point/cell/field data.
Remove all cell data.
Remove all cell arrays.
Remove all arrays from point/cell/field data.
Remove all field data.
Remove all field data.
Remove all point data.
Remove all point arrays.
Clear the textures from this mesh.
PointSet.clip
([normal, origin, invert, ...])Clip a dataset by a plane by specifying the origin and normal.
PointSet.clip_box
([bounds, invert, factor, ...])Clip a dataset by a bounding box defined by the bounds.
PointSet.clip_scalar
([scalars, invert, ...])Clip a dataset by a scalar.
PointSet.clip_surface
(surface[, invert, ...])Clip any mesh type using a
pyvista.PolyData
surface mesh.Compute a function of (geometric) quality for each cell of a mesh.
PointSet.compute_cell_sizes
([length, area, ...])Compute sizes for 1D (length), 2D (area) and 3D (volume) cells.
PointSet.compute_derivative
([scalars, ...])Compute derivative-based quantities of point/cell scalar field.
PointSet.compute_implicit_distance
(surface)Compute the implicit distance from the points to a surface.
PointSet.connectivity
([largest, progress_bar])Find and label connected bodies/volumes.
PointSet.contour
([isosurfaces, scalars, ...])Contour an input self by an array.
PointSet.copy
([deep])Return a copy of the object.
PointSet.copy_attributes
(dataset)Copy the data attributes of the input dataset object.
Copy pyvista meta data onto this object from another object.
PointSet.copy_structure
(dataset)Copy the structure (geometry and topology) of the input dataset object.
PointSet.ctp
([pass_cell_data, progress_bar])Transform cell data into point data.
PointSet.decimate_boundary
([...])Return a decimated version of a triangulation of the boundary.
PointSet.deep_copy
(to_copy)Overwrite this data object with another data object as a deep copy.
PointSet.delaunay_3d
([alpha, tol, offset, ...])Construct a 3D Delaunay triangulation of the mesh.
PointSet.elevation
([low_point, high_point, ...])Generate scalar values on a dataset.
PointSet.extract_all_edges
([progress_bar])Extract all the internal/external edges of the dataset as PolyData.
PointSet.extract_cells
(ind[, progress_bar])Return a subset of the grid.
Extract edges from the surface of the mesh.
PointSet.extract_geometry
([progress_bar])Extract the outer surface of a volume or structured grid dataset.
PointSet.extract_largest
([inplace, progress_bar])Extract largest connected set in mesh.
PointSet.extract_points
(ind[, ...])Return a subset of the grid (with cells) that contains any of the given point indices.
PointSet.extract_surface
([pass_pointid, ...])Extract surface mesh of the grid.
PointSet.find_cells_along_line
(pointa, pointb)Find the index of cells in this mesh along a line.
Find the index of cells in this mesh within bounds.
PointSet.find_closest_cell
(point[, ...])Find index of closest cell in this mesh to the given point.
PointSet.find_closest_point
(point[, n])Find index of closest point in this mesh to the given point.
Find index of a cell that contains the given point.
PointSet.flip_normal
(normal[, point, ...])Flip mesh about the normal.
PointSet.flip_x
([point, ...])Flip mesh about the x-axis.
PointSet.flip_y
([point, ...])Flip mesh about the y-axis.
PointSet.flip_z
([point, ...])Flip mesh about the z-axis.
PointSet.get_array
(name[, preference])Search both point, cell and field data for an array.
PointSet.get_array_association
(name[, ...])Get the association of an array.
PointSet.get_data_range
([arr_var, preference])Get the non-NaN min and max of a named array.
PointSet.glyph
([orient, scale, factor, ...])Copy a geometric representation (called a glyph) to the input dataset.
PointSet.head
([display, html])Return the header stats of this dataset.
PointSet.interpolate
(target[, sharpness, ...])Interpolate values onto this mesh from a given dataset.
PointSet.merge
([grid, merge_points, ...])Join one or many other grids to this grid.
PointSet.outline
([generate_faces, progress_bar])Produce an outline of the full extent for the input dataset.
PointSet.outline_corners
([factor, progress_bar])Produce an outline of the corners for the input dataset.
PointSet.overwrite
(mesh)Overwrite this dataset inplace with the new dataset's geometries and data.
PointSet.plot
([off_screen, full_screen, ...])Plot a vtk or numpy object.
PointSet.plot_over_circular_arc
(pointa, ...)Sample a dataset along a circular arc and plot it.
Sample a dataset along a resolution circular arc defined by a normal and polar vector and plot it.
PointSet.plot_over_line
(pointa, pointb[, ...])Sample a dataset along a high resolution line and plot.
Transform point data into cell data.
Convert the points datatype to double precision.
PointSet.probe
(points[, tolerance, ...])Sample data values at specified point locations.
PointSet.ptc
([pass_point_data, progress_bar])Transform point data into cell data.
PointSet.reflect
(normal[, point, inplace, ...])Reflect a dataset across a plane.
PointSet.remove_cells
(ind[, inplace])Remove cells.
PointSet.rename_array
(old_name, new_name[, ...])Change array name by searching for the array then renaming it.
PointSet.rotate_vector
(vector, angle[, ...])Rotate mesh about a vector.
PointSet.rotate_x
(angle[, point, ...])Rotate mesh about the x-axis.
PointSet.rotate_y
(angle[, point, ...])Rotate mesh about the y-axis.
PointSet.rotate_z
(angle[, point, ...])Rotate mesh about the z-axis.
PointSet.sample
(target[, tolerance, ...])Resample array data from a passed mesh onto this mesh.
PointSet.sample_over_circular_arc
(pointa, ...)Sample a dataset over a circular arc.
Sample a dataset over a circular arc defined by a normal and polar vector and plot it.
PointSet.sample_over_line
(pointa, pointb[, ...])Sample a dataset onto a line.
Sample a dataset onto a multiple lines.
PointSet.save
(filename[, binary, texture])Save this vtk object to file.
PointSet.scale
(xyz[, ...])Scale the mesh.
PointSet.select_enclosed_points
(surface[, ...])Mark points as to whether they are inside a closed surface.
PointSet.set_active_scalars
(name[, preference])Find the scalars by name and appropriately sets it as active.
PointSet.set_active_tensors
(name[, preference])Find the tensors by name and appropriately sets it as active.
PointSet.set_active_vectors
(name[, preference])Find the vectors by name and appropriately sets it as active.
PointSet.shallow_copy
(to_copy)Create a shallow copy from a different dataset into this one.
PointSet.shrink
([shrink_factor, progress_bar])Shrink the individual faces of a mesh.
PointSet.slice
([normal, origin, ...])Slice a dataset by a plane at the specified origin and normal vector orientation.
PointSet.slice_along_axis
([n, axis, ...])Create many slices of the input dataset along a specified axis.
PointSet.slice_along_line
(line[, ...])Slice a dataset using a polyline/spline as the path.
PointSet.slice_orthogonal
([x, y, z, ...])Create three orthogonal slices through the dataset on the three cartesian planes.
PointSet.split_bodies
([label, progress_bar])Find, label, and split connected bodies/volumes.
PointSet.streamlines
([vectors, ...])Integrate a vector field to generate streamlines.
Generate evenly spaced streamlines on a 2D dataset.
PointSet.streamlines_from_source
(source[, ...])Generate streamlines of vectors from the points of a source mesh.
PointSet.surface_indices
([progress_bar])Return the surface indices of a grid.
PointSet.tessellate
([max_n_subdivide, ...])Tessellate a mesh.
PointSet.texture_map_to_plane
([origin, ...])Texture map this dataset to a user defined plane.
PointSet.texture_map_to_sphere
([center, ...])Texture map this dataset to a user defined sphere.
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.transform
(trans[, ...])Transform this mesh with a 4x4 transform.
PointSet.translate
(xyz[, ...])Translate the mesh.
PointSet.triangulate
([inplace, progress_bar])Return an all triangle mesh.
PointSet.warp_by_scalar
([scalars, factor, ...])Warp the dataset's points by a point data scalars array's values.
PointSet.warp_by_vector
([vectors, factor, ...])Warp the dataset's points by a point data vectors array's values.
Attributes
Return the active normals as an array.
Return the active scalars as an array.
Return the active scalar's association and name.
Return the name of the active scalars.
Return or set the active texture coordinates on the points.
Return the active tensors array.
Return the active tensor's field and name: [field, name].
Return the name of the active tensor array.
Return the active vectors array.
Return the active vector's association and name.
Return the name of the active vectors array.
Return the actual size of the dataset object.
Return a list of array names for the dataset.
Return a glyph representation of the active vector data as arrows.
Return the bounding box of this dataset.
Return vtkCellData as DataSetAttributes.
Return vtkCellData as DataSetAttributes.
Return the center of the bounding box.
Return the range of the bounding box.
Return vtkFieldData as DataSetAttributes.
Return FieldData as DataSetAttributes.
Return the length of the diagonal of the bounding box.
Get address of the underlying VTK C++ object.
Return the number of arrays present in the dataset.
Return the number of cells in the entire dataset.
Return the number of points in the entire dataset.
Return the number of cells.
Return the number of points.
Return vtkPointData as DataSetAttributes.
Return vtkPointData as DataSetAttributes.
Return a reference to the points as a numpy object.
Return the active texture coordinates on the points.
Return a dictionary to hold compatible
vtk.vtkTexture
objects.Return active vectors.
Return the mesh volume.