本文整理汇总了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;
}