#include <PhysicalEngine.h>
It is a rectangular arena with walls at all sides.
Public Member Functions | |
| bool | getCollideEven () |
| Return collideEven. | |
| void | collideCircleWithBS (PhysicalObject *circle, PhysicalObject *objectBS, const An::Polygone &bs) |
| 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 | collideWithWalls (PhysicalObject *object) |
| Collide the object with walls. | |
| bool | isPointInside (const An::Point &p, const An::Point &c, const An::Polygone &bs, An::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) | |
| Constructor, takes width and height of the world arena in cm. | |
| ~World () | |
| Destructor, destroy all objects. | |
| void | step (double dt) |
| Simulate a timestep of dt. dt should be below 1 (typically .02-.1). | |
| void | 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. | |
| void | removeObject (PhysicalObject *o) |
| Remove an object from the world and destroy it. | |
| void | setRandomSeed (unsigned long seed) |
| Set the seed of the random generator. | |
Public Attributes | |
| std::vector< PhysicalObject * > | objects |
| All the objects in the world. | |
| bool | useWalls |
| If true, use walls. | |
| const double | w |
| The width of the world. | |
| const double | h |
| The height of the world. | |
| An::Texture | wallTextures [4] |
| Texture of walls. | |
Protected Attributes | |
| bool | collideEven |
| At each step objects are collided in a different order (first A-B, then B-A) to prevent side effects, collideEven contains the actual order. | |
1.4.2