Physical object without user code (i.e. passive). Can still interact with other objects (e.g. collisions, etc). More...
#include <objects.h>
Public Member Functions | |
| PassiveObject (uint16_t _id, float _x, float _y, ObjectGeometry &geom, b2WorldId world_id, float _linear_damping=0.0f, float _angular_damping=0.0f, float _density=10.0f, float _friction=0.3f, float _restitution=0.5f, std::string _colormap="rainbow", std::string const &_category="objects") | |
| Constructs a PassiveObject. | |
| PassiveObject (Simulation *simulation, uint16_t _id, float _x, float _y, b2WorldId world_id, Configuration const &config, std::string const &_category="objects") | |
| Constructs a PassiveObject from a configuration entry. | |
| void | render (SDL_Renderer *renderer, b2WorldId world_id) const override |
| Renders the object on the given SDL renderer. | |
| Public Member Functions inherited from PhysicalObject | |
| PhysicalObject (uint16_t _id, float _x, float _y, ObjectGeometry &geom, b2WorldId world_id, float _linear_damping=0.0f, float _angular_damping=0.0f, float _density=10.0f, float _friction=0.3f, float _restitution=0.5f, std::string const &_category="objects") | |
| Constructs a PhysicalObject. | |
| PhysicalObject (Simulation *simulation, uint16_t _id, float _x, float _y, b2WorldId world_id, Configuration const &config, std::string const &_category="objects") | |
| Constructs a PhysicalObject from a configuration entry. | |
| virtual void | launch_user_step (float t) override |
| Launches the user-defined step function. For PhysicalObject, it is also used to compute acceleration statistics. | |
| virtual b2Vec2 | get_position () const |
| Retrieves the object's current position. | |
| float | get_angle () const |
| Retrieves the object's current orientation angle. | |
| float | get_angular_velocity () const |
| Retrieves the object's current angular velocity. | |
| b2Vec2 | get_linear_acceleration () const |
| Retrieves the object's current angular velocity. | |
| virtual void | move (float x, float y, float theta=NAN) override |
| Move the object to a given coordinate. | |
| virtual bool | is_tangible () const override |
| Returns whether this object is tangible (e.g. collisions, etc) or not. | |
| virtual arena_polygons_t | generate_contours (std::size_t points_per_contour=0) const override |
| Return one or more polygonal contours that represent the geometry of the object. | |
| Public Member Functions inherited from Object | |
| 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. | |
| ObjectGeometry * | get_geometry () |
| Return the object's geometry. | |
Protected Member Functions | |
| virtual void | parse_configuration (Configuration const &config, Simulation *simulation) override |
| Parse a provided configuration and set associated members values. | |
| Protected Member Functions inherited from PhysicalObject | |
| virtual void | create_body (b2WorldId world_id) |
| Creates the object's physical body in the simulation. | |
Protected Attributes | |
| std::string | colormap |
| Protected Attributes inherited from PhysicalObject | |
| float | linear_damping |
| float | angular_damping |
| float | density |
| float | friction |
| float | restitution |
| b2BodyId | body_id |
| Box2D body identifier. | |
| float | _estimated_dt = 0.0f |
| float | _last_time = 0.0f |
| b2Vec2 | _prev_v = {NAN, NAN} |
| b2Vec2 | _lin_acc = {NAN, NAN} |
| Protected Attributes inherited from Object | |
| ObjectGeometry * | geom |
| Geometry of the object. | |
Additional Inherited Members | |
| Public Attributes inherited from PhysicalObject | |
| uint16_t | id |
| Object identifier. | |
| Public Attributes inherited from Object | |
| float | x |
| X position. | |
| float | y |
| Y position. | |
| float | theta |
| Orientation (in rad). | |
| std::string | category |
| Category of the object. | |
Physical object without user code (i.e. passive). Can still interact with other objects (e.g. collisions, etc).
| PassiveObject::PassiveObject | ( | uint16_t | _id, |
| float | _x, | ||
| float | _y, | ||
| ObjectGeometry & | geom, | ||
| b2WorldId | world_id, | ||
| float | _linear_damping = 0.0f, | ||
| float | _angular_damping = 0.0f, | ||
| float | _density = 10.0f, | ||
| float | _friction = 0.3f, | ||
| float | _restitution = 0.5f, | ||
| std::string | _colormap = "rainbow", | ||
| std::string const & | _category = "objects" ) |
Constructs a PassiveObject.
| _id | Unique object identifier. |
| x | Initial x-coordinate in the simulation. |
| y | Initial y-coordinate in the simulation. |
| geom | Object's geometry. |
| world_id | The Box2D world identifier. |
| _linear_damping | Linear damping value for the physical body (default is 0.0f). |
| _angular_damping | Angular damping value for the physical body (default is 0.0f). |
| _density | Density of the body shape (default is 10.0f). |
| _friction | Friction coefficient of the body shape (default is 0.3f). |
| _restitution | Restitution (bounciness) of the body shape (default is 0.5f). |
| _colormap | Name of the colormap to use to set the color of the object |
| category | Name of the category of the object. |
| PassiveObject::PassiveObject | ( | Simulation * | simulation, |
| uint16_t | _id, | ||
| float | _x, | ||
| float | _y, | ||
| b2WorldId | world_id, | ||
| Configuration const & | config, | ||
| std::string const & | _category = "objects" ) |
Constructs a PassiveObject from a configuration entry.
| simulation | Pointer to the underlying simulation. |
| _id | Unique object identifier. |
| x | Initial x-coordinate in the simulation. |
| y | Initial y-coordinate in the simulation. |
| world_id | The Box2D world identifier. |
| config | Configuration entry describing the object properties. |
| category | Name of the category of the object. |
|
overrideprotectedvirtual |
Parse a provided configuration and set associated members values.
| config | Configuration entry describing the object properties. |
Reimplemented from PhysicalObject.
|
overridevirtual |
Renders the object on the given SDL renderer.
| renderer | Pointer to the SDL_Renderer. |
| world_id | The Box2D world identifier (unused in rendering). |
Implements PhysicalObject.
|
protected |