Hello,
I am trying to add an outline (or better a silhouette) to a subset of points visualized as a Glyph3D. I already managed to change the color to the subset points. In my code, I use vtkExtractGeometry and vtkVertexGlyphFilter to extract the subset from the point set. This work as expected and I obtain the subset point’s ID that I use to change the points’ colors:
auto* frustum = static_cast<vtkAreaPicker*>(GetInteractor()->GetPicker())->GetFrustum();
vtkNew<vtkExtractGeometry> extractGeometry;
extractGeometry->SetImplicitFunction(frustum);
extractGeometry->SetInputData(ptsElement->getGlyph()->GetOutput());
extractGeometry->Update();
vtkNew<vtkVertexGlyphFilter> glyphFilter;
glyphFilter->SetInputConnection(extractGeometry->GetOutputPort());
glyphFilter->Update();
auto* selected = glyphFilter->GetOutput();
For the outline I use a vtkOutlineSource with a vtkPolyDataMapper to create a vtkGlyph3D for the subset:
Outline = vtkSmartPointer<vtkOutlineSource>::New();
OutlineGlyph = vtkSmartPointer<vtkGlyph3D>::New();
OutlineGlyph->ScalingOff();
OutlineGlyph->SetScaleModeToDataScalingOff();
OutlineGlyph->SetSourceConnection(Outline->GetOutputPort());
OutlineMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
OutlineMapper->SetInputConnection(OutlineGlyph->GetOutputPort());
OutlineActor = vtkSmartPointer<vtkActor>::New();
OutlineActor->SetMapper(OutlineMapper);
OutlineActor->GetProperty()->SetColor(1.0, 0.0, 0.0);
OutlineActor->GetProperty()->SetAmbient(1.0);
OutlineActor->GetProperty()->SetDiffuse(0.0);
Then I pass the above glyphFilter output to the OutlineGlyph:
OutlineGlyph->SetInputData(selected);
//glyph3D->SetScaleFactor(scaleFactor);
OutlineGlyph->Update();
GetDefaultRenderer()->AddActor(OutlineActor);
What I obtain is that the selected points (in green) have some scattered red dots added but not and outline:
I tried also drawing a Silhouette with vtkPolyDataSilhouette but it worked only when drawing on the whole point set but nothing showed up when passing the subset data.
An alternative approach, yet much less efficient I think, could be to create an actor for each subset’s point.
Any help is much appreciated,
Carlo