Skip to content

Color Quantities

Visualize color rgb-valued data at the points of a point cloud.


#include "polyscope/point_cloud.h"

std::vector<std::array<double, 3>> randColor(points.size());
for (size_t i = 0; i < points.size(); i++) {
  randColor[i] = {{polyscope::randomUnit(), polyscope::randomUnit(), polyscope::randomUnit()}};

// visualize
polyscope::getPointCloud(pointCloudName)->addColorQuantity("random color", randColor);

PointCloud::addColorQuantity(std::string name, const T& values)

Add a color quantity to the point cloud.

  • values is the array of colors at points. The type should be adaptable to a 3-vector array of floats. The length should be the number of points in the point cloud.

RGB values are interpreted in the range [0,1].


Parameter Meaning Getter Setter Persistent?
enabled is the quantity enabled? bool isEnabled() setEnabled(bool newVal) yes

(all setters return this to support chaining. setEnabled() returns generic quantity, so chain it last)