Class unicell_entity2D

Inheritance Relationships

Base Types

  • public cosm::repr::entity2D (Class entity2D)

  • public rer::client< unicell_entity2D >

Derived Types

Class Documentation

class unicell_entity2D : public cosm::repr::entity2D, public rer::client<unicell_entity2D>

Representation of a 2D entity in the arena in two dimensions.

  • Resides in a single cell (“unicell”)

  • Has an extent that can span multiple cells, even though the entity itself is confined to a single cell. A useful, simplifying abstraction in dealing with the kinds of entities that robots interact with (blocks, caches, etc.), because the handshaking logic is much simpler.

Subclassed by cosm::repr::unicell_immovable_entity2D, cosm::repr::unicell_movable_entity2D

Public Functions

~unicell_entity2D(void) override = default
inline bool contains_cell(const rmath::vector2z &cell) const

Return if a discrete cell lies within the extent of the 2D entity.

Parameters:

cell – The point to check.

Returns:

TRUE if the condition is met, and FALSE otherwise.

inline bool contains_point(const rmath::vector2d &point) const

Return if a real-valued point lies within the extent of the 2D entity for:

  1. Visualization purposes.

  2. Determining if a robot is on top of an entity.

Parameters:

point – The point to check.

Returns:

TRUE if the condition is met, and FALSE otherwise.

inline rmath::vector2z danchor2D(void) const

Return the anchor (LL corner) of the object in discrete coordinates. This ALWAYS exists, evenif if dcenter2D() does not.

inline rmath::vector2z dcenter2D(void) const
inline rmath::vector2d ranchor2D(void) const

Return the anchor (LL corner) of the object in real coordinates.

Protected Functions

inline unicell_entity2D(const rtypes::type_uuid &id, const rmath::vector2d &dims, const rmath::vector2d &center, const rtypes::discretize_ratio &resolution)
inline unicell_entity2D(const rtypes::type_uuid &id, const rmath::vector2d &dims, const rtypes::discretize_ratio &resolution)
inline const rtypes::discretize_ratio &arena_res(void) const
template<typename T, typename std::enable_if<T::is_movable(), int>::type = 0>
inline void danchor2D(const rmath::vector2z &danchor)

SFINAE to allow only derived classes that mark themselves as movable to change the initial position of the entity.

Updates the discrete anchor,center. Does not change the real anchor,center of the entity.

template<typename T, typename std::enable_if<T::is_movable(), int>::type = 0>
inline void ranchor2D(const rmath::vector2d &ranchor)

SFINAE to allow only derived classes that mark themselves as movable to change the initial position of the entity.

Updates the real anchor,center. Does not change the discrete anchor,center of the entity.