4

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.

4

1 回答 1

8

因为 vtkStructuredPoints(vtkStructuredPointsReader 上的 GetOutput() 类型)是 vtkDataSet 的子类,所以可以使用 vtkDataSet 的 GetBounds(double[6]) 函数。这是一个例子:

  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;
于 2013-10-22T18:18:15.923 回答