2014-09-01 157 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());