Scalar Quantities
Visualize scalar (real or integer)-valued data at the points of a point cloud.
Example:
#include "polyscope/point_cloud.h"
std::vector<double> xC(points.size());
for (size_t i = 0; i < points.size(); i++) {
xC[i] = points[i].x;
}
// visualize
polyscope::getPointCloud(pointCloudName)->addScalarQuantity("xC", xC);
PointCloud::addScalarQuantity(std::string name, const T& values, DataType type = DataType::STANDARD)
Add a scalar quantity to the point cloud.
values
is the array of scalars at points. The type should be adaptable to afloat
scalar array. The length should be the number of points in the point cloud.
Categorical Scalars
Scalar quantities can also be used to visualize integer-valued labels such as categories, classes, segmentations, flags, etc.
Add the labels as a scalar quantity where the values just happen to be integers (each integer represents a particular class or label), and set DataType::CATEGORICAL
. This will change the visualization to a different set of defaults, adjust some shading rules, and use a distinct color from the colormap for each label.
Scalar Quantity Options
These options and behaviors are available for all types of scalar quantities on any structure.
Parameter | Meaning | Getter | Setter | Persistent? |
---|---|---|---|---|
enabled | is the quantity enabled? | bool isEnabled() |
setEnabled(bool newVal) |
yes |
color map | the color map to use | std::string getColorMap() |
setColorMap(std::string newMap) |
yes |
map range | the lower and upper limits used when mapping the data in to the color map | std::pair<double,double> getMapRange() |
setMapRange(std::pair<double,double>) and resetMapRange() |
no |
isolines enabled | are isolines shaded (default=false ) |
bool getIsolinesEnabled() |
setIsolinesEnabled(bool newVal) |
yes |
isoline style | stripes or thin contour lines | IsolineStyle getIsolineStyle() |
setIsolineStyle(IsolineStyle newVal) |
yes |
isoline period | period of isoline stripes, in data units | float getIsolinePeriod() |
setIsolinePeriod(float newVal) |
yes |
isoline darkness | darkness of isoline stripes (default=0.7 ) |
float getIsolineDarkness() |
setIsolineDarkness(float newVal) |
yes |
contour thickness | thickness of isoline contour lines (default=0.3 ) |
float getIsolineContourThickness() |
setIsolineContourThickness(float newVal) |
yes |
(all setters return this
to support chaining. setEnabled() returns generic quantity, so chain it last)