Skip to content

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

#include "polyscope/point_cloud.h"

std::vector<glm::vec3> points;

// generate points
for (size_t i = 0; i < 3000; i++) {
      glm::vec3{polyscope::randomUnit() - .5, 
                polyscope::randomUnit() - .5, 
                polyscope::randomUnit() - .5});

// visualize!
polyscope::registerPointCloud("really great points", points);

polyscope::registerPointCloud(std::string name, const T& pointPositions)

Add a new point cloud structure to Polyscope.

  • pointPositions is the array of 3D point locations. The type should be adaptable to an array of float-valued 3-vectors. The length will be the number of points.

Note: the inner vector type of the input must be 3D dimensional, or you risk compiler errors, segfaults, or worse. If you want to register a 2D point cloud, registerPointCloud2D exists with the same signature. See 2D data.

Updating a point cloud

The locations of the points in a point cloud can be updated with the member function updatePointPositions(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).

void PointCloud::updatePointPositions(const V& newPositions)

Update the point positions in a point cloud structure.

  • newPositions is the vector array of 3D point locations. The type should be adaptable to an array of float-valued 3-vectors. The length must be equal to the current number of points.

Note: updatePointPositions2D exists with the same signature. See 2D data.


Parameter Meaning Getter Setter Persistent?
enabled is the structure enabled? bool isEnabled() setEnabled(bool newVal) yes
transparency transparency alpha for this structure in [0,1] double getTransparency() setTransparency(double val) yes
point radius size of rendered points double getPointRadius() setPointRadius(double newVal, bool isRelative=true) yes
point color default color for point glm::vec3 getPointColor() setPointColor(glm::vec3 newVal) yes
material what material to use std::string getMaterial() setMaterial(std::string name) yes

(all setters return this to support chaining. setEnabled()/setTransparency() return generic setter, so chain them last)