Class CAngularObservationMesh

Nested Relationships

Nested Types

Inheritance Relationships

Base Types

  • public mrpt::viz::CVisualObject

  • public mrpt::viz::VisualObjectParams_Triangles

  • public mrpt::viz::VisualObjectParams_Lines

Class Documentation

class CAngularObservationMesh : public virtual mrpt::viz::CVisualObject, public mrpt::viz::VisualObjectParams_Triangles, public mrpt::viz::VisualObjectParams_Lines

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.

mrpt::viz::CAngularObservationMesh

../../output_staging/generated/doxygen/xml/preview_CAngularObservationMesh.png

Public Functions

virtual auto internalBoundingBoxLocal() const -> mrpt::math::TBoundingBoxf override
inline CAngularObservationMesh()

Basic constructor.

~CAngularObservationMesh() override = default

Empty destructor.

inline bool isWireframe() const

Returns whether the object is configured as wireframe or solid.

inline void setWireframe(bool enabled = true)

Sets the display mode for the object. True=wireframe, False=solid.

inline bool isTransparencyEnabled() const

Returns whether the object may be transparent or not.

inline void enableTransparency(bool enabled = true)

Enables or disables transparencies.

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

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.

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.

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

inline 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.

Public Static Functions

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 inline 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.

Protected Functions

void updateMesh() const

Updates the mesh, if needed. It’s a const method, but modifies mutable content.

void updateMeshImpl() const
void addTriangle(const mrpt::math::TPoint3D &p1, const mrpt::math::TPoint3D &p2, const mrpt::math::TPoint3D &p3) const

Internal method to add a triangle to the mutable mesh.

Protected Attributes

mutable std::vector<mrpt::viz::TTriangle> triangles

Actual set of triangles to be displayed.

bool m_Wireframe = {true}

Whether the mesh will be displayed wireframe or solid.

mutable bool meshUpToDate = {false}

Mutable variable which controls if the object has suffered any change since last time the mesh was updated.

bool mEnableTransparency = {true}

Whether the object may present transparencies or not.

mutable mrpt::math::CMatrixDynamic<mrpt::math::TPoint3D_data<double>> actualMesh

Mutable object with the mesh’s points.

mutable mrpt::math::CMatrixB validityMatrix

Scan validity matrix.

std::vector<double> pitchBounds

Observation pitch range. When containing exactly two elements, they represent the bounds.

std::vector<mrpt::obs::CObservation2DRangeScan> scanSet

Actual scan set which is used to generate the mesh.

struct TDoubleRange

Range specification type, with several uses.

Public Functions

inline TDoubleRange(double a, double b, double c)

Constructor from initial value, final value and range.

inline TDoubleRange(double a, double b, size_t c)

Constructor from initial value, final value and amount of samples.

inline TDoubleRange(double a, size_t b, bool c)

Constructor from aperture, amount of samples and scan direction.

inline double aperture() const

Returns the total aperture of the range.

Throws:

std::logic_error – on invalid range type.

inline double initialValue() const

Returns the first value of the range.

Throws:

std::logic_error – on invalid range type.

inline double finalValue() const

Returns the last value of the range.

Throws:

std::logic_error – on invalid range type.

inline double increment() const

Returns the increment between two consecutive values of the range.

Throws:

std::logic_error – on invalid range type.

inline size_t amount() const

Returns the total amount of values in this range.

Throws:

std::logic_error – on invalid range type.

void values(std::vector<double> &vals) const

Gets a vector with every value in the range.

Throws:

std::logic_error – on invalid range type.

inline bool negToPos() const

Returns the direction of the scan. True if the increment is positive, false otherwise.

Throws:

std::logic_error – on invalid range type.

Public Static Functions

static inline TDoubleRange CreateFromIncrement(double initial, double final, double increment)

Creates a range of values from the initial value, the final value and the increment.

Throws:

std::logic_error – if the increment is zero.

static inline TDoubleRange CreateFromAmount(double initial, double final, size_t amount)

Creates a range of values from the initial value, the final value and a desired amount of samples.

static inline TDoubleRange CreateFromAperture(double aperture, size_t amount, bool negToPos = true)

Creates a zero-centered range of values from an aperture, an amount of samples and a direction.