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


C++ ModelFile::BuildOctree方法代码示例

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


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

示例1: main

int main(int argc, char* argv[])
{
	std::cout << "Enter main." << std::endl;
	
	std::string InputFile, OutputFile;
	double ScannerLocX, ScannerLocY, ScannerLocZ;
	double ForwardX, ForwardY, ForwardZ;
	unsigned int NumPoints;
	double ThetaMin, ThetaMax, PhiMin, PhiMax, minmax;

	std::cout << "Options:" << std::endl;
	
	po::options_description desc("Allowed options");
	desc.add_options()
			("help", "Help message.")
			("input", po::value<std::string>(&InputFile), "Set input file")
			("output", po::value<std::string>(&OutputFile), "Set output file")
			("ScannerLocX", po::value<double>(&ScannerLocX)->default_value(0.0), "Set scanner location (x)")
			("ScannerLocY", po::value<double>(&ScannerLocY)->default_value(0.0), "Set scanner location (y)")
			("ScannerLocZ", po::value<double>(&ScannerLocZ)->default_value(0.0), "Set scanner location (z)")
			("ForwardX", po::value<double>(&ForwardX)->default_value(0.0), "Set forward (x)")
			("ForwardY", po::value<double>(&ForwardY)->default_value(0.0), "Set forward (y)")
			("ForwardZ", po::value<double>(&ForwardZ)->default_value(0.0), "Set forward (z)")
			("NumPoints", po::value<unsigned int>(&NumPoints)->default_value(100), "Set number of points (one side of the grid, assuming a square grid)")
			("PhiMin", po::value<double>(&PhiMin)->default_value(-10.0), "Set min phi angle")
			("PhiMax", po::value<double>(&PhiMax)->default_value(10.0), "Set max phi angle")
			("ThetaMin", po::value<double>(&ThetaMin)->default_value(-10.0), "Set min theta angle")
			("ThetaMax", po::value<double>(&ThetaMax)->default_value(10.0), "Set max theta angle")
			("minmax", po::value<double>(&minmax), "Set max theta angle")
			;

	po::variables_map vm;
	po::store(po::parse_command_line(argc, argv, desc), vm);
	po::notify(vm); //assign the variables (if they were specified)
	
	if(vm.count("help")) 
	{
		std::cout << desc << std::endl;
		return 1;
	}

	CheckRequiredArgs(vm);
	
	std::cout << std::endl << std::endl;

	if(!vm.count("minmax"))
	{
		//convert degrees to radians
		PhiMin = deg2rad(PhiMin);
		PhiMax = deg2rad(PhiMax);
		ThetaMin = deg2rad(ThetaMin);
		ThetaMax = deg2rad(ThetaMax);
	}
	else
	{
		PhiMin = deg2rad(-minmax);
		PhiMax = deg2rad(minmax);
		ThetaMin = deg2rad(-minmax);
		ThetaMax = deg2rad(minmax);
	}
	/////////////////////////////////////////////////////
	
	//setup model
	ModelFile Scene;
	Scene.Read(InputFile);
	Scene.Init();
	
	//setup scanner
	LidarScanner Scanner(true); //use octree
	Scene.BuildOctree();
	vgl_point_3d<double> Pos(ScannerLocX, ScannerLocY, ScannerLocZ);
	vgl_vector_3d<double> Dir(ForwardX, ForwardY, ForwardZ);
	Scanner.Orient(Pos, Dir);	

	Scanner.ScanParams.setNumPhiPoints(NumPoints);
	Scanner.ScanParams.setNumThetaPoints(NumPoints);
	
	Scanner.ScanParams.setPhiMin(PhiMin);
	Scanner.ScanParams.setPhiMax(PhiMax);
	Scanner.ScanParams.setThetaMin(ThetaMin);
	Scanner.ScanParams.setThetaMax(ThetaMax);
	
	//scan
	PerformScan(Scene, Scanner, OutputFile);
	return 0;

}
开发者ID:daviddoria,项目名称:LidarProbability,代码行数:87,代码来源:SingleScan.cpp


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