How do I get the bounding box of point data?

元气小坏坏 提交于 2020-01-03 17:51:07

问题


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.


回答1:


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;


来源:https://stackoverflow.com/questions/19484854/how-do-i-get-the-bounding-box-of-point-data

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!