Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get the bounding box of point data?

Tags:

vtk

How do I get the range of the data set? Also known as the bounding box for the data. The data is read with the StructuredPointsReader.

like image 245
Reactormonk Avatar asked Feb 15 '23 22:02

Reactormonk


1 Answers

Because vtkStructuredPoints (the type of GetOutput() on a vtkStructuredPointsReader) is a subclass of vtkDataSet, you can use the GetBounds(double[6]) function of vtkDataSet. Here is an example:

  double bounds[6];
  structuredPointsReader->Update();
  structuredPointsReader->GetOutput()->GetBounds(bounds);

  std::cout  << "xmin: " << bounds[0] << " " 
             << "xmax: " << bounds[1] << std::endl
             << "ymin: " << bounds[2] << " " 
             << "ymax: " << bounds[3] << std::endl
             << "zmin: " << bounds[4] << " " 
             << "zmax: " << bounds[5] << std::endl;
like image 73
David Doria Avatar answered Mar 11 '23 21:03

David Doria