arena.cpp
112 Descriptor d = addTypeDescription(type, "The class modelling an arena in which robots can live");
113 d.describeReal("z").def(0.0).help("The z coordinate of the plane in the world frame of reference", "This is the z coordinate of the upper part of the plane in the world frame of reference");
120 // First of all adding robots to the list of usable resources. This will call the resourceChanged callback
121 // because robots already exist, however they are not in the m_robotResourceWrappers map so the callback will
142 // If the robot actually exists, adding a wrapper, otherwise we simply add the robot to the map to
146 WheeledRobot2DWrapper* wrapper = new WheeledRobot2DWrapper(this, r, r->robotHeight(), r->robotRadius());
172 Box2DWrapper* Arena::createWall(QColor color, wVector start, wVector end, real thickness, real height)
181 Box2DWrapper* b = createBox(color, (end - start).norm(), thickness, height, Box2DWrapper::Wall);
183 // Moving the wall and setting the texture. We have to compute the rotation around the Z axis of the
209 // Creating the cylinder, then we only have to change its z position and set the material to nonCollidable
210 Cylinder2DWrapper* c = createCylinder(color, radius, targetAreasHeight, Cylinder2DWrapper::CircularTargetArea);
224 // Creating the box, then we only have to change its z position and set the material to nonCollidable
225 Box2DWrapper* b = createBox(color, width, depth, targetAreasHeight, Box2DWrapper::RectangularTargetArea);
268 // Here we use a naive approach: we check collision of every object with every robot. This is not
269 // the best possible algorithm (complexity is O(n^2)...), but it's the way things are done in evorobot
289 // Getting the distance between the robot and the object. If computeDistanceAndOrientationFromRobot
309 Cylinder2DWrapper* Arena::createCylinder(QColor color, real radius, real height, Cylinder2DWrapper::Type type)
335 Box2DWrapper* Arena::createBox(QColor color, real width, real depth, real height, Box2DWrapper::Type type)
392 WheeledRobot2DWrapper* wrapper = new WheeledRobot2DWrapper(this, r, r->robotHeight(), r->robotRadius());
413 Box2DWrapper* Arena::createPlane(ConfigurationParameters& params, QString prefix, real z, Arena* arena)
422 ConfigurationHelper::throwUserMissingResourceError("world", "We need a world to create the arena!");
433 world->setSize(wVector(-planeWidth, -planeHeight, -planeThickness), wVector(planeWidth, planeHeight, +6.0));
441 Box2DWrapper* Arena::createPlane2(ConfigurationParameters& params, QString prefix, real z, Arena* arena)
455 ConfigurationHelper::throwUserMissingResourceError("world", "We need a world to create the arena!");
463 plane->setPosition(wVector( w*cellSize-planeWidth/2.0, h*cellSize-planeHeight/2.0, z - (planeThickness / 2.0)));