#include <PhysicalEngine.h>
It is a rectangular arena with walls at all sides.
Public Types | |
| enum | WallsType { WALLS_SQUARE = 0, WALLS_CIRCULAR, WALLS_NONE } |
| Type of walls around the world. More... | |
| typedef std::set< PhysicalObject * > | Objects |
| typedef Objects::iterator | ObjectsIterator |
Public Member Functions | |
| void | collideCircleWithShape (PhysicalObject *circularObject, PhysicalObject *shapedObject, const Polygone &shape) |
| Do the collision of a circular object with one with a different shape (convex boundingsurface). | |
| void | collideObjects (PhysicalObject *object1, PhysicalObject *object2) |
| Collide two objects. Correct functions will be called depending on type of object (circular or other shape). | |
| void | collideWithSquareWalls (PhysicalObject *object) |
| Collide the object with square walls. | |
| void | collideWithCircularWalls (PhysicalObject *object) |
| Collide the object with circular walls. | |
| bool | isPointInside (const Point &p, const Point &c, const Polygone &bs, Vector *distVector) |
| Return true if point p of object of center c is inside polygone bs and return deinterlacement distVector. | |
| World (double width, double height, const Color &wallsColor=Color::gray) | |
| Construct a world with square walls, takes width and height of the world arena in cm. | |
| World (double r, const Color &wallsColor=Color::gray) | |
| Construct a world with circle walls, takes radius of the world arena in cm. | |
| World () | |
| Construct a world with no walls. | |
| ~World () | |
| Destructor, destroy all objects. | |
| void | step (double dt, unsigned physicsOversampling=1) |
| Simulate a timestep of dt. dt should be below 1 (typically .02-.1); physicsOversampling is the amount of time the physics is run per step, as usual collisions require a more precise simulation than the sensor-motor loop frequency. | |
| void | addObject (PhysicalObject *o) |
| Add an object to the world, simply add it to the vector. | |
| void | removeObject (PhysicalObject *o) |
| Remove an object from the world and destroy it. If object is not in the world, do nothing. | |
| void | disconnectExternalObjectsUserData () |
| Set to 0 the userData member of all object whose value userData->deletedWithObject are false; call this before the creator of user data is destroyed, this method is typically called from a viewer just before its destruction. | |
| void | setRandomSeed (unsigned long seed) |
| Set the seed of the random generator. | |
| void | initBluetoothBase () |
| Initialise and activate the Bluetooth base. | |
| BluetoothBase * | getBluetoothBase () |
| Return the address of the Bluetooth base. | |
Public Attributes | |
| const WallsType | wallsType |
| type of walls this world is using | |
| const double | w |
| The width of the world, if wallsType is WALLS_SQUARE. | |
| const double | h |
| The height of the world, if wallsType is WALLS_SQUARE. | |
| const double | r |
| The radius of the world, if wallsType is WALLS_CIRCLE. | |
| const Color | wallsColor |
| The color of the world walls. | |
| Objects | objects |
| All the objects in the world. | |
| BluetoothBase * | bluetoothBase |
| Base for the Bluetooth connections between robots. | |
| void Enki::World::addObject | ( | PhysicalObject * | o | ) |
Add an object to the world, simply add it to the vector.
Object will be automatically deleted when world will be destroyed. If the object is already in the world, do nothing
1.5.1