我试图在c ++中使用VTK8.1.0插入一些数据。
因此我将example从python转换为c ++(我没有使用python测试过它)
vtkNew<vtkDEMReader> demReader;
demReader->SetFileName("/home/ae/source/VTK-8.1.0/Testing/Data/SainteHelens.dem");
demReader->Update();
double bds[6];
demReader->GetOutput()->GetBounds(bds);
// Create a plane of onto which to map the elevation data
vtkNew<vtkPlaneSource> plane;
plane->SetResolution(200, 200);
plane->SetOrigin(bds[0],bds[2],bds[4]);
plane->SetPoint1(bds[1],bds[2],bds[4]);
plane->SetPoint2(bds[0],bds[3],bds[4]);
plane->Update();
// # Gaussian kernel-------------------------------------------------------
vtkNew<vtkGaussianKernel> gaussianKernel;
gaussianKernel->SetSharpness(2);
gaussianKernel->SetRadius(200);
vtkNew<vtkPointInterpolator2D> interp;
interp->SetInputConnection(plane->GetOutputPort());
interp->SetSourceConnection(demReader->GetOutputPort());
interp->SetKernel(gaussianKernel);
interp->SetNullPointsStrategyToClosestPoint();
interp->InterpolateZOff();
interp->Update();
vtkSmartPointer<vtkPolyData> interpolated_poly_data = interp->GetPolyDataOutput();
之后我使用一些默认代码来渲染它。 然而,它只是渲染一个平面(或任何InputConnection / InputData)并且根本不进行插值。
我错过了什么?