10 #ifndef opengl_CVectorField2D_H
11 #define opengl_CVectorField2D_H
51 float xMin,xMax,yMin,yMax;
72 inline void setPointColor(
const float R,
const float G,
const float B,
const float A = 1)
74 m_point_color =
TColor(R*255,G*255,B*255,A*255);
88 m_field_color =
TColor(R*255,G*255,B*255,A*255);
126 xMin = center_x - 0.5*cellsize_x*(xcomp.getColCount()-1);
127 xMax = center_x + 0.5*cellsize_x*(xcomp.getColCount()-1);
128 yMin = center_y - 0.5*cellsize_y*(xcomp.getRowCount()-1);
129 yMax = center_y + 0.5*cellsize_y*(xcomp.getRowCount()-1);
136 void setGridLimits(
const float xmin,
const float xmax,
const float ymin,
const float ymax)
138 xMin=xmin; xMax = xmax;
139 yMin=ymin; yMax = ymax;
148 xmin=xMin; xmax=xMax;
149 ymin=yMin; ymax=yMax;
174 ASSERT_((Matrix_x.getRowCount() == Matrix_y.getRowCount())&&(Matrix_x.getColCount() == Matrix_y.getColCount()))
183 void adjustVectorFieldToGrid();
190 xcomp.resize(rows, cols);
191 ycomp.resize(rows, cols);
199 xcomp.resize(rows, cols);
200 ycomp.resize(rows, cols);
213 static CVectorField2DPtr Create(
const CMatrixFloat Matrix_x,
const CMatrixFloat Matrix_y,
float xmin=-1,
float xmax=1,
float ymin=-1,
float ymax=1);
216 void render_dl()
const;
virtual ~CVectorField2D()
Private, virtual destructor: only can be deleted from smart pointers.
void enableAntiAliasing(bool enable=true)
float getPointSize() const
Get the size with which points are drawn.
float getLineWidth() const
Get the width with which lines are drawn.
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated) ...
struct BASE_IMPEXP TSegment3D
TColorf getPointColor() const
Get the point color in the range [0,1].
const CMatrixFloat & getVectorField_y() const
Get the "y" component of the vector field, as a matrix where each entry represents a point in the 2D ...
TColorf getVectorFieldColor() const
Get the arrow color in the range [0,1].
A renderizable object suitable for rendering with OpenGL's display lists.
CMatrixFloat & getVectorField_x()
void setPointSize(const float p)
Set the size with which points will be drawn.
#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...
void reserve(size_t rows, size_t cols)
Reserves an amount of lines to the set.
void resize(size_t rows, size_t cols)
Resizes the set.
bool isAntiAliasingEnabled() const
size_t getRowCount() const
Returns the total count of columns used to represent the vector field.
CMatrixTemplateNumeric< float > CMatrixFloat
Declares a matrix of float numbers (non serializable).
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...
void setVectorField(CMatrixFloat &Matrix_x, CMatrixFloat &Matrix_y)
Set the vector field.
A 2D vector field representation, consisting of points and arrows drawn on a plane (invisible grid)...
void setLineWidth(const float w)
Set the width with which lines will be drawn.
size_t getColCount() const
Returns the total count of rows used to represent the vector field.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
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 setPointColor(const float R, const float G, const float B, const float A=1)
Set the point color in the range [0,1].
void getVectorField(CMatrixFloat &Matrix_x, CMatrixFloat &Matrix_y) const
Get the vector field.
const CMatrixFloat & getVectorField_x() const
Get the "x" component of the vector field, as a matrix where each entry represents a point in the 2D ...
A RGB color - floats in the range [0,1].
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...
This class is a "CSerializable" wrapper for "CMatrixFloat".
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
void setVectorFieldColor(const float R, const float G, const float B, const float A=1)
Set the arrow color in the range [0,1].
CMatrixFloat & getVectorField_y()