少量点云数据同一层数据寻找。
struct xyz
{
float x;
float y;
float z;
}
std::map<double, std::vector<xyz>> zClassifiedPoints;
zClassifiedPoints.push();//进来 这里注意消掉z小数位 float z = int(Z);
for (const auto& entry : zClassifiedPoints) {
double zValue = entry.first;
const std::vector<xyz>& classifiedPoints = entry.second;
if (classifiedPoints.size() > maxPointsCount) {
maxZValue = zValue;
maxPointsCount = classifiedPoints.size();
}
}
const std::vector<xyz>& mostPointsGroup = zClassifiedPoints[maxZValue]; //包含最多层数的值
xyz Value = mostPointsGroup[0];
求z值最多分布的值。