本文整理汇总了C++中Pointcloud::getPoints方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointcloud::getPoints方法的具体用法?C++ Pointcloud::getPoints怎么用?C++ Pointcloud::getPoints使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pointcloud
的用法示例。
在下文中一共展示了Pointcloud::getPoints方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addNoise
Pointcloud SimulateMap::addNoise(Pointcloud pc){
Pointcloud pNC;
for(Pointcloud::Point p : *pc.getPoints()){
pNC.setPoint(p);
}
pNC.offset = pc.offset;
pNC.orientation = pc.orientation;
int cPx = checkpoints[0].getX();
int cPy = checkpoints[0].getY();
for(int i = 0; i < pNC.getPoints()->size(); ++i){
int pCx = pNC.getPoints()->at(i).X;
int pCy = pNC.getPoints()->at(i).Y;
int distanceX = (pCx - cPx)^2;
int distanceY = (pCy - cPy)^2;
double distance = sqrt(distanceX - distanceY);
if(distance > (Values::NOISETHRESHOLD/10)){
//std::cout << "Point distance: " << distance << "\n";
int intDistance = static_cast<int>(distance * 10);
int randomXValue = (rand()% (intDistance * 2)) - intDistance;
int randomYValue = (rand()% (intDistance * 2)) - intDistance;
randomXValue = randomXValue / 10;
randomYValue = randomYValue / 10;
//std::cout << "Random distance: " << randomXValue <<" , " << randomYValue <<"\n";
Pointcloud::Point newPosition = pNC.getPoints()->at(i);
newPosition.X += randomXValue;
newPosition.Y += randomYValue;
pNC.getPoints()->at(i) = newPosition;
}
}
return pNC;
}
示例2: run
//.........这里部分代码省略.........
//left up side diagonal
tM->setMapObject(1,4,6);
testResultsFile << "addObject 4 6 left up side diagonal checkpoint" << std::endl;
tM->setMapObject(1,3,5);
testResultsFile << "addObject 5 3 left up side diagonal checkpoint" << std::endl;
//left down side diagonal
tM->setMapObject(1,6,6);
testResultsFile << "addObject 6 6 left down side diagonal checkpoint" << std::endl;
tM->setMapObject(1,7,5);
testResultsFile << "addObject 5 7 left down side diagonal checkpoint" << std::endl;
//right up side diagonal
tM->setMapObject(1,4,8);
testResultsFile << "addObject 8 4 right up side diagonal checkpoint" << std::endl;
tM->setMapObject(1,3,9);
testResultsFile << "addObject 9 3 right up side diagonal checkpoint" << std::endl;
//right down side diagonal
tM->setMapObject(1,6,8);
testResultsFile << "addObject 8 6 right down side diagonal checkpoint" << std::endl;
tM->setMapObject(1,7,9);
testResultsFile << "addObject 9 7 right down side diagonal checkpoint" << std::endl;
SimulateMap tS(tM);
tS.addCheckPoint(7,5);
testResultsFile << "addCheckPoint 5 7" << std::endl;
tS.simulate();
testResultsFile << "Enviroment Simulator object behind object test PointCloud" << std::endl;
Pointcloud pointc = tS.getPointCloud();
for(Pointcloud::Point p : *pointc.getPoints()){
if(p.X == 2 && p.Y == 0){
testResultsFile << "Error: ";
testResultsFile << "PointCloud: " << "Right side object behind object scanned. FAILURE!" << std::endl;
++error;
}
else if(p.X == -2 && p.Y == 0){
testResultsFile << "Error: ";
testResultsFile << "PointCloud: " << "Left side object behind object scanned. FAILURE!" << std::endl;
++error;
}
else if(p.X == 0 && p.Y == 2){
testResultsFile << "Error: ";
testResultsFile << "PointCloud: " << "Upper side object behind object scanned. FAILURE!" << std::endl;
++error;
}
else if(p.X == 0 && p.Y == -2){
testResultsFile << "Error: ";
testResultsFile << "PointCloud: " << "Lower side object behind object scanned. FAILURE!" << std::endl;
++error;
}
else if(p.X == -2 && p.Y == -2){
testResultsFile << "Error: ";
testResultsFile << "PointCloud: " << "Upper left diagonal side object behind object scanned. FAILURE!" << std::endl;
++error;
}
else if(p.X == 2 && p.Y == -2){
testResultsFile << "Error: ";
testResultsFile << "PointCloud: " << "Lower left diagonal side object behind object scanned. FAILURE!" << std::endl;
++error;
}
else if(p.X == 2 && p.Y == 2){
testResultsFile << "Error: ";