<html><head></head><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:13px"><div id="yui_3_16_0_ym19_1_1472711733302_21477">Hello,<o:p id="yui_3_16_0_ym19_1_1472711733302_21478"></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21479"><o:p id="yui_3_16_0_ym19_1_1472711733302_21480"> </o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21481">I’m trying to obtain a polyData with only the visible part
of a 3D model.<o:p id="yui_3_16_0_ym19_1_1472711733302_21482"></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21483">To that extent, I’m passing the original data through a vtkSelectVisiblePoints
filter. I’m using a mock renderer, mapper and actor because I want to
post-process the visible points before displaying them.<o:p id="yui_3_16_0_ym19_1_1472711733302_21484"></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21485"><o:p id="yui_3_16_0_ym19_1_1472711733302_21486"> </o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21487">However, the output of the vtkSelectVisiblePoints filter
contains “0” points for some reason…<o:p id="yui_3_16_0_ym19_1_1472711733302_21488"></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21489"><o:p id="yui_3_16_0_ym19_1_1472711733302_21490"> </o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21491">Using the following example:<o:p id="yui_3_16_0_ym19_1_1472711733302_21492"></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21493"><a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/SelectVisiblePoints" id="yui_3_16_0_ym19_1_1472711733302_21494">http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/SelectVisiblePoints</a><o:p id="yui_3_16_0_ym19_1_1472711733302_21495"></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21496"><o:p id="yui_3_16_0_ym19_1_1472711733302_21497"> </o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21498">I came up with the following piece of code:<o:p id="yui_3_16_0_ym19_1_1472711733302_21499"></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21500"><o:p id="yui_3_16_0_ym19_1_1472711733302_21501"> </o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21502"> // Render window and
interactor<o:p id="yui_3_16_0_ym19_1_1472711733302_21503"></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21504"> vtkSmartPointer<vtkRenderWindow>
renderWindow = <o:p id="yui_3_16_0_ym19_1_1472711733302_21505"></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21506">
vtkSmartPointer<vtkRenderWindow>::New();<o:p id="yui_3_16_0_ym19_1_1472711733302_21507"></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21508">
renderWindow->SetSize(800, 800);<o:p id="yui_3_16_0_ym19_1_1472711733302_21509"></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21510"><o:p id="yui_3_16_0_ym19_1_1472711733302_21511"> </o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21512">
vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor
= <o:p id="yui_3_16_0_ym19_1_1472711733302_21513"></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21514">
vtkSmartPointer<vtkRenderWindowInteractor>::New();<o:p id="yui_3_16_0_ym19_1_1472711733302_21515"></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21516"><o:p id="yui_3_16_0_ym19_1_1472711733302_21517"> </o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21518"> renderWindowInteractor->SetRenderWindow(renderWindow);<o:p id="yui_3_16_0_ym19_1_1472711733302_21519"></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21520"><o:p id="yui_3_16_0_ym19_1_1472711733302_21521"> </o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21522"><o:p id="yui_3_16_0_ym19_1_1472711733302_21523"> </o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21524"> // Mock renderer,
mapper and actor<o:p id="yui_3_16_0_ym19_1_1472711733302_21525"></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21526">
vtkSmartPointer<vtkRenderer> mockRenderer = <o:p id="yui_3_16_0_ym19_1_1472711733302_21527"></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21528"> vtkSmartPointer<vtkRenderer>::New();<o:p id="yui_3_16_0_ym19_1_1472711733302_21529"></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21530"><o:p id="yui_3_16_0_ym19_1_1472711733302_21531"> </o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21532">
renderWindow->AddRenderer(mockRenderer);<o:p id="yui_3_16_0_ym19_1_1472711733302_21533"></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21534"><o:p id="yui_3_16_0_ym19_1_1472711733302_21535"> </o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21536">
vtkSmartPointer<vtkPolyDataMapper> mockMapper = <o:p id="yui_3_16_0_ym19_1_1472711733302_21537"></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21538">
vtkSmartPointer<vtkPolyDataMapper>::New();<o:p id="yui_3_16_0_ym19_1_1472711733302_21539"></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21540">
mockMapper->SetInput(reader->GetOutput());<o:p id="yui_3_16_0_ym19_1_1472711733302_21541"></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21542"><o:p id="yui_3_16_0_ym19_1_1472711733302_21543"> </o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21544">
vtkSmartPointer<vtkActor> mockActor =
vtkSmartPointer<vtkActor>::New();<o:p id="yui_3_16_0_ym19_1_1472711733302_21545"></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21546">
mockActor->SetMapper(mockMapper);<o:p id="yui_3_16_0_ym19_1_1472711733302_21547"></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21548">
mockRenderer->AddActor(mockActor);<o:p id="yui_3_16_0_ym19_1_1472711733302_21549"></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21550"><o:p id="yui_3_16_0_ym19_1_1472711733302_21551"> </o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21552"> // Set camera to the
correct position<o:p id="yui_3_16_0_ym19_1_1472711733302_21553"></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21554">
mockRenderer->GetActiveCamera()->SetPosition(0, -1, 0);<o:p id="yui_3_16_0_ym19_1_1472711733302_21555"></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21556">
mockRenderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);<o:p id="yui_3_16_0_ym19_1_1472711733302_21557"></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21558">
mockRenderer->GetActiveCamera()->SetViewUp(0, 1, 0);<o:p id="yui_3_16_0_ym19_1_1472711733302_21559"></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21560">
mockRenderer->ResetCamera();<o:p id="yui_3_16_0_ym19_1_1472711733302_21561"></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21562"><o:p id="yui_3_16_0_ym19_1_1472711733302_21563"> </o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21564">
vtkSmartPointer<vtkSelectVisiblePoints> selectVisiblePoints = <o:p id="yui_3_16_0_ym19_1_1472711733302_21565"></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21566">
vtkSmartPointer<vtkSelectVisiblePoints>::New();<o:p id="yui_3_16_0_ym19_1_1472711733302_21567"></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21568">
selectVisiblePoints->SetInput(reader->GetOutput());<o:p id="yui_3_16_0_ym19_1_1472711733302_21569"></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21570">
selectVisiblePoints->SetRenderer(mockRenderer);<o:p id="yui_3_16_0_ym19_1_1472711733302_21571"></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21572">
selectVisiblePoints->Update();<o:p id="yui_3_16_0_ym19_1_1472711733302_21573"></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21574"><o:p id="yui_3_16_0_ym19_1_1472711733302_21575"> </o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21576"> std::cout <<
"Visible nr of points = " <<
selectVisiblePoints->GetOutput()->GetNumberOfPoints() << std::endl;</div><div id="yui_3_16_0_ym19_1_1472711733302_21576"><br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1472711733302_21723"> renderWindow->RemoveRenderer(mockRenderer);</div><div id="yui_3_16_0_ym19_1_1472711733302_21580"><o:p><br></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21580"><o:p><br></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21580"><o:p id="yui_3_16_0_ym19_1_1472711733302_21581"> </o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21582">… prints 0.<o:p id="yui_3_16_0_ym19_1_1472711733302_21583"></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21584"><o:p id="yui_3_16_0_ym19_1_1472711733302_21585"> </o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21586">Is it anything that I’m missing?<o:p id="yui_3_16_0_ym19_1_1472711733302_21587"></o:p></div><div id="yui_3_16_0_ym19_1_1472711733302_21588"><o:p id="yui_3_16_0_ym19_1_1472711733302_21589"> </o:p></div><div>
</div><div dir="ltr" id="yui_3_16_0_ym19_1_1472711733302_21590">Thank you,<br id="yui_3_16_0_ym19_1_1472711733302_21591">
Ioana<o:p id="yui_3_16_0_ym19_1_1472711733302_21592"></o:p></div></div></body></html>