本文整理汇总了C++中GridMap::getMapSize方法的典型用法代码示例。如果您正苦于以下问题:C++ GridMap::getMapSize方法的具体用法?C++ GridMap::getMapSize怎么用?C++ GridMap::getMapSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GridMap
的用法示例。
在下文中一共展示了GridMap::getMapSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calcRepulsiveForceSum
void BasicVFF::calcRepulsiveForceSum(const GridMap &map)
{
for(int i = 0; i < map.getMapSize().y; i++)
{
for(int j = 0; j < map.getMapSize().x; j++)
{
uchar occupancyData = map.getOccupancyGridMap()[i * map.getMapSize().x + j];
if(occupancyData > 0)
{
Position2f ObstaclePos;
map.getPositionFromIndex(Cell2i(i,j), ObstaclePos);
//cout << i << " " << j << endl;
//cout << ObstaclePos.x << " " << ObstaclePos.y << endl;
float distancePow = getDistancePow(ObstaclePos);
float distance = powf(distancePow, 0.5);
force2f force = force2f((0 - ObstaclePos.x) / distance , (0 - ObstaclePos.y) / distance);
float coeff = (float)occupancyData / distancePow;
//cout << (float)occupancyData << " "<< distancePow << " " << coeff<< endl;
force2f force1 = coeff * force;
forceSum += force1;
//cout << force.x << " " << force.y << endl;
//cout << force1.x << " " << force1.y << endl;
}
}
}
cout << "ForceSum = " << forceSum.x << " "<< forceSum.y << endl;
}
示例2: calcDistanceVecArray
void BasicVFF::calcDistanceVecArray(const GridMap &map)
{
for(int i = 0; i < map.getMapSize().y; i++)
{
for(int j = 0; j < map.getMapSize().x; j++)
{
if (map.getOccupancyGridMap()[i * map.getMapSize().x + j] > 0)
{
Position2f ObstaclePos;
map.getPositionFromIndex(Cell2i(i,j), ObstaclePos);
cout << i << " " << j << endl;
cout << ObstaclePos.x << " " << ObstaclePos.y << endl;
distance_vec_array.push_back(ObstaclePos);
cout << distance_vec_array.size() << endl;
}
}
}
}