<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Feb 23, 2015 at 5:09 AM, madz <span dir="ltr"><<a href="mailto:madaramh@gmail.com" target="_blank">madaramh@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">What method can I use to get the points between a specific X range with<br>
static Y and Z values?<br>
<br>
eg - Get point ids between the ranges of,<br>
p1 - 0.1 ,0.23, 0.78<br>
p2 - 123.0 ,0.23, 0.78<br>
<br>
Any help would be greatly appreciated.<br></blockquote><div><br>One way to do this would be to select points inside a cube that is huge (much much larger than your data) in two dimensions and with the bounds on your X range as the third dimension. Then you could use something like the following (though it is currently returning 0 points extracted, so you'll have to figure out what is wrong):<br><br>#include <vtkCubeSource.h><br>#include <vtkExtractSelectedFrustum.h><br>#include <vtkPlanes.h><br>#include <vtkPointSource.h><br>#include <vtkPolyData.h><br>#include <vtkSmartPointer.h><br><br>int main(int, char *[])<br>{<br> // Define your selection region<br> vtkSmartPointer<vtkCubeSource> cubeSource =<br> vtkSmartPointer<vtkCubeSource>::New();<br> cubeSource->SetCenter(0,0,0);<br> cubeSource->SetXLength(1);<br> cubeSource->SetYLength(1);<br> cubeSource->SetZLength(1);<br> cubeSource->Update();<br><br> double bounds[6];<br> cubeSource->GetOutput()->GetBounds(bounds);<br><br> vtkSmartPointer<vtkPlanes> frustum =<br> vtkSmartPointer<vtkPlanes>::New();<br> frustum->SetBounds(bounds);<br><br> // Generate some points<br> vtkSmartPointer<vtkPointSource> pointSource =<br> vtkSmartPointer<vtkPointSource>::New();<br> pointSource->SetNumberOfPoints(500);<br> pointSource->SetCenter(0,0,0);<br> pointSource->SetRadius(5);<br> pointSource->Update();<br><br>
std::cout << "There are " <<
pointSource->GetOutput()->GetNumberOfPoints() << " input
points." << std::endl;<br><br> // Extract the points within the frustum<br> vtkSmartPointer<vtkExtractSelectedFrustum> extractSelectedFrustum =<br> vtkSmartPointer<vtkExtractSelectedFrustum>::New();<br> extractSelectedFrustum->SetFrustum(frustum);<br> extractSelectedFrustum->SetInputData(pointSource->GetOutput());<br> extractSelectedFrustum->Update();<br><br>
std::cout << "There are " << vtkDataSet::SafeDownCast
(extractSelectedFrustum->GetOutput())->GetNumberOfPoints()
<< " output points." << std::endl;<br><br> return EXIT_SUCCESS;<br>} <br></div></div></div></div>