我正在尝试调试点云库中的一段代码。它正在使用VTK创建一个二十面体。
我已经将有问题的代码粘贴到一个新函数中-- \\ *** ... ***注释之间的代码是直接从PCL复制过来的。我添加了输入和输出部分:
int main()
{
int tesselation_level_ = 2;
// *** begin PCL code ***
vtkSmartPointer<vtkPlatonicSolidSource> ico = vtkSmartPointer<vtkPlatonicSolidSource>::New ();
ico->SetSolidTypeToIcosahedron ();
ico->Update ();
//tesselate cells from icosahedron
vtkSmartPointer<vtkLoopSubdivisionFilter> subdivide = vtkSmartPointer<vtkLoopSubdivisionFilter>::New ();
subdivide->SetNumberOfSubdivisions (tesselation_level_);
subdivide->SetInputConnection (ico->GetOutputPort ());
// Get camera positions
vtkPolyData *sphere = subdivide->GetOutput ();
// *** end PCL code ***
std::cout << "Sphere points: " << sphere->GetNumberOfPoints () << std::endl;
std::cout << "Sphere polys: " << sphere->GetNumberOfPolys () << std::endl;
}我预计从细分的二十面体创建的球体应该有一些点和一些多边形,但输出似乎表明球体实际上是空的:
! ./test
Sphere points: 0
Sphere polys: 0我是不是做错了什么?如何创建二十面体?
(这是OSX 10.9上的VTK 5.10 )
发布于 2014-07-11 07:32:07
看看VTK meshes subdivision example吧。在本例中,在设置了subdivisionFilter对象的输入之后,将调用更新。在您的代码subdivide->Update();中设置subdivide的输入连接后
https://stackoverflow.com/questions/24658705
复制相似问题