本文整理汇总了C++中ModelFile::Init方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelFile::Init方法的具体用法?C++ ModelFile::Init怎么用?C++ ModelFile::Init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelFile
的用法示例。
在下文中一共展示了ModelFile::Init方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteMatchingPoints
void ComparableModels::WriteMatchingPoints(const std::string &WorldFilename, const std::string &ModelFilename)
{
if(UsedWorldPoints.size() == 0)
{
std::cout << "There are no comparable points!" << std::endl;
exit(-1);
}
//world
std::vector<OrientedPoint> WorldPoints;
for(unsigned int i = 0; i < UsedWorldPoints.size(); i++)
{
WorldPoints.push_back(World.Points_[UsedWorldPoints[i]]);
}
ModelFile WorldOutput;
WorldOutput.setPoints(WorldPoints);
WorldOutput.Init();
WorldOutput.Write(WorldFilename);
//model
ModelFile ModelOutput;
ModelOutput.setPoints(MatchingModelPoints);
ModelOutput.Init();
ModelOutput.Write(ModelFilename);
}
示例2: main
int main(int argc, char *argv[])
{
std::string WithTrianglesFilename, WithoutTrianglesFilename, OutputFilename;
po::options_description desc("Allowed options");
desc.add_options()
("help", "Help message.")
("withtris", po::value<std::string>(&WithTrianglesFilename), "Set file with triangles.")
("withouttris", po::value<std::string>(&WithoutTrianglesFilename), "Set file without triangles.")
("output", po::value<std::string>(&OutputFilename), "Set output file.")
;
po::variables_map vm;
po::store(po::parse_command_line(argc, argv, desc), vm);
po::notify(vm);
if(vm.count("help"))
{
std::cout << desc << std::endl;
exit(-1);
}
CheckRequiredArgs(vm);
ModelFile ModelWithTriangles;
ModelWithTriangles.Read(WithTrianglesFilename);
ModelWithTriangles.Init();
ModelFile ModelWithoutTriangles;
ModelWithoutTriangles.Read(WithoutTrianglesFilename);
ModelWithoutTriangles.Init();
if(ModelWithTriangles.NumPoints() != ModelWithoutTriangles.NumPoints())
{
std::cout << "The two models must have identical point lists!" << std::endl;
exit(-1);
}
std::vector<vector<unsigned int> > VertexLists = ModelWithTriangles.getVertexLists();
ModelWithoutTriangles.setVertexLists(VertexLists);
ModelWithoutTriangles.Write(OutputFilename);
return 0;
}
示例3: 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;
}
示例4: main
int main(int argc, char *argv[])
{
std::string SceneFilename, ModelFilename;
double mismatch;
//parse arguments
po::options_description desc("Allowed options");
desc.add_options()
("help", "Help message.")
("scene", po::value<std::string>(&SceneFilename), "Set scene file")
("model", po::value<std::string>(&ModelFilename), "Set model file")
("mismatch", po::value<double>(&mismatch), "Set mismatch.")
;
po::variables_map vm;
po::store(po::parse_command_line(argc, argv, desc), vm);
po::notify(vm);
if(vm.count("help"))
{
std::cout << desc << std::endl;
exit(-1);
}
CheckRequiredArgs(vm);
ModelFile Scene;
Scene.Read(SceneFilename);
Scene.Init();
ModelFile Model;
Model.Read(ModelFilename);
Model.Init();
if(Scene.NumPoints() != Model.NumPoints() )
{
std::cout << "Number of points do not match (points should already be correspondences.)!" << std::endl;
exit(-1);
}
vgl_point_3d<double> ScannerLocation;
bool IsScan = Scene.getScannerLocation(ScannerLocation);
std::vector<Color<unsigned char> > Colors;
for(unsigned int i = 0; i < Scene.NumPoints(); i++)
{
double s = (Scene.getCoord(i) - ScannerLocation).length();
double m = (Model.getCoord(i) - ScannerLocation).length();
if(s > (m + mismatch))
{
Colors.push_back(Colors::Red());
}
else
{
Colors.push_back(Colors::Green());
}
}
ModelFile SceneColored;
SceneColored.setCoords(Scene.getCoords());
SceneColored.setColors(Colors);
SceneColored.Write("SceneColored.vtp");
ModelFile ModelColored;
ModelColored.setCoords(Model.getCoords());
ModelColored.setColors(Colors);
ModelColored.Write("ModelColored.vtp");
return 0;
}