如何获取点数据的边界框? [英] How do I get the bounding box of point data?

查看:27
本文介绍了如何获取点数据的边界框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取数据集的范围?也称为数据的边界框.使用 StructuredPointsReader 读取数据.

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.

推荐答案

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

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;

这篇关于如何获取点数据的边界框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆