class mrpt::viz::CSetOfTriangles
Overview
A set of colored triangles, able to draw any solid, arbitrarily complex object without textures.
For textures, see CSetOfTexturedTriangles
See also:
opengl::Scene, CSetOfTexturedTriangles
#include <mrpt/viz/CSetOfTriangles.h> class CSetOfTriangles: public mrpt::viz::CVisualObject, public mrpt::viz::VisualObjectParams_Triangles { public: // typedefs typedef std::shared_ptr<mrpt::viz ::CSetOfTriangles> Ptr; typedef std::shared_ptr<const mrpt::viz ::CSetOfTriangles> ConstPtr; typedef std::unique_ptr<mrpt::viz ::CSetOfTriangles> UniquePtr; typedef std::unique_ptr<const mrpt::viz ::CSetOfTriangles> ConstUniquePtr; typedef std::vector<TTriangle>::const_iterator const_iterator; typedef std::vector<TTriangle>::const_reverse_iterator const_reverse_iterator; // fields static constexpr const char* className = "mrpt::viz" "::" "CSetOfTriangles"; // construction CSetOfTriangles(); // methods static constexpr auto getClassName(); static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic(); static std::shared_ptr<CObject> CreateObject(); template <typename... Args> static Ptr Create(Args&&... args); template <typename Alloc, typename... Args> static Ptr CreateAlloc( const Alloc& alloc, Args&&... args ); template <typename... Args> static UniquePtr CreateUnique(Args&&... args); virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const; virtual mrpt::rtti::CObject* clone() const; void updatePolygons() const; void clearTriangles(); size_t getTrianglesCount() const; void getTriangle(size_t idx, TTriangle& t) const; void insertTriangle(const TTriangle& t); template <class InputIterator> void insertTriangles( const InputIterator& begin, const InputIterator& end ); void insertTriangles(const CSetOfTriangles::Ptr& p); void reserve(size_t t); virtual CVisualObject& setColor_u8(const mrpt::img::TColor& c); virtual CVisualObject& setColorA_u8(const uint8_t a); virtual bool traceRay(const mrpt::poses::CPose3D& o, double& dist) const; void getPolygons(std::vector<mrpt::math::TPolygon3D>& polys) const; template <class CONTAINER> void insertTriangles(const CONTAINER& c); virtual mrpt::math::TBoundingBoxf internalBoundingBoxLocal() const; };
Inherited Members
public: // typedefs typedef std::shared_ptr<CObject> Ptr; typedef std::shared_ptr<const CObject> ConstPtr; typedef std::shared_ptr<CSerializable> Ptr; typedef std::shared_ptr<const CSerializable> ConstPtr; typedef std::shared_ptr<CVisualObject> Ptr; typedef std::shared_ptr<const CVisualObject> ConstPtr; typedef std::unique_ptr<CObject> UniquePtr; typedef std::unique_ptr<const CObject> ConstUniquePtr; // structs struct PoseAndScale; struct State; // methods static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic(); virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const; virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const; static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic(); virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const; const auto& shaderTrianglesBuffer() const; auto& shaderTrianglesBufferMutex() const; static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic(); PoseAndScale getPoseAndScale() const; virtual CVisualObject& setColor_u8(const mrpt::img::TColor& c); bool isLightEnabled() const; void enableLight(bool enable = true); TCullFace cullFaces() const; void notifyBBoxChange() const; auto getBoundingBoxLocalf() const;
Typedefs
typedef std::shared_ptr<mrpt::viz ::CSetOfTriangles> Ptr
A type for the associated smart pointer.
Methods
virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const
Returns information about the class of an object in runtime.
virtual mrpt::rtti::CObject* clone() const
Returns a deep copy (clone) of the object, indepently of its class.
void updatePolygons() const
Explicitly updates the internal polygon cache, with all triangles as polygons.
See also:
void clearTriangles()
Clear this object, removing all triangles.
size_t getTrianglesCount() const
Get triangle count.
void getTriangle(size_t idx, TTriangle& t) const
Gets the i-th triangle.
void insertTriangle(const TTriangle& t)
Inserts a triangle into the set.
template <class InputIterator> void insertTriangles( const InputIterator& begin, const InputIterator& end )
Inserts a set of triangles, bounded by iterators, into this set.
See also:
void insertTriangles(const CSetOfTriangles::Ptr& p)
Inserts an existing CSetOfTriangles into this one.
void reserve(size_t t)
Reserves memory for certain number of triangles, avoiding multiple memory allocation calls.
virtual CVisualObject& setColor_u8(const mrpt::img::TColor& c)
Overwrite all triangles colors with the one provided.
virtual CVisualObject& setColorA_u8(const uint8_t a)
Overwrite all triangles colors with the one provided.
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
void getPolygons(std::vector<mrpt::math::TPolygon3D>& polys) const
Gets the polygon cache.
See also:
template <class CONTAINER> void insertTriangles(const CONTAINER& c)
Inserts a set of triangles, given in a container of either TTriangle ‘s or TPolygon3D.
See also:
virtual mrpt::math::TBoundingBoxf internalBoundingBoxLocal() const
Evaluates the bounding box of this object (including possible children) in the coordinate frame of the object parent.