class mrpt::viz::CSetOfObjects
Overview
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:
#include <mrpt/viz/CSetOfObjects.h> class CSetOfObjects: public mrpt::viz::CVisualObject { public: // typedefs typedef ListVisualObjects::const_iterator const_iterator; typedef ListVisualObjects::iterator iterator; // construction CSetOfObjects(); // methods static CSetOfObjects::Ptr posePDF2opengl(const mrpt::poses::CPosePDF& o); static CSetOfObjects::Ptr posePDF2opengl(const mrpt::poses::CPointPDF& o); static CSetOfObjects::Ptr posePDF2opengl(const mrpt::poses::CPose3DPDF& o); static CSetOfObjects::Ptr posePDF2opengl(const mrpt::poses::CPose3DQuatPDF& o); const_iterator begin() const; const_iterator end() const; iterator begin(); iterator end(); template <class T> void insertCollection(const T& objs); void insert(const CVisualObject::Ptr& newObject); template <class T_it> void insert(const T_it& begin, const T_it& end); void clear(); size_t size(); bool empty() const; CVisualObject::Ptr getByName(const std::string& str); template <typename T> T::Ptr getByClass(size_t ith = 0) const; void removeObject(const CVisualObject::Ptr& obj); void dumpListOfObjects(std::vector<std::string>& lst) const; mrpt::containers::yaml asYAML() const; virtual bool traceRay(const mrpt::poses::CPose3D& o, double& dist) const; virtual CVisualObject& setColor_u8(const mrpt::img::TColor& c); virtual CVisualObject& setColorA_u8(const uint8_t a); bool contains(const CVisualObject::Ptr& obj) const; virtual mrpt::math::TBoundingBoxf internalBoundingBoxLocal() const; };
Inherited Members
public: // structs struct OutdatedState; struct State;
Methods
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
template <class T> 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> 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.
size_t size()
Returns number of objects.
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.
(New in MRPT 2.1.3)
virtual bool traceRay(const mrpt::poses::CPose3D& o, double& dist) const
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& setColorA_u8(const uint8_t a)
Set alpha (transparency) color component in the range [0,255].
Returns:
a ref to this
virtual mrpt::math::TBoundingBoxf internalBoundingBoxLocal() const
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()