# 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

# set radius/length/color of the vectors

# ambient vectors don't get auto-scaled, useful e.g. when representing offsets in 3D space

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

• name string, a name for the quantity
• values an Nx3 numpy array, vectors at points (or Nx2 for 2D data)

• enabled boolean, whether the quantity is initially enabled
• 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
• length float, a (relative) length for the vectors
• radius float, a (relative) radius for the vectors
• color 3-tuple, color for the vectors