【发布时间】:2015-11-09 08:51:43
【问题描述】:
我正在尝试使用 vtkClipDataSet 剪辑 vtkUnstructuredGrid。问题是在我剪辑之后,生成的 vtkUnstructuredGrid 没有点/单元格数据(数组)。
这是我的代码:
vtkSmartPointer<vtkUnstructuredGrid> model = reader->GetOutput();
// this shows that model has one point data array called "Displacements" (vectorial of 3 components)
model->Print(std::cout);
// Plane to cut it
vtkSmartPointer<vtkPlane> plane = vtkSmartPointer<vtkPlane>::New();
plane->SetOrigin(0.0,0.0,0.0); plane->SetNormal(1,0,0);
// Clip data
vtkSmartPointer<vtkClipDataSet> clipDataSet = vtkSmartPointer<vtkClipDataSet>::New();
clipDataSet->SetClipFunction(plane);
clipDataSet->SetInputConnection(model->GetProducerPort());
clipDataSet->InsideOutOn();
clipDataSet->GenerateClippedOutputOn();
//PROBLEM HERE. The print shows that there aren't any arrays on the output data
clipDataSet->GetOutput()->Print(std::cout);
我需要输出网格来包含数组,因为我想在结果网格上显示值。 例如,如果数据是标量,我想在切割网格上显示等值。如果数据是矢量的,我想在数据矢量的方向上变形网格(扭曲)。
这里我有一个关于我想做的 ParaView 的示例。实体是原始网格,线框网格是变形的网格。
我在 C++ 下使用 VTK 5.10(Windows 8.1 64 位,如果有帮助的话)。
谢谢! PS:我试过在VTKusers列表上问这个,但没有得到答案。
【问题讨论】:
-
你有什么收获吗?我没有看到你更新剪辑过滤器
-
@lib 是的,你是对的。就是这样!我错过了更新电话!固定的!谢谢!