Class CSetOfObjects

Inheritance Relationships

Base Type

Derived Type

Class Documentation

class CSetOfObjects : public mrpt::viz::CVisualObject

A set of object, which are referenced to the coordinates framework established in this object. It can be established a hierarchy of “CSetOfObjects”, where the coordinates framework of each one will be referenced to the parent’s one. The list of child objects is accessed directly as in the class Scene

See also

opengl::Scene

Subclassed by mrpt::viz::CAssimpModel

pose_pdf -> 3d objects auxiliary templates

static CSetOfObjects::Ptr posePDF2opengl(const mrpt::poses::CPosePDF &o)

Returns a representation of a the PDF - this is just an auxiliary function, it’s more natural to call mrpt::poses::CPosePDF::getAs3DObject

static CSetOfObjects::Ptr posePDF2opengl(const mrpt::poses::CPointPDF &o)

Returns a representation of a the PDF - this is just an auxiliary function, it’s more natural to call mrpt::poses::CPointPDF::getAs3DObject

static CSetOfObjects::Ptr posePDF2opengl(const mrpt::poses::CPose3DPDF &o)

Returns a representation of a the PDF - this is just an auxiliary function, it’s more natural to call mrpt::poses::CPose3DPDF::getAs3DObject

static CSetOfObjects::Ptr posePDF2opengl(const mrpt::poses::CPose3DQuatPDF &o)

Returns a representation of a the PDF - this is just an auxiliary function, it’s more natural to call mrpt::poses::CPose3DQuatPDF::getAs3DObject

Public Types

using const_iterator = ListVisualObjects::const_iterator
using iterator = ListVisualObjects::iterator

Public Functions

CSetOfObjects() = default
virtual ~CSetOfObjects() override = default
inline const_iterator begin() const
inline const_iterator end() const
inline iterator begin()
inline iterator end()
template<class T>
inline void insertCollection(const T &objs)

Inserts a set of objects into the list.

void insert(const CVisualObject::Ptr &newObject)

Insert a new object to the list.

template<class T_it>
inline void insert(const T_it &begin, const T_it &end)

Inserts a set of objects, bounded by iterators, into the list.

void clear()

Clear the list of objects in the scene, deleting objects’ memory.

inline size_t size() const

Returns number of objects.

inline bool empty() const

Returns true if there are no objects.

CVisualObject::Ptr getByName(const std::string &str)

Returns the first object with a given name, or a nullptr pointer if not found.

template<typename T>
T::Ptr getByClass(size_t ith = 0) const

Returns the i’th object of a given class (or of a descendant class), or nullptr (an empty smart pointer) if not found. Example:

CSphere::Ptr obs = myscene.getByClass<CSphere>();
By default (ith=0), the first observation is returned.

void removeObject(const CVisualObject::Ptr &obj)

Removes the given object from the scene (it also deletes the object to free its memory).

void dumpListOfObjects(std::vector<std::string> &lst) const

Retrieves a list of all objects in text form

Deprecated:

Prefer asYAML() (since MRPT 2.1.3)

mrpt::containers::yaml asYAML() const

Prints all objects in human-readable YAML form.

Note

(New in MRPT 2.1.3)

virtual bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const override

Simulation of ray-trace, given a pose. Returns true if the ray effectively collisions with the object (returning the distance to the origin of the ray in “dist”), or false in other case. “dist” variable yields undefined behaviour when false is returned

virtual CVisualObject &setColor_u8(const mrpt::img::TColor &c) override
virtual CVisualObject &setColorA_u8(const uint8_t a) override

Set alpha (transparency) color component in the range [0,255]

Returns:

a ref to this

bool contains(const CVisualObject::Ptr &obj) const
virtual mrpt::math::TBoundingBoxf internalBoundingBoxLocal() const override

Must be implemented by derived classes to provide the updated bounding box in the object local frame of coordinates. This will be called only once after each time the derived class reports to notifyChange() that the object geometry changed.

See also

getBoundingBox(), getBoundingBoxLocal(), getBoundingBoxLocalf()

Protected Attributes

ListVisualObjects m_objects

The list of child objects. Objects are automatically deleted when calling “clear” or in the destructor.