Class CSetOfTriangles

Inheritance Relationships

Base Types

Class Documentation

class CSetOfTriangles : public virtual mrpt::viz::CVisualObject, public mrpt::viz::VisualObjectParams_Triangles

A set of colored triangles, able to draw any solid, arbitrarily complex object without textures. For textures, see CSetOfTexturedTriangles

See also

opengl::Scene, CSetOfTexturedTriangles

Public Types

using const_iterator = std::vector<TTriangle>::const_iterator
using const_reverse_iterator = std::vector<TTriangle>::const_reverse_iterator

Public Functions

void updatePolygons() const

Explicitly updates the internal polygon cache, with all triangles as polygons.

See also

getPolygons()

void clearTriangles()

Clear this object, removing all triangles.

size_t getTrianglesCount() const

Get triangle count

inline void getTriangle(size_t idx, TTriangle &t) const

Gets the i-th triangle

inline void insertTriangle(const TTriangle &t)

Inserts a triangle into the set

template<class InputIterator>
inline void insertTriangles(const InputIterator &begin, const InputIterator &end)

Inserts a set of triangles, bounded by iterators, into this set.

See also

insertTriangle

void insertTriangles(const CSetOfTriangles::Ptr &p)

Inserts an existing CSetOfTriangles into this one

inline 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) override

Overwrite all triangles colors with the one provided

virtual CVisualObject &setColorA_u8(const uint8_t a) override

Overwrite all triangles colors with the one provided

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

void getPolygons(std::vector<mrpt::math::TPolygon3D> &polys) const

Gets the polygon cache.

See also

insertTriangles

template<class CONTAINER>
inline void insertTriangles(const CONTAINER &c)

Inserts a set of triangles, given in a container of either TTriangle’s or TPolygon3D

See also

insertTriangle

virtual mrpt::math::TBoundingBoxf internalBoundingBoxLocal() const override

Evaluates the bounding box of this object (including possible children) in the coordinate frame of the object parent.

CSetOfTriangles() = default
virtual ~CSetOfTriangles() override = default

Protected Attributes

mutable bool polygonsUpToDate = {false}

Mutable variable used to check whether polygons need to be recalculated.

mutable std::vector<mrpt::math::TPolygonWithPlane> m_polygons

Polygon cache, used for ray-tracing only