<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_1473055205833_4016">The answer was right there, in the documentation of the filter:</div><div id="yui_3_16_0_ym19_1_1473055205833_4017"><br id="yui_3_16_0_ym19_1_1473055205833_4018"></div><div id="yui_3_16_0_ym19_1_1473055205833_4019">"Warning:</div><div id="yui_3_16_0_ym19_1_1473055205833_4019">You must carefully synchronize the execution of this filter. The filter refers to a renderer, which is modified every time a render occurs. Therefore, the filter is always out of date, and always executes. You may have to perform two rendering passes."</div><div id="yui_3_16_0_ym19_1_1473055205833_4019"><br id="yui_3_16_0_ym19_1_1473055205833_4244"></div><div id="yui_3_16_0_ym19_1_1473055205833_4020">It worked as expected if I added the //new lines:</div><div id="yui_3_16_0_ym19_1_1473055205833_4021"><br id="yui_3_16_0_ym19_1_1473055205833_4022"></div><div id="yui_3_16_0_ym19_1_1473055205833_4023">  vtkSmartPointer<vtkSelectVisiblePoints> selectVisiblePoints = </div><div id="yui_3_16_0_ym19_1_1473055205833_4024">    vtkSmartPointer<vtkSelectVisiblePoints>::New();</div><div id="yui_3_16_0_ym19_1_1473055205833_4025">  selectVisiblePoints->SetInput(originalData);</div><div id="yui_3_16_0_ym19_1_1473055205833_4026">  selectVisiblePoints->SetRenderer(renderer);</div><div id="yui_3_16_0_ym19_1_1473055205833_4027">  selectVisiblePoints->Update();</div><div id="yui_3_16_0_ym19_1_1473055205833_4028"><br id="yui_3_16_0_ym19_1_1473055205833_4029"></div><div id="yui_3_16_0_ym19_1_1473055205833_4030">  renderWindow->Render(); // new</div><div id="yui_3_16_0_ym19_1_1473055205833_4031">  selectVisiblePoints->Update(); // new</div><div id="yui_3_16_0_ym19_1_1473055205833_4032"><br id="yui_3_16_0_ym19_1_1473055205833_4033"></div><div id="yui_3_16_0_ym19_1_1473055205833_4034">  std::cout << "Visible nr of points = " << selectVisiblePoints->GetOutput()->GetNumberOfPoints() << std::endl;</div><div id="yui_3_16_0_ym19_1_1473055205833_4035"><br></div><div id="yui_3_16_0_ym19_1_1473055205833_4035"><br></div><div class="qtdSeparateBR" id="yui_3_16_0_ym19_1_1473055205833_4058"><br></div><div class="yahoo_quoted" id="yui_3_16_0_ym19_1_1473055205833_3971" style="display: block;">  <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 13px;" id="yui_3_16_0_ym19_1_1473055205833_3970"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;" id="yui_3_16_0_ym19_1_1473055205833_3969"> <div dir="ltr" id="yui_3_16_0_ym19_1_1473055205833_3973"> <font size="2" face="Arial" id="yui_3_16_0_ym19_1_1473055205833_3972"> <hr size="1" id="yui_3_16_0_ym19_1_1473055205833_4189"> <b><span style="font-weight:bold;">From:</span></b> Ioana Barcan via vtkusers <vtkusers@vtk.org><br> <b><span style="font-weight: bold;">To:</span></b> VTK Users <vtkusers@vtk.org> <br> <b><span style="font-weight: bold;">Sent:</span></b> Thursday, September 1, 2016 5:48 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> [vtkusers] vtkSelectVisiblePoints output has 0 points<br> </font> </div> <div class="y_msg_container" id="yui_3_16_0_ym19_1_1473055205833_3968"><br><div id="yiv7420271078"><div id="yui_3_16_0_ym19_1_1473055205833_3967"><div style="color:#000;background-color:#fff;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:13px;" id="yui_3_16_0_ym19_1_1473055205833_3966"><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21477">Hello,</div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21479">  </div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21481">I’m trying to obtain a polyData with only the visible part
of a 3D model.</div><div id="yiv7420271078yui_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.</div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21485">  </div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21487">However, the output of the vtkSelectVisiblePoints filter
contains “0” points for some reason…</div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21489">  </div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21491">Using the following example:</div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21493"><a rel="nofollow" target="_blank" href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/SelectVisiblePoints" id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21494">http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/SelectVisiblePoints</a></div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21496">  </div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21498">I came up with the following piece of code:</div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21500">  </div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21502">  // Render window and
interactor</div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21504">  vtkSmartPointer<vtkRenderWindow>
renderWindow = </div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21506">   
vtkSmartPointer<vtkRenderWindow>::New();</div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21508"> 
renderWindow->SetSize(800, 800);</div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21510">  </div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21512"> 
vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor
= </div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21514">   
vtkSmartPointer<vtkRenderWindowInteractor>::New();</div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21516">  </div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21518">  renderWindowInteractor->SetRenderWindow(renderWindow);</div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21520">  </div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21522">  </div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21524">  // Mock renderer,
mapper and actor</div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21526"> 
vtkSmartPointer<vtkRenderer> mockRenderer = </div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21528">    vtkSmartPointer<vtkRenderer>::New();</div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21530">  </div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21532"> 
renderWindow->AddRenderer(mockRenderer);</div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21534">  </div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21536"> 
vtkSmartPointer<vtkPolyDataMapper> mockMapper = </div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21538">   
vtkSmartPointer<vtkPolyDataMapper>::New();</div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21540"> 
mockMapper->SetInput(reader->GetOutput());</div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21542">  </div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21544"> 
vtkSmartPointer<vtkActor> mockActor =
vtkSmartPointer<vtkActor>::New();</div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21546"> 
mockActor->SetMapper(mockMapper);</div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21548"> 
mockRenderer->AddActor(mockActor);</div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21550">  </div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21552">  // Set camera to the
correct position</div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21554"> 
mockRenderer->GetActiveCamera()->SetPosition(0, -1, 0);</div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21556"> 
mockRenderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);</div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21558"> 
mockRenderer->GetActiveCamera()->SetViewUp(0, 1, 0);</div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21560"> 
mockRenderer->ResetCamera();</div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21562">  </div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21564"> 
vtkSmartPointer<vtkSelectVisiblePoints> selectVisiblePoints = </div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21566">   
vtkSmartPointer<vtkSelectVisiblePoints>::New();</div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21568"> 
selectVisiblePoints->SetInput(reader->GetOutput());</div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21570"> 
selectVisiblePoints->SetRenderer(mockRenderer);</div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21572"> 
selectVisiblePoints->Update();</div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21574">  </div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21576">  std::cout <<
"Visible nr of points = " <<
selectVisiblePoints->GetOutput()->GetNumberOfPoints() << std::endl;</div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21576"><br></div><div dir="ltr" id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21723">  renderWindow->RemoveRenderer(mockRenderer);</div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21580"><br></div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21580"><br></div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21580">  </div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21582">… prints 0.</div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21584">  </div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21586">Is it anything that I’m missing?</div><div id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21588">  </div><div>















































































































</div><div dir="ltr" id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21590">Thank you,<br id="yiv7420271078yui_3_16_0_ym19_1_1472711733302_21591">
Ioana</div></div></div></div><br>_______________________________________________<br>Powered by www.kitware.com<br><br>Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br><br>Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br><br>Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" target="_blank">http://markmail.org/search/?q=vtkusers</a><br><br>Follow this link to subscribe/unsubscribe:<br><a href="http://public.kitware.com/mailman/listinfo/vtkusers" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br><br><br></div> </div> </div>  </div></div></body></html>