当前位置: 首页>>代码示例>>C++>>正文


C++ KDTree::deletePoint方法代码示例

本文整理汇总了C++中KDTree::deletePoint方法的典型用法代码示例。如果您正苦于以下问题:C++ KDTree::deletePoint方法的具体用法?C++ KDTree::deletePoint怎么用?C++ KDTree::deletePoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KDTree的用法示例。


在下文中一共展示了KDTree::deletePoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char** argv){
  
  KDTree<simplePoint3> tree;
  std::vector<simplePoint3> pts{ {0,0,0},{1,1,1}, {-1, 3, 4}, {5, 6, 7}, {2, -6, 8}, {4, 5, -4},
										       {2, 3, 4}, 
											 {2, 5, 6}};
  tree.buildTree(pts);
  tree.dumpTreeInorder();
  
  std::cout << "searching near 0,0,0.1" << std::endl;
  auto closeNodes = tree.getPointsWithinCube({0, 0, 0.1}, 0.2);
  std::cout << "found" << std::endl;
  for(auto n : closeNodes){
    tree.dumpNode(n);
  }

  std::cout << "searching near 0.5,0.5,0.5" << std::endl;
  closeNodes = tree.getPointsWithinCube({0.5, 0.5, 0.5}, 0.7);
  std::cout << "found" << std::endl;
  for(auto n : closeNodes){
    tree.dumpNode(n);
  }

  std::cout << "min, x: " << std::endl;
  tree.dumpNode(tree.findMin(0));

  std::cout << "min, y: " << std::endl;
  tree.dumpNode(tree.findMin(1));
  std::cout << "min, z: " << std::endl;
  tree.dumpNode(tree.findMin(2));

  for(auto i = 0; i < pts.size() -1; ++i){
    std::cout << "deleting node " << i << std::endl;
    tree.deletePoint(i);
    tree.dumpTreeInorder();
  }

  std::cout << "inserting 2 points" << std::endl;
  tree.insertPoint({1, 4, 5});
  tree.dumpTreeInorder();
  tree.insertPoint({3, 8, 6});
  tree.dumpTreeInorder();
}
开发者ID:benjones,项目名称:kdTree,代码行数:43,代码来源:testKDTree.cpp


注:本文中的KDTree::deletePoint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。