2014-09-01 162 views
0

我有很多线条和平面,例如(0.5,0.5,0.5)点。我也有他们重要的地方,这是一个立方体。线条,飞机有可能与这个区域相交,并且在它之外。我是否可以隐藏部分元素,而不包括在我的区域中? Vtk是否有机会做到这一点非常简单?或者我需要自己做?我想写,例如SetBounds(边界),并在此之后,所有不包括在立方体dissapear。如何在C++中为vtk设置三维地图边界?

回答

0

尝试使用vtkClipDataSet并将剪辑功能设置为vtkBox。最后,渲染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());