简体   繁体   English

如何通过C ++在VTK中设置3D地图的边界?

[英]How to set bounds for 3d map in vtk by c++?

I have a lot of lines and planes which are around, for example, (0.5, 0.5, 0.5) point. 我有很多围绕(0.5,0.5,0.5)点的线和平面。 Also I have area where they have importance, it's a cube. 我也有他们需要重视的领域,这是一个立方体。 And lines, planes have possibility to intersect this area, and be outside of it. 线条,飞机有可能与该区域相交并在其外部。 Can I hide part of all elements, and parts of elements, which are not included in my area? 我可以隐藏部分不包含在我的区域中的所有元素吗? Does Vtk have opportunity to do it very simple? Vtk是否有机会做到这一点很简单? Or I need to do it by myself? 还是我需要自己做? I want to write, for example SetBounds(bounds), and after that all what isn't included in cube dissapear. 我想写例如SetBounds(bounds),然后在多维数据集显示中不包含所有内容。

Try using vtkClipDataSet with the clip-function set to vtkBox . 尝试将vtkClipDataSet的剪贴功能设置为vtkBox Finally, render the output from the vtkClipDataSet filter. 最后,渲染来自vtkClipDataSet过滤器的输出。

vtkNew<vtkBox> box;
box->SetBounds(.....); // set the bounds of interest.

vtkNew<vtkClipDataSet> clipper;
clipper->SetInputConnection(....); // set to your data producer
clipper->SetClipFunction(box.GetPointer());

// since clipper will produce an unstructured grid, apply the following to
// extract a  polydata from it.
vtkNew<vtkGeometryFilter> geomFilter;
geomFilter->SetInputConnection(clipper->GetOutputPort());

// now, this can be connected to the mapper.
vtkNew<vtkPolyDataMapper> mapper;
mapper->SetInputConnection(geomFilter->GetOutputPort());

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM