class mrpt::viz::CMeshFast

Overview

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.

mrpt::viz::CMeshFast mrpt::viz::CMeshFast mrpt::viz::CMeshFast mrpt::viz::CMeshFast

See also:

opengl::Scene

#include <mrpt/viz/CMeshFast.h>

class CMeshFast:
    public mrpt::viz::CVisualObject,
    public mrpt::viz::VisualObjectParams_Points
{
public:
    // construction

    CMeshFast(
        bool enableTransparency = false,
        float xMin_p = -1.0f,
        float xMax_p = 1.0f,
        float yMin_p = -1.0f,
        float yMax_p = 1.0f
        );

    // methods

    void setGridLimits(
        float xmin,
        float xmax,
        float ymin,
        float ymax
        );

    void getGridLimits(
        float& xmin,
        float& xmax,
        float& ymin,
        float& ymax
        ) const;

    void enableTransparency(bool v);

    void enableColorFromZ(
        bool v,
        mrpt::img::TColormap colorMap = mrpt::img::cmJET
        );

    void setZ(const mrpt::math::CMatrixDynamic<float>& in_Z);
    void getZ(mrpt::math::CMatrixFloat& out) const;
    float getXMin() const;
    float getXMax() const;
    float getYMin() const;
    float getYMax() const;
    void setXMin(float nxm);
    void setXMax(float nxm);
    void setYMin(float nym);
    void setYMax(float nym);

    void getXBounds(
        float& min,
        float& max
        ) const;

    void getYBounds(
        float& min,
        float& max
        ) const;

    void setXBounds(
        float min,
        float max
        );

    void setYBounds(
        float min,
        float max
        );

    virtual mrpt::math::TBoundingBoxf internalBoundingBoxLocal() const;
    void assignImage(const mrpt::img::CImage& img);
    void assignImageAndZ(const mrpt::img::CImage& img, const mrpt::math::CMatrixDynamic<float>& in_Z);
    void adjustGridToImageAR();
    void setPointSize(float p);
    void enableVariablePointSize(bool enable = true);
    void setVariablePointSize_k(float v);
    void setVariablePointSize_DepthScale(float v);
};

Inherited Members

public:
    // structs

    struct OutdatedState;
    struct State;

    // methods

    const auto& shaderPointsVertexPointBuffer() const;
    const auto& shaderPointsVertexColorBuffer() const;
    auto& shaderPointsBuffersMutex() const;
    float getPointSize() const;
    bool isEnabledVariablePointSize() const;
    float getVariablePointSize_k() const;
    float getVariablePointSize_DepthScale() const;

Construction

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.

Methods

void setZ(const mrpt::math::CMatrixDynamic<float>& in_Z)

This method sets the matrix of heights for each position (cell) in the mesh grid.

void getZ(mrpt::math::CMatrixFloat& out) const

Returns a reference to the internal Z matrix, allowing changing it efficiently.

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()

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.

void adjustGridToImageAR()

Adjust grid limits according to the image aspect ratio, maintaining the X limits and resizing in the Y direction.

void setPointSize(float p)

By default is 1.0.

See also:

enableVariablePointSize()

void enableVariablePointSize(bool enable = true)

Enable/disable variable eye distance-dependent point size (default=true)

void setVariablePointSize_k(float v)

see CRenderizableShaderPoints for a discussion of this parameter.

void setVariablePointSize_DepthScale(float v)

see CRenderizableShaderPoints for a discussion of this parameter.