Class CMeshFast
Defined in File CMeshFast.h
Inheritance Relationships
Base Types
public mrpt::viz::CVisualObject(Class CVisualObject)public mrpt::viz::VisualObjectParams_Points(Class VisualObjectParams_Points)
Class Documentation
-
class CMeshFast : public virtual mrpt::viz::CVisualObject, public mrpt::viz::VisualObjectParams_Points
A planar (XY) grid where each cell has an associated height and, optionally, a texture map. To make it faster to render, instead of drawing lines and triangles it draws a point at each gridcell. A typical usage example would be an elevation map or a 3D model of a terrain.

See also
opengl::Scene
Public Functions
-
inline CMeshFast(bool enableTransparency = false, float xMin_p = -1.0f, float xMax_p = 1.0f, float yMin_p = -1.0f, float yMax_p = 1.0f)
Constructor
-
virtual ~CMeshFast() override = default
-
inline void setGridLimits(float xmin, float xmax, float ymin, float ymax)
-
inline void getGridLimits(float &xmin, float &xmax, float &ymin, float &ymax) const
-
inline void enableTransparency(bool v)
-
inline void enableColorFromZ(bool v, mrpt::img::TColormap colorMap = mrpt::img::cmJET)
-
void setZ(const mrpt::math::CMatrixDynamic<float> &in_Z)
This method sets the matrix of heights for each position (cell) in the mesh grid
-
inline void getZ(mrpt::math::CMatrixFloat &out) const
Returns a reference to the internal Z matrix, allowing changing it efficiently
-
inline float getXMin() const
-
inline float getXMax() const
-
inline float getYMin() const
-
inline float getYMax() const
-
inline void setXMin(float nxm)
-
inline void setXMax(float nxm)
-
inline void setYMin(float nym)
-
inline void setYMax(float nym)
-
inline void getXBounds(float &min, float &max) const
-
inline void getYBounds(float &min, float &max) const
-
inline void setXBounds(float min, float max)
-
inline void setYBounds(float min, float max)
-
virtual void updateBuffers() const override
Called by the rendering system to update internal geometry buffers.
Derived classes should override this to populate their data buffers (triangles, points, lines) when the object geometry changes.
This is called automatically when hasToUpdateBuffers() returns true, which happens after notifyChange() was called.
The base implementation does nothing; derived classes should override.
Note
Thread safety: implementations should lock the appropriate mutexes when writing to shared buffers.
-
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()
-
void assignImage(const mrpt::img::CImage &img)
Assigns a texture image, and disable transparency.
-
void assignImageAndZ(const mrpt::img::CImage &img, const mrpt::math::CMatrixDynamic<float> &in_Z)
Assigns a texture image and Z simultaneously, and disable transparency.
-
inline void adjustGridToImageAR()
Adjust grid limits according to the image aspect ratio, maintaining the X limits and resizing in the Y direction.
Protected Functions
-
void updateColorsMatrix() const
Called internally to assure C is updated.
-
void updatePoints() const
Protected Attributes
-
mrpt::img::CImage m_textureImage
-
bool m_enableTransparency
-
bool m_colorFromZ = {false}
-
bool m_isImage = {false}
-
mutable math::CMatrixF X
X(x,y): X-coordinate of the point (x,y)
-
mutable math::CMatrixF Y
Y(x,y): Y-coordinate of the point (x,y)
-
mutable math::CMatrixF Z
Z(x,y): Z-coordinate of the point (x,y)
-
mutable math::CMatrix_u8 C
Grayscale or RGB components [0,255] for each cell, updated by updateColorsMatrix
-
math::CMatrix_u8 C_r
-
math::CMatrix_u8 C_g
-
math::CMatrix_u8 C_b
-
mrpt::img::TColormap m_colorMap = {mrpt::img::cmJET}
Used when m_colorFromZ is true
-
mutable bool m_modified_Z = {true}
Whether C is not up-to-date wrt to Z
-
mutable bool m_modified_Image = {false}
Whether C is not up-to-date wrt to the texture image
-
float xMin
Mesh bounds
-
float xMax
-
float yMin
-
float yMax
-
mutable bool pointsUpToDate = {false}
Whether the coordinates of the points needs to be recalculated
-
inline CMeshFast(bool enableTransparency = false, float xMin_p = -1.0f, float xMax_p = 1.0f, float yMin_p = -1.0f, float yMax_p = 1.0f)