class mrpt::viz::CAngularObservationMesh

Overview

A mesh built from a set of 2D laser scan observations.

Each element of this set is a single scan through the yaw, given a specific pitch. Each scan has a mrpt::poses::CPose3D identifying the origin of the scan, which ideally is the same for every one of them.

#include <mrpt/viz/CAngularObservationMesh.h>

class CAngularObservationMesh:
    public CRenderizableShaderTriangles,
    public CRenderizableShaderWireFrame
{
public:
    // structs

    struct TDoubleRange;

    // classes

    template <class T>
    class FTrace1D;

    template <class T>
    class FTrace2D;

    // construction

    CAngularObservationMesh();

    // methods

    void freeOpenGLResources();
    void render(const RenderContext& rc) const;
    void renderUpdateBuffers() const;
    virtual shader_list_t requiredShaders() const;
    void onUpdateBuffers_Wireframe();
    void onUpdateBuffers_Triangles();
    auto internalBoundingBoxLocal() const;
    bool isWireframe() const;
    void setWireframe(bool enabled = true);
    bool isTransparencyEnabled() const;
    void enableTransparency(bool enabled = true);
    bool traceRay(const mrpt::poses::CPose3D& o, double& dist) const;
    void setPitchBounds(const double initial, const double final);
    void setPitchBounds(const std::vector<double>& bounds);
    void getPitchBounds(double& initial, double& final) const;
    void getPitchBounds(std::vector<double>& bounds) const;
    void getScanSet(std::vector<mrpt::obs::CObservation2DRangeScan>& scans) const;
    bool setScanSet(const std::vector<mrpt::obs::CObservation2DRangeScan>& scans);
    void generateSetOfTriangles(CSetOfTriangles::Ptr& res) const;
    void generatePointCloud(mrpt::maps::CPointsMap* out_map) const;
    void getTracedRays(CSetOfLines::Ptr& res) const;
    void getUntracedRays(CSetOfLines::Ptr& res, double dist) const;
    void generateSetOfTriangles(std::vector<mrpt::math::TPolygon3D>& res) const;
    void getActualMesh(mrpt::math::CMatrixDynamic<mrpt::math::TPoint3D_data<double>>& pts, mrpt::math::CMatrixBool& validity) const;

    template <class T>
    static void trace2DSetOfRays(
        const T& e,
        const mrpt::poses::CPose3D& initial,
        CAngularObservationMesh::Ptr& caom,
        const TDoubleRange& pitchs,
        const TDoubleRange& yaws
        );

    template <class T>
    static void trace1DSetOfRays(
        const T& e,
        const mrpt::poses::CPose3D& initial,
        mrpt::obs::CObservation2DRangeScan& obs,
        const TDoubleRange& yaws
        );
};

Construction

CAngularObservationMesh()

Basic constructor.

Methods

bool isWireframe() const

Returns whether the object is configured as wireframe or solid.

void setWireframe(bool enabled = true)

Sets the display mode for the object.

True=wireframe, False=solid.

bool isTransparencyEnabled() const

Returns whether the object may be transparent or not.

void enableTransparency(bool enabled = true)

Enables or disables transparencies.

bool traceRay(const mrpt::poses::CPose3D& o, double& dist) const

Traces a ray to the object, returning the distance to a given pose through its X axis.

See also:

mrpt::viz::CRenderizable, trace2DSetOfRays, trace1DSetOfRays

void setPitchBounds(const double initial, const double final)

Sets the pitch bounds for this range.

void setPitchBounds(const std::vector<double>& bounds)

Sets the pitch bounds for this range.

void getPitchBounds(double& initial, double& final) const

Gets the initial and final pitch bounds for this range.

void getPitchBounds(std::vector<double>& bounds) const

Gets the pitch bounds for this range.

void getScanSet(std::vector<mrpt::obs::CObservation2DRangeScan>& scans) const

Gets the scan set.

bool setScanSet(const std::vector<mrpt::obs::CObservation2DRangeScan>& scans)

Sets the scan set.

void generateSetOfTriangles(CSetOfTriangles::Ptr& res) const

Gets the mesh as a set of triangles, for displaying them.

See also:

generateSetOfTriangles (std::vector<TPolygon3D> &), mrpt::viz::CSetOfTriangles,mrpt::viz::mrpt::viz::TTriangle

void generatePointCloud(mrpt::maps::CPointsMap* out_map) const

Returns the scanned points as a 3D point cloud.

The target pointmap must be passed as a pointer to allow the use of any derived class.

void getTracedRays(CSetOfLines::Ptr& res) const

Gets a set of lines containing the traced rays, for displaying them.

See also:

getUntracedRays, mrpt::viz::CSetOfLines

void getUntracedRays(CSetOfLines::Ptr& res, double dist) const

Gets a set of lines containing the untraced rays, up to a specified distance, for displaying them.

See also:

getTracedRays, mrpt::viz::CSetOfLines

void generateSetOfTriangles(std::vector<mrpt::math::TPolygon3D>& res) const

Gets the mesh as a set of polygons, to work with them.

See also:

generateSetOfTriangles(mrpt::viz::CSetOfTriangles &)

void getActualMesh(mrpt::math::CMatrixDynamic<mrpt::math::TPoint3D_data<double>>& pts, mrpt::math::CMatrixBool& validity) const

Retrieves the full mesh, along with the validity matrix.

template <class T>
static void trace2DSetOfRays(
    const T& e,
    const mrpt::poses::CPose3D& initial,
    CAngularObservationMesh::Ptr& caom,
    const TDoubleRange& pitchs,
    const TDoubleRange& yaws
    )

2D ray tracing (will generate a 3D mesh).

Given an object and two ranges, realizes a scan from the initial pose and stores it in a CAngularObservationMesh object. The objective may be a Scene, a CRenderizable or any children of its.

See also:

mrpt::viz::CRenderizable, mrpt::viz::Scene.

template <class T>
static void trace1DSetOfRays(
    const T& e,
    const mrpt::poses::CPose3D& initial,
    mrpt::obs::CObservation2DRangeScan& obs,
    const TDoubleRange& yaws
    )

2D ray tracing (will generate a vectorial mesh inside a plane).

Given an object and a range, realizes a scan from the initial pose and stores it in a CObservation2DRangeScan object. The objective may be a Scene, a CRenderizable or any children of its.

See also:

mrpt::viz::CRenderizable, mrpt::viz::Scene.