if (polygon->points.size()==1 && obstacle->radius > 0) // Circle { obstacles_.push_back(ObstaclePtr(newCircularObstacle(polygon->points[0].x, polygon->points[0].y, obstacle->radius))); } elseif (polygon->points.size()==1) // Point { obstacles_.push_back(ObstaclePtr(newPointObstacle(polygon->points[0].x, polygon->points[0].y))); } elseif (polygon->points.size()==2) // Line { obstacles_.push_back(ObstaclePtr(newLineObstacle(polygon->points[0].x, polygon->points[0].y, polygon->points[1].x, polygon->points[1].y ))); } elseif (polygon->points.size()>2) // Real polygon { PolygonObstacle* polyobst = new PolygonObstacle; for (std::size_t j=0; j<polygon->points.size(); ++j) { polyobst->pushBackVertex(polygon->points[j].x, polygon->points[j].y); } polyobst->finalizePolygon(); obstacles_.push_back(ObstaclePtr(polyobst)); }
// Set velocity, if obstacle is moving if(!obstacles_.empty()) obstacles_.back()->setCentroidVelocity(obstacles->obstacles[i].velocities, obstacles->obstacles[i].orientation); } }