Pogosim
Loading...
Searching...
No Matches
Object Class Referenceabstract

Base class of any object contained within the simulation. More...

#include <objects.h>

Inheritance diagram for Object:
AlternatingDualRayOfLightObject PhysicalObject RotatingRayOfLightObject StaticLightObject PassiveObject PogobotObject ActiveObject PogobjectObject Pogowall MembraneObject

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.
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.
ObjectGeometryget_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 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 parse_configuration (Configuration const &config, Simulation *simulation)
 Parse a provided configuration and set associated members values.

Protected Attributes

ObjectGeometrygeom
 Geometry of the object.

Detailed Description

Base class of any object contained within the simulation.

Constructor & Destructor Documentation

◆ Object() [1/2]

Object::Object ( float _x,
float _y,
ObjectGeometry & _geom,
std::string const & _category = "objects" )

Constructs an Object.

Parameters
xInitial x-coordinate in the simulation.
yInitial y-coordinate in the simulation.
geomObject's geometry.
categoryName of the category of the object.

◆ Object() [2/2]

Object::Object ( Simulation * simulation,
float _x,
float _y,
Configuration const & config,
std::string const & _category = "objects" )

Constructs an Object from a configuration entry.

Parameters
simulationPointer to the underlying simulation.
xInitial x-coordinate in the simulation.
yInitial y-coordinate in the simulation.
configConfiguration entry describing the object properties.
categoryName of the category of the object.

◆ ~Object()

Object::~Object ( )
virtual

Destructor.

Member Function Documentation

◆ generate_contours()

arena_polygons_t Object::generate_contours ( std::size_t points_per_contour = 0) const
virtual

Return one or more polygonal contours that represent the geometry of the object.

Parameters
points_per_contourDesired number of vertices for each contour (a rectangle has one contour, a disk has one, an arena may have many – one per wall).
Returns
arena_polygons_t A vector of closed polygons (counter‑clockwise, last vertex different from the first – the caller may close the loop if needed).

Reimplemented in MembraneObject, and PhysicalObject.

◆ get_geometry()

ObjectGeometry * Object::get_geometry ( )
inline

Return the object's geometry.

◆ is_tangible()

virtual bool Object::is_tangible ( ) const
inlinevirtual

Returns whether this object is tangible (e.g. collisions, etc) or not.

Reimplemented in MembraneObject, PhysicalObject, and Pogowall.

◆ launch_user_step()

void Object::launch_user_step ( float f)
virtual

Launches the user-defined step function.

Parameters
tcurrent simulation time

Reimplemented in AlternatingDualRayOfLightObject, PhysicalObject, PogobotObject, RotatingRayOfLightObject, and StaticLightObject.

◆ move()

void Object::move ( float x,
float y,
float theta = NAN )
virtual

Move the object to a given coordinate.

Parameters
xX coordinate.
yY coordinate.
thetaOrientation, in rad.

Reimplemented in MembraneObject, PhysicalObject, and Pogowall.

◆ parse_configuration()

void Object::parse_configuration ( Configuration const & config,
Simulation * simulation )
protectedvirtual

Parse a provided configuration and set associated members values.

Parameters
configConfiguration entry describing the object properties.

Reimplemented in ActiveObject, AlternatingDualRayOfLightObject, MembraneObject, PassiveObject, PhysicalObject, PogobotObject, RotatingRayOfLightObject, and StaticLightObject.

◆ render()

virtual void Object::render ( SDL_Renderer * renderer,
b2WorldId world_id ) const
pure virtual

Renders the object on the given SDL renderer.

Parameters
rendererPointer to the SDL_Renderer.
world_idThe Box2D world identifier (unused in rendering).

Implemented in ActiveObject, AlternatingDualRayOfLightObject, MembraneObject, PassiveObject, PhysicalObject, PogobjectObject, PogobotObject, Pogowall, RotatingRayOfLightObject, and StaticLightObject.

Member Data Documentation

◆ category

std::string Object::category

Category of the object.

◆ geom

ObjectGeometry* Object::geom
protected

Geometry of the object.

◆ theta

float Object::theta

Orientation (in rad).

◆ x

float Object::x

X position.

◆ y

float Object::y

Y position.


The documentation for this class was generated from the following files: