Base class of any object contained within the simulation. More...
#include <objects.h>
Public Member Functions | |
| Object (float _x, float _y, ObjectGeometry &_geom, std::string const &_category="objects") | |
| Constructs an Object. | |
| Object (Simulation *simulation, float _x, float _y, Configuration const &config, std::string const &_category="objects") | |
| Constructs an Object from a configuration entry. | |
| virtual | ~Object () |
| Destructor. | |
| void | init (b2WorldId world_id) |
| Launch virtual function 'do_init' that will perform base initialization (e.g. create Box2D objects). | |
| bool | is_initialized () const noexcept |
| Check if the object was correctly initialized yet. | |
| virtual void | render (SDL_Renderer *renderer, b2WorldId world_id) const =0 |
| Renders the object on the given SDL renderer. | |
| virtual void | launch_user_step (float f) |
| Launches the user-defined step function. | |
| ObjectGeometry * | get_geometry () |
| Return the object's geometry. | |
| virtual void | move (float x, float y, float theta=NAN) |
| Move the object to a given coordinate. | |
| virtual bool | is_tangible () const |
| Returns whether this object is tangible (e.g. collisions, etc) or not. | |
| virtual void | serialize_base_values (DataLogger *data_logger, double t) |
| Save base values of the object into a data logger row. | |
| virtual void | create_serialization_fields (DataLogger *data_logger) |
| Create serialization fields of the data logger. | |
| virtual arena_polygons_t | generate_contours (std::size_t points_per_contour=0) const |
| Return one or more polygonal contours that represent the geometry of the object. | |
Public Attributes | |
| float | x |
| X position. | |
| float | y |
| Y position. | |
| float | theta |
| Orientation (in rad). | |
| std::string | category |
| Category of the object. | |
Protected Member Functions | |
| virtual void | do_init (b2WorldId world_id) |
| Perform the base initialization (e.g. create Box2D objects). Called once by init(world_id). | |
| virtual void | parse_configuration (Configuration const &config, Simulation *simulation) |
| Parse a provided configuration and set associated members values. | |
Protected Attributes | |
| ObjectGeometry * | geom |
| Geometry of the object. | |
Base class of any object contained within the simulation.
| Object::Object | ( | float | _x, |
| float | _y, | ||
| ObjectGeometry & | _geom, | ||
| std::string const & | _category = "objects" ) |
| Object::Object | ( | Simulation * | simulation, |
| float | _x, | ||
| float | _y, | ||
| Configuration const & | config, | ||
| std::string const & | _category = "objects" ) |
Constructs an Object from a configuration entry.
| simulation | Pointer to the underlying simulation. |
| x | Initial x-coordinate in the simulation. |
| y | Initial y-coordinate in the simulation. |
| config | Configuration entry describing the object properties. |
| category | Name of the category of the object. |
|
virtual |
Destructor.
|
virtual |
Create serialization fields of the data logger.
| data_logger | Pointer to a DataLogger used for serialization |
Reimplemented in MembraneObject, PhysicalObject, and PogobotObject.
|
inlineprotectedvirtual |
Perform the base initialization (e.g. create Box2D objects). Called once by init(world_id).
| world_id | The Box2D world identifier. |
Reimplemented in MembraneObject, PhysicalObject, PogobjectObject, PogobotObject, Pogowall, and RectMembraneObject.
|
virtual |
Return one or more polygonal contours that represent the geometry of the object.
| points_per_contour | Desired number of vertices for each contour (a rectangle has one contour, a disk has one, an arena may have many – one per wall). |
Reimplemented in MembraneObject, PhysicalObject, and RectMembraneObject.
|
inline |
Return the object's geometry.
|
inline |
Launch virtual function 'do_init' that will perform base initialization (e.g. create Box2D objects).
|
inlinenoexcept |
Check if the object was correctly initialized yet.
|
inlinevirtual |
Returns whether this object is tangible (e.g. collisions, etc) or not.
Reimplemented in MembraneObject, PhysicalObject, and Pogowall.
|
virtual |
Launches the user-defined step function.
| t | current simulation time |
Reimplemented in AlternatingDualRayOfLightObject, PhysicalObject, PogobotObject, RotatingRayOfLightObject, and StaticLightObject.
|
virtual |
Move the object to a given coordinate.
Reimplemented in MembraneObject, PhysicalObject, Pogowall, and RectMembraneObject.
|
protectedvirtual |
Parse a provided configuration and set associated members values.
| config | Configuration entry describing the object properties. |
Reimplemented in ActiveObject, AlternatingDualRayOfLightObject, MembraneObject, PassiveObject, PhysicalObject, PogobotObject, RectMembraneObject, RotatingRayOfLightObject, and StaticLightObject.
|
pure virtual |
Renders the object on the given SDL renderer.
| renderer | Pointer to the SDL_Renderer. |
| world_id | The Box2D world identifier (unused in rendering). |
Implemented in ActiveObject, AlternatingDualRayOfLightObject, MembraneObject, PassiveObject, PhysicalObject, PogobjectObject, PogobotObject, Pogowall, RectMembraneObject, RotatingRayOfLightObject, and StaticLightObject.
|
virtual |
Save base values of the object into a data logger row.
| data_logger | Pointer to a DataLogger used to serialize base values |
Reimplemented in MembraneObject, PhysicalObject, PogobotObject, and RectMembraneObject.
| std::string Object::category |
Category of the object.
|
protected |
Geometry of the object.
| float Object::theta |
Orientation (in rad).
| float Object::x |
X position.
| float Object::y |
Y position.