88 const float R,
const float G,
const float B,
const float A = 1)
106 const float R,
const float G,
const float B,
const float A = 1)
127 const float center_x,
const float center_y,
const float cellsize_x,
128 const float cellsize_y)
142 const float xmin,
const float xmax,
const float ymin,
const float ymax)
155 void getGridLimits(
float& xmin,
float& xmax,
float& ymin,
float& ymax)
const 199 (Matrix_x.
rows() == Matrix_y.
rows()) &&
200 (Matrix_x.
cols() == Matrix_y.
cols()));
242 float xmin = -1,
float xmax = 1,
float ymin = -1,
float ymax = 1);
mrpt::img::TColorf getVectorFieldColor() const
Get the arrow color in the range [0,1].
void resize(size_t row, size_t col)
void enableAntiAliasing(bool enable=true)
virtual shader_list_t requiredShaders() const override
Returns the ID of the OpenGL shader program required to render this class.
void freeOpenGLResources() override
Free opengl buffers.
void notifyChange() const
Call to enable calling renderUpdateBuffers() before the next render() rendering iteration.
void getVectorField(mrpt::math::CMatrixFloat &Matrix_x, mrpt::math::CMatrixFloat &Matrix_y) const
Get the vector field.
mrpt::math::CMatrixF ycomp
Y component of the vector field.
mrpt::img::TColor m_point_color
Renderizable generic renderer for objects using the triangles shader.
void freeOpenGLResources() override
Free opengl buffers.
std::vector< shader_id_t > shader_list_t
A list of shader IDs.
Context for calls to render()
void renderUpdateBuffers() const override
Called whenever m_outdatedBuffers is true: used to re-generate OpenGL vertex buffers, etc.
#define ASSERT_(f)
Defines an assertion mechanism.
void onUpdateBuffers_Triangles() override
Must be implemented in derived classes to update the geometric entities to be drawn in "m_*_buffer" f...
mrpt::math::CMatrixF xcomp
X component of the vector field.
void resize(size_t rows, size_t cols)
Resizes the set.
static constexpr shader_id_t WIREFRAME
void onUpdateBuffers_Points() override
Must be implemented in derived classes to update the geometric entities to be drawn in "m_*_buffer" f...
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 freeOpenGLResources() override
Free opengl buffers.
size_type rows() const
Number of rows in the matrix.
size_type cols() const
Number of columns in the matrix.
A 2D vector field representation, consisting of points and arrows drawn on a plane (invisible grid)...
Renderizable generic renderer for objects using the points shader.
static constexpr shader_id_t TRIANGLES
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 ...
CVectorField2D()
Constructor.
void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const override
Evaluates the bounding box of this object (including possible children) in the coordinate frame of th...
mrpt::math::CMatrixFloat & getVectorField_y()
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 ...
size_t cols() const
Returns the total count of rows used to represent the vector field.
This class is a "CSerializable" wrapper for "CMatrixFloat".
uint8_t f2u8(const float f)
converts a float [0,1] into an uint8_t [0,255] (without checking for out of bounds) ...
~CVectorField2D() override=default
Private, virtual destructor: only can be deleted from smart pointers.
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 clear()
Clear the matrices.
Renderizable generic renderer for objects using the wireframe shader.
An RGBA color - floats in the range [0,1].
void onUpdateBuffers_Wireframe() override
Must be implemented in derived classes to update the geometric entities to be drawn in "m_*_buffer" f...
The namespace for 3D scene representation and rendering.
void setVectorField(mrpt::math::CMatrixFloat &Matrix_x, mrpt::math::CMatrixFloat &Matrix_y)
Set the vector field.
void adjustVectorFieldToGrid()
Adjust the vector field in the scene (vectors magnitude) according to the grid size.
void render(const RenderContext &rc) const override
Implements the rendering of 3D objects in each class derived from CRenderizable.
#define DEFINE_SERIALIZABLE(class_name, NS)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
bool isAntiAliasingEnabled() const
mrpt::img::TColor m_field_color
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 freeOpenGLResources() override
Free opengl buffers.
This template class provides the basic functionality for a general 2D any-size, resizable container o...
static constexpr shader_id_t POINTS
size_t rows() const
Returns the total count of columns used to represent the vector field.
mrpt::img::TColorf getPointColor() const
Get the point color in the range [0,1].
void setVectorFieldColor(const float R, const float G, const float B, const float A=1)
Set the arrow color in the range [0,1].
mrpt::math::CMatrixFloat & getVectorField_x()