# Point Clouds

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.

• name is the name for the structure, as a string
• points is an N x 3 numpy array of point locations

• enabled boolean, is the structure enabled initially
• radius float, a size for the points relative to the scene length scale (use set_radius(val, relative=False) for absolute units)
• color float 3-tuple, default color values for the points as rgb in [0,1]
• material string, 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()


PointCloud.update_point_positions(newPos)

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

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.

Parameter Meaning Getter Setter Persistent?
enabled is the structure enabled? is_enabled() set_enabled(newVal=True) yes
point radius size of rendered points get_radius() set_radius(newVal, relative=True) yes
point color default color for points get_color() set_color(newVal) yes
material material for point get_material() set_material(newVal) yes

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