Class CVectorField3D

Inheritance Relationships

Base Types

Class Documentation

class CVectorField3D : public virtual mrpt::viz::CVisualObject, public mrpt::viz::VisualObjectParams_Points, public mrpt::viz::VisualObjectParams_Lines

A 3D vector field representation, consisting of points and arrows drawn at any spatial position. This opengl object has been created to represent scene flow, and hence both the vector field and the coordinates of the points at which the vector field is represented are stored in matrices because they are computed from intensity and depth images.

../../output_staging/generated/doxygen/xml/preview_CVectorField3D.png

See also

opengl::Scene

Public Functions

CVectorField3D()
CVectorField3D(mrpt::math::CMatrixFloat x_vf_ini, mrpt::math::CMatrixFloat y_vf_ini, mrpt::math::CMatrixFloat z_vf_ini, mrpt::math::CMatrixFloat x_p_ini, mrpt::math::CMatrixFloat y_p_ini, mrpt::math::CMatrixFloat z_p_ini)
~CVectorField3D() override = default
inline void clear()

Clear the matrices

inline void setPointColor(const float R, const float G, const float B, const float A = 1)

Set the point color in the range [0,1]

inline mrpt::img::TColorf getPointColor() const

Get the point color in the range [0,1]

inline void setVectorFieldColor(const float R, const float G, const float B, const float A = 1)

Set the arrow color in the range [0,1]

inline void getVectorFieldColor(mrpt::img::TColorf Cmin, mrpt::img::TColorf Cmax) const

Get the motion field min and max colors (colormap) in the range [0,1]

inline void setMotionFieldColormap(const float Rmin, const float Gmin, const float Bmin, const float Rmax, const float Gmax, const float Bmax, const float Amin = 1, const float Amax = 1)

Set the motion field min and max colors (colormap) in the range [0,1]

inline mrpt::img::TColorf getVectorFieldColor() const

Get the arrow color in the range [0,1]

inline void setMaxSpeedForColor(const float s)

Set the max speed associated for the color map ( m_still_color, m_maxspeed_color)

inline float getMaxSpeedForColor() const

Get the max_speed with which lines are drawn.

inline void getVectorField(mrpt::math::CMatrixFloat &Matrix_x, mrpt::math::CMatrixFloat &Matrix_y, mrpt::math::CMatrixFloat &Matrix_z) const

Get the vector field in three independent matrices: Matrix_x, Matrix_y and Matrix_z.

template<class MATRIX>
inline void getVectorField(MATRIX &Matrix_x, MATRIX &Matrix_y, MATRIX &Matrix_z) const
inline void getPointCoordinates(mrpt::math::CMatrixFloat &Coord_x, mrpt::math::CMatrixFloat &Coord_y, mrpt::math::CMatrixFloat &Coord_z) const

Get the coordiantes of the points at which the vector field is plotted: Coord_x, Coord_y and Coord_z.

template<class MATRIX>
inline void getPointCoordinates(MATRIX &Coord_x, MATRIX &Coord_y, MATRIX &Coord_z) const
inline const mrpt::math::CMatrixFloat &getVectorField_x() const

Get the “x” component of the vector field as a matrix.

inline mrpt::math::CMatrixFloat &getVectorField_x()

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

inline const mrpt::math::CMatrixFloat &getVectorField_y() const

Get the “y” component of the vector field as a matrix.

inline mrpt::math::CMatrixFloat &getVectorField_y()

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

inline const mrpt::math::CMatrixFloat &getVectorField_z() const

Get the “z” component of the vector field as a matrix.

inline mrpt::math::CMatrixFloat &getVectorField_z()

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

inline void setVectorField(mrpt::math::CMatrixFloat &Matrix_x, mrpt::math::CMatrixFloat &Matrix_y, mrpt::math::CMatrixFloat &Matrix_z)

Set the vector field with Matrix_x, Matrix_y and Matrix_z.

template<class MATRIX>
inline void setVectorField(MATRIX &Matrix_x, MATRIX &Matrix_y, MATRIX &Matrix_z)
inline void setPointCoordinates(mrpt::math::CMatrixFloat &Matrix_x, mrpt::math::CMatrixFloat &Matrix_y, mrpt::math::CMatrixFloat &Matrix_z)

Set the coordinates of the points at which the vector field is plotted with Matrix_x, Matrix_y and Matrix_z.

template<class MATRIX>
inline void setPointCoordinates(MATRIX &Matrix_x, MATRIX &Matrix_y, MATRIX &Matrix_z)
inline void resize(size_t rows, size_t cols)

Resizes the set.

inline size_t cols() const

Returns the total count of rows used to represent the vector field.

inline size_t rows() const

Returns the total count of columns used to represent the vector field.

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

inline void enableColorFromModule(bool enable = true)
inline void enableShowPoints(bool enable = true)
inline bool isColorFromModuleEnabled() const

Protected Attributes

mrpt::math::CMatrixF x_vf

X component of the vector field

mrpt::math::CMatrixF y_vf

Y component of the vector field

mrpt::math::CMatrixF z_vf

Z component of the vector field

mrpt::math::CMatrixF x_p

X coordinate of the points at which the vector field is plotted

mrpt::math::CMatrixF y_p

Y coordinate of the points at which the vector field is plotted

mrpt::math::CMatrixF z_p

Z coordinate of the points at which the vector field is plotted

bool m_colorFromModule = {false}

By default it is false

bool m_showPoints = {true}

By default it is true

mrpt::img::TColor m_point_color
mrpt::img::TColor m_field_color
mrpt::img::TColor m_still_color

Color associated to fields with null module

mrpt::img::TColor m_maxspeed_color

Color associated to fields whose module is equal or larger than ‘m_maxspeed’

float m_maxspeed

Value of the module of the motion field which will correspond to ‘m_maxspeed_color’