首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在VTK中创建二十面体

在VTK中创建二十面体
EN

Stack Overflow用户
提问于 2014-07-10 00:09:05
回答 1查看 361关注 0票数 1

我正在尝试调试点云库中的一段代码。它正在使用VTK创建一个二十面体。

我已经将有问题的代码粘贴到一个新函数中-- \\ *** ... ***注释之间的代码是直接从PCL复制过来的。我添加了输入和输出部分:

代码语言:javascript
复制
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;
}

我预计从细分的二十面体创建的球体应该有一些点和一些多边形,但输出似乎表明球体实际上是空的:

代码语言:javascript
复制
! ./test
Sphere points: 0
Sphere polys: 0

我是不是做错了什么?如何创建二十面体?

(这是OSX 10.9上的VTK 5.10 )

EN

回答 1

Stack Overflow用户

发布于 2014-07-11 07:32:07

看看VTK meshes subdivision example吧。在本例中,在设置了subdivisionFilter对象的输入之后,将调用更新。在您的代码subdivide->Update();中设置subdivide的输入连接后

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24658705

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档