Skip to content
Snippets Groups Projects
Commit 47221fb4 authored by Rainer Kartmann's avatar Rainer Kartmann
Browse files

Add point cloud drawing methods taking override color

parent c7283aab
No related branches found
No related tags found
No related merge requests found
......@@ -65,7 +65,7 @@ namespace armarx::viz
}
template <typename ColorCoeff = int>
PointCloud& addPoint(float x, float y, float z, ColorCoeff r, ColorCoeff g, ColorCoeff b, ColorCoeff a = 255)
PointCloud & addPoint(float x, float y, float z, ColorCoeff r, ColorCoeff g, ColorCoeff b, ColorCoeff a = 255)
{
return addPoint(x, y, z, simox::Color(r, g, b, a));
}
......@@ -102,6 +102,8 @@ namespace armarx::viz
return addPoint(p.x, p.y, p.z, color);
}
/// Draw a point cloud.
template <class PointCloudT>
PointCloud& pointCloud(const PointCloudT& cloud, bool checkFinite = true)
{
......@@ -116,6 +118,22 @@ namespace armarx::viz
return *this;
}
/// Draw a point cloud with fixed color.
template <class PointCloudT>
PointCloud& pointCloud(const PointCloudT& cloud, Color color, bool checkFinite = true)
{
clear();
for (const auto& p : cloud)
{
if (isfinite(p, checkFinite))
{
addPoint(p, color);
}
}
return *this;
}
/// Draw a point cloud with given indices.
template <class PointCloudT>
PointCloud& pointCloud(const PointCloudT& cloud, const std::vector<int>& indices,
bool checkFinite = true)
......@@ -123,7 +141,7 @@ namespace armarx::viz
clear();
for (int i : indices)
{
ARMARX_CHECK_FITS_SIZE(i, int(cloud.size()));
ARMARX_CHECK_FITS_SIZE(i, cloud.size());
const auto& p = cloud.at(size_t(i));
if (isfinite(p, checkFinite))
{
......@@ -133,11 +151,32 @@ namespace armarx::viz
return *this;
}
/// Draw a point cloud with given indices and fixed color.
template <class PointCloudT>
PointCloud& pointCloud(const PointCloudT& cloud, const std::vector<int>& indices,
Color color, bool checkFinite = true)
{
clear();
for (int i : indices)
{
ARMARX_CHECK_FITS_SIZE(i, cloud.size());
const auto& p = cloud.at(size_t(i));
if (isfinite(p, checkFinite))
{
addPoint(p, color);
}
}
return *this;
}
PointCloud& pointSizeInPixels(float s)
{
data_->pointSizeInPixels = s;
return *this;
}
private:
template <class PointT>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment