[vtkusers] vtkSelectEnclosedPoints without an input
Jochen K.
jochen.kling at email.de
Fri Jun 8 12:42:42 EDT 2012
Hello Federico,
after some research and trial and error I found a solution for that. Here is
a complete example (without rendering anything):
/*
This is a backdoor that can be used to test many points for containment.
First initialize the instance, then repeated calls to IsInsideSurface()
can be used without rebuilding the search structures.
The complete method releases memory.
In other words, you do have to feed the vtkSelectEnclosedPoints object
neither with polydata as the input nor with a surface.
*/
#include <vtkSphereSource.h>
#include <vtkSmartPointer.h>
#include <vtkPolyData.h>
#include <vtkSelectEnclosedPoints.h>
int main()
{
vtkSmartPointer<vtkSphereSource> sphereSource =
vtkSmartPointer<vtkSphereSource>::New();
sphereSource->SetCenter(0.0, 0.0, 0.0);
sphereSource->SetRadius(1.0);
sphereSource->Update();
vtkPolyData* sphere = sphereSource->GetOutput();
double testInside[3] = {0.0, 0.0, 0.0};
double testOutside[3] = {10.0, 0.0, 0.0};
vtkSmartPointer<vtkSelectEnclosedPoints> selectEnclosedPoints =
vtkSmartPointer<vtkSelectEnclosedPoints>::New();
selectEnclosedPoints->Initialize(sphere);
std::cout << selectEnclosedPoints->IsInsideSurface(testInside)
<< std::endl;
std::cout << selectEnclosedPoints->IsInsideSurface(testOutside)
<< std::endl;
return EXIT_SUCCESS;
}
with kind regards
Jochen
--
View this message in context: http://vtk.1045678.n5.nabble.com/vtkSelectEnclosedPoints-without-an-input-tp5713685p5713686.html
Sent from the VTK - Users mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120608/ec22303a/attachment.htm>
More information about the vtkusers
mailing list