Vector Quantities
Visualize vector-valued data at the points of a point cloud.
Example:
import numpy as np
import polyscope as ps
ps.init()
# register a point cloud
N = 100
points = np.random.rand(N, 3)
ps_cloud = ps.register_point_cloud("my points", points)
# generate some random vectors per-point
vecs = np.random.rand(N, 3)
# basic visualization
ps_cloud.add_vector_quantity("rand vecs", vecs, enabled=True)
# set radius/length/color of the vectors
ps_cloud.add_vector_quantity("rand vecs", vecs, radius=0.001, length=0.005, color=(0.2, 0.5, 0.5))
# ambient vectors don't get auto-scaled, useful e.g. when representing offsets in 3D space
ps_cloud.add_vector_quantity("vecs ambient", vecs, vectortype='ambient')
# view the point cloud with all of these quantities
ps.show()
PointCloud.add_vector_quantity(name, values, enabled=None, vectortype="standard", length=None, radius=None, color=None)
Add a vector quantity to the point cloud.
namestring, a name for the quantityvaluesanNx3numpy array, vectors at points (orNx2for 2D data)
This function also accepts optional keyword arguments listed below, which customize the appearance and behavior of the quantity.
Vector Quantity Options¶
When adding a vector quantity, the following keyword options can be set. These are available for all kinds of vector quantities on all structures.
Keyword arguments:
enabledboolean, whether the quantity is initially enabled (Default:false)vectortype, one of"standard"or"ambient". Ambient vectors don’t get auto-scaled, and thus are good for representing values in absolute 3D world coordinates. (Default:"standard")lengthfloat, a (relative) length for the vectorsradiusfloat, a (relative) radius for the vectorscolor3-tuple, color for the vectorsmaterialstring, shading material for the vectors
If not specified, these optional parameters will assume a reasonable default value, or a persistent value if previously set.