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


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

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


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

示例1: FindCongruentBases


//.........这里部分代码省略.........
			unsigned count = (unsigned)pairs1.size();
			if (!tmpCloud1.reserve(count*2)) //not enough memory
				return -2;
			for(unsigned i=0; i<count; i++)
			{
				//generate the two intermediate points from r1 in pairs1[i]
				const CCVector3 *q0 = cloud->getPoint(pairs1[i].first);
				const CCVector3 *q1 = cloud->getPoint(pairs1[i].second);
				CCVector3 P1 = *q0 + r1*(*q1-*q0);
				tmpCloud1.addPoint(P1);
				CCVector3 P2 = *q1 + r1*(*q0-*q1);
				tmpCloud1.addPoint(P2);
			}
		}
	
		{
			unsigned count = (unsigned)pairs2.size();
			if (!tmpCloud2.reserve(count*2)) //not enough memory
				return -3;
			for(unsigned i=0; i<count; i++)
			{
				//generate the two intermediate points from r2 in pairs2[i]
				const CCVector3 *q0 = cloud->getPoint(pairs2[i].first);
				const CCVector3 *q1 = cloud->getPoint(pairs2[i].second);
				CCVector3 P1 = *q0 + r2*(*q1-*q0);
				tmpCloud2.addPoint(P1);
				CCVector3 P2 = *q1 + r2*(*q0-*q1);
				tmpCloud2.addPoint(P2);
			}
		}

		//build kdtree for nearest neighbour fast research
		KDTree intermediateTree;
		if (!intermediateTree.buildFromCloud(&tmpCloud1))
			return -4;

		//Find matching (up to delta) intermediate points in tmpCloud1 and tmpCloud2
		{
			unsigned count = (unsigned)tmpCloud2.size();
			match.reserve(count);
			if (match.capacity() < count)  //not enough memory
				return -5;
		
			for(unsigned i=0; i<count; i++)
			{
				const CCVector3 *q0 = tmpCloud2.getPoint(i);
				unsigned a;
				if (intermediateTree.findNearestNeighbour(q0->u, a, delta))
				{
					IndexPair idxPair;
					idxPair.first = i;
					idxPair.second = a;
					match.push_back(idxPair);
				}
			}
		}
	}

    //Find bases from matching intermediate points indexes
	{
		results.clear();
		size_t count = match.size();
		if (count>0)
		{
			results.reserve(count);
			if (results.capacity() < count)  //not enough memory
开发者ID:eile,项目名称:trunk,代码行数:67,代码来源:RegistrationTools.cpp


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