10 #ifndef opengl_CVectorField2D_H
11 #define opengl_CVectorField2D_H
64 inline void setPointColor(
const float R,
const float G,
const float B,
const float A = 1)
118 xMin = center_x - 0.5*cellsize_x*(xcomp.getColCount()-1);
119 xMax = center_x + 0.5*cellsize_x*(xcomp.getColCount()-1);
120 yMin = center_y - 0.5*cellsize_y*(xcomp.getRowCount()-1);
121 yMax = center_y + 0.5*cellsize_y*(xcomp.getRowCount()-1);
128 void setGridLimits(
const float xmin,
const float xmax,
const float ymin,
const float ymax)
130 xMin=xmin; xMax = xmax;
131 yMin=ymin; yMax = ymax;
140 xmin=xMin; xmax=xMax;
141 ymin=yMin; ymax=yMax;
166 ASSERT_((Matrix_x.getRowCount() == Matrix_y.getRowCount())&&(Matrix_x.getColCount() == Matrix_y.getColCount()))
180 xcomp.resize(rows, cols);
181 ycomp.resize(rows, cols);
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
This class is a "CSerializable" wrapper for "CMatrixFloat".
A matrix of dynamic size.
A renderizable object suitable for rendering with OpenGL's display lists.
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated)
A 2D vector field representation, consisting of points and arrows drawn on a plane (invisible grid).
CVectorField2D(mrpt::math::CMatrixFloat Matrix_x, mrpt::math::CMatrixFloat Matrix_y, float xmin=-1, float xmax=1, float ymin=-1, float ymax=1)
Constructor with a initial set of lines.
bool isAntiAliasingEnabled() const
mrpt::math::CMatrix xcomp
X component of the vector field.
mrpt::utils::TColorf getPointColor() const
Get the point color in the range [0,1].
mrpt::math::CMatrixFloat & getVectorField_y()
This is an overloaded member function, provided for convenience. It differs from the above function o...
void getGridLimits(float &xmin, float &xmax, float &ymin, float &ymax) const
Get the coordinates of the grid on where the vector field is drawn using the max and min values.
void setVectorField(mrpt::math::CMatrixFloat &Matrix_x, mrpt::math::CMatrixFloat &Matrix_y)
Set the vector field.
CVectorField2D()
Constructor.
static CVectorField2DPtr Create(const mrpt::math::CMatrixFloat &Matrix_x, const mrpt::math::CMatrixFloat &Matrix_y, float xmin=-1, float xmax=1, float ymin=-1, float ymax=1)
Class factory.
size_t getColCount() const
Returns the total count of rows used to represent the vector field.
void setPointSize(const float p)
Set the size with which points will be drawn.
mrpt::math::CMatrix ycomp
Y component of the vector field.
float getPointSize() const
Get the size with which points are drawn.
mrpt::utils::TColor m_field_color
void setVectorFieldColor(const float R, const float G, const float B, const float A=1)
Set the arrow color in the range [0,1].
void setLineWidth(const float w)
Set the width with which lines will be drawn.
float m_pointSize
By default is 1.0.
void getVectorField(mrpt::math::CMatrixFloat &Matrix_x, mrpt::math::CMatrixFloat &Matrix_y) const
Get the vector field.
mrpt::utils::TColorf getVectorFieldColor() const
Get the arrow color in the range [0,1].
mrpt::math::CMatrixFloat & getVectorField_x()
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setGridCenterAndCellSize(const float center_x, const float center_y, const float cellsize_x, const float cellsize_y)
Set the coordinates of the grid on where the vector field will be drawn by setting its center and the...
void adjustVectorFieldToGrid()
Adjust the vector field in the scene (vectors magnitude) according to the grid size.
void resize(size_t rows, size_t cols)
Resizes the set.
void render_dl() const MRPT_OVERRIDE
Render.
virtual ~CVectorField2D()
Private, virtual destructor: only can be deleted from smart pointers.
float m_LineWidth
By default is 1.0.
const mrpt::math::CMatrixFloat & getVectorField_y() const
Get the "y" component of the vector field, as a matrix where each entry represents a point in the 2D ...
bool m_antiAliasing
By default is true.
mrpt::utils::TColor m_point_color
const mrpt::math::CMatrixFloat & getVectorField_x() const
Get the "x" component of the vector field, as a matrix where each entry represents a point in the 2D ...
void setPointColor(const float R, const float G, const float B, const float A=1)
Set the point color in the range [0,1].
void clear()
Clear the matrices.
float getLineWidth() const
Get the width with which lines are drawn.
void setGridLimits(const float xmin, const float xmax, const float ymin, const float ymax)
Set the coordinates of the grid on where the vector field will be drawn using x-y max and min values.
size_t getRowCount() const
Returns the total count of columns used to represent the vector field.
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
A RGB color - floats in the range [0,1].