网页资讯视频图片知道文库贴吧地图采购
进入贴吧全吧搜索

 
 
 
日一二三四五六
       
       
       
       
       
       

签到排名:今日本吧第个签到,

本吧因你更精彩,明天继续来努力!

本吧签到人数:0

一键签到
成为超级会员,使用一键签到
一键签到
本月漏签0次!
0
成为超级会员,赠送8张补签卡
如何使用?
点击日历上漏签日期,即可进行补签。
连续签到:天  累计签到:天
0
超级会员单次开通12个月以上,赠送连续签到卡3张
使用连续签到卡
08月13日漏签0天
vtk吧 关注:1,235贴子:10,456
  • 看贴

  • 图片

  • 吧主推荐

  • 游戏

  • 48回复贴,共1页
<<返回vtk吧
>0< 加载中...

空间八叉树---vtkCellLocator

  • 只看楼主
  • 收藏

  • 回复
  • rabbitbride
  • 初三年级
    12
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
官方解释:
octree-based spatial(空间的) search object to quickly locate(位于) cells
vtkCellLocator is a spatial search object to quickly locate cells in 3D. vtkCellLocator uses a uniform-level octree subdivision(细分), where each octant(八分仪) (an octant is also referred to as a bucket) carries an indication(指示) of whether it is empty or not, and each leaf octant carries a list of the cells inside of it. (An octant is not empty if it has one or more cells inside of it.) Typical(典型的) operations are intersection(交叉) with a line to return candidate(候选人) cells, or intersection with another vtkCellLocator to return candidate cells.


  • rabbitbride
  • 初三年级
    12
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
关于空间点,VTK有一堆我还没弄明白的东西:vtkKdTree , vtkOBBTree ,vtkOctreePointLocator , vtkModifiedBSPTree


2025-08-13 07:01:52
广告
不感兴趣
开通SVIP免广告
  • rabbitbride
  • 初三年级
    12
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
自己写了半天,发现VTK一个函数搞定的事情,悲催
vtkSmartPointer<vtkPolyData> pd = point0;
//--------------------------------------------
// Create the tree
vtkSmartPointer<vtkCellLocator> cellLocator =
vtkSmartPointer<vtkCellLocator>::New();
cellLocator->SetDataSet(pd);
cellLocator->BuildLocator();
double testPoint[3] = {146,128,111};
cellLocator->FindClosestPoint(testPoint, closestPoint, cellId, subId, closestPointDist2);
std::cout << "Coordinates of closest point: " << closestPoint[0] << " " << closestPoint[1] << " " << closestPoint[2] << std::endl;
std::cout << "Squared distance to closest point: " << closestPointDist2 << std::endl;
std::cout << "CellId: " << cellId << std::endl;


  • rabbitbride
  • 初三年级
    12
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
double point_temp[3] = {146,128,111};
double squaredDistance = 1000;
double first_point[3];
for (vtkIdType i = 0; i< pPos->GetNumberOfPoints()-1 ; i++)
{
double point_temp2[3];
point_temp2[0] = pPos->GetPoint(i)[0];
point_temp2[1] = pPos->GetPoint(i)[1];
point_temp2[2] = pPos->GetPoint(i)[2];
double squaredDistance2 = vtkMath::Distance2BetweenPoints(point_temp, point_temp2);
if (squaredDistance > squaredDistance2)
{
squaredDistance = squaredDistance2;
first_point[0] = point_temp2[0];
first_point[1] = point_temp2[1];
first_point[2] = point_temp2[2];
}
}
std::cout << "squaredDistance:"<< squaredDistance<< std::endl;
std::cout << "first_point:"<< first_point[0]<<","<< first_point[1]<<","<< first_point[2]<< std::endl;


  • rabbitbride
  • 初三年级
    12
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
继续~KD-Tree:搜索最近的n个点
//Create the tree
vtkSmartPointer<vtkKdTreePointLocator> pointTree =
vtkSmartPointer<vtkKdTreePointLocator>::New();
pointTree->SetDataSet(pd);
pointTree->BuildLocator();
// Find the k closest points to (0,0,0)
unsigned int k = 50;
//double testPoint[3] = {0.0, 0.0, 0.0};
vtkSmartPointer<vtkIdList> result =
vtkSmartPointer<vtkIdList>::New();
pointTree->FindClosestNPoints(k, testPoint, result);
for(vtkIdType i = 0; i < k; i++)
{
vtkIdType point_ind = result->GetId(i);
double p[3];
pd->GetPoint(point_ind, p);
std::cout << "Closest point " << i << ": Point "
<< point_ind << ": (" << p[0] << ", " << p[1] << ", " << p[2] << ")" << std::endl;
}


  • studyhard12389
  • 托儿所
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
吧主 你好 请问可以提供一下您上面所看的八叉树细分方面的资料/程序吗?最近一直在做,比较纠结 自己是在搞不懂了


  • 浩繁星尘
  • 四年级
    7
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
楼主 可以再仔细讲讲这个八叉树的??


  • hwliu11
  • 四年级
    7
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
这些类都是空间查询的,各个类实现方法略有不同,用过kdtree,该算法是先构建k维空间点集,然后可以快速查询到某一个位置附近的一个或者几个点


登录百度账号

扫二维码下载贴吧客户端

下载贴吧APP
看高清直播、视频!
  • 贴吧页面意见反馈
  • 违规贴吧举报反馈通道
  • 贴吧违规信息处理公示
  • 48回复贴,共1页
<<返回vtk吧
分享到:
©2025 Baidu贴吧协议|隐私政策|吧主制度|意见反馈|网络谣言警示