Point clouds are one of the core structures in Polyscope. In addition to simply displaying the points, Polyscope can show any number of scalar, vector, or color quantities associated with the points.
As always, try clicking on a point to see the data associated with that point.
Registering a point cloud
Example: a point cloud of random points
import numpy as np import polyscope as ps ps.init() # generate some points points = np.random.rand(100, 3) # visualize! ps_cloud = ps.register_point_cloud("my points", points) ps.show()
register_point_cloud(name, points, enabled=None, radius=None, color=None, material=None)
Add a new point cloud structure to Polyscope.
nameis the name for the structure, as a string
N x 3numpy array of point locations
Additional optional keyword arguments:
enabledboolean, is the structure enabled initially
radiusfloat, a size for the points relative to the scene length scale (use
set_radius(val, relative=False)for absolute units)
colorfloat 3-tuple, default color values for the points as rgb in [0,1]
materialstring, name of material to use for cloud
if not specified, these optional parameters will assume a reasonable default value, or a persistant value if previously set.
2D point clouds are also supported, see 2D data.
Updating a point cloud
The locations of the points in a point cloud can be updated with the member function
update_point_positions(newPositions). All quantities will be preserved. Changing the number of points in the cloud is not supported, you will need to register a new cloud (perhaps with the same name to overwrite this one).
Example: update positions (continued from above)
new_pos = np.random.rand(100, 3) ps_cloud.update_point_positions(new_pos) ps.show()
Update the point positions in a point cloud structure.
newPos must be valid input as to initially construct a point cloud, with the same number of points.
Options control the appearance of the cloud. Note that these options can also be passed as keyword arguments to the initial
register_point_cloud(), as noted above.
|enabled||is the structure enabled?||
|point radius||size of rendered points||
|point color||default color for points||
|material||material for point||
Example: set options which affect the appearance of the point cloud
cloud = polyscope.register_point_cloud("my points", points) cloud.set_enabled(False) # disable cloud.set_enabled() # default is true cloud.set_radius(0.02) # radius is relative to a scene length scale by default cloud.set_radius(1.7, relative=False) # radius in absolute world units cloud.set_color((0.3, 0.6, 0.8)) # rgb triple on [0,1] cloud.set_material("candy") # alternately: ps.register_point_cloud("my points 2", points, enabled=False, material='candy', radius=0.02, color=(1., 0., 0.))