How to mark some area of an object with specific color in vtkPolyData?

Hello, the picture above is an object that I display with vtkPolyData. I want to make the protrusion parts in this object become red to show the position of defects. However, I fail serveral times. The class I use is pcl::PointXYZRGB to color the point.

Here are codes:



Can someone help me?

I tried your approach and indeed it doesn’t work.

If you individual colors, you need to set the following on the mapper
mapper->ScalarVisibilityOn()
or a single color can be set on the actor,
actor->GetProperty()->SetColor(255,0,0);


Now there is red in the object. However, why the shape is so strange? When I connect the points with CellArrays, the object will be quite normal. In contrary, the vtkGlyphfilter resulted in this abnormal problem.

Your points may be wrong. I cannot say without having a more complere example