vtkOBBTree 线与模型求交

         auto intersectionPoints = vsp<vtkPoints>::New();
        // cell
        auto intersectioncells = vsp<vtkIdList>::New();
        double tol = 1e-8;
        auto obbTree = vsp<vtkOBBTree>::New();
        obbTree->SetTolerance(tol);
        obbTree->SetDataSet(normfilter->GetOutput());
        obbTree->SetMaxLevel(10);
        obbTree->SetNumberOfCellsPerNode(1);
        obbTree->BuildLocator();
        obbTree->IntersectWithLine(virtualStartpoint,virtualEndpoint,
                intersectionPoints,intersectioncells);
        obbTree->Update();

vtkOBBTree utilizes the following parent class parameters:

  • Tolerance (default 0.01)     容差
  • Level (default 4)
  • MaxLevel (default 12)     最大递归深度次数
  • NumberOfCellsPerNode (default 32)  最小包围盒里cell数量
  • RetainCellLists (default true)
  • UseExistingSearchStructure (default false)

      包围盒精细程度由递归深度 MaxLevel以及预先设置的NumberOfCellsPerNode决定,进而影响求交精度。

参考:vtkobbtree 获取最小包围框

官方例程参考:官方example

      以下是笔者绘制球并使用直线与其相交。

Tips:shift+w(显示模型网格)  shift+s(显示模型),模型精度不同,需要考虑设置合适的包围盒精度。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值