37 m_point_color = m_color;
38 m_field_color = m_color;
44 float ymin,
float ymax)
45 : m_LineWidth(1.0), m_pointSize(1.0), m_antiAliasing(true)
62 #if MRPT_HAS_OPENGL_GLUT 87 const float x_cell_size = (
xMax -
xMin) / (
xcomp.getColCount() - 1);
88 const float y_cell_size = (
yMax -
yMin) / (
ycomp.getRowCount() - 1);
90 for (
unsigned int i = 0; i <
xcomp.getColCount(); i++)
91 for (
unsigned int j = 0; j <
xcomp.getRowCount(); j++)
101 for (
unsigned int i = 0; i <
xcomp.getColCount(); i++)
102 for (
unsigned int j = 0; j <
xcomp.getRowCount(); j++)
107 yMin + j * y_cell_size +
ycomp(j, i), 0);
114 for (
unsigned int i = 0; i <
xcomp.getColCount(); i++)
115 for (
unsigned int j = 0; j <
xcomp.getRowCount(); j++)
117 const float tri_side =
120 const float ang = ::atan2(
ycomp(j, i),
xcomp(j, i)) - 1.5708;
122 -sin(ang) * 0.866 * tri_side +
xMin + i * x_cell_size +
124 cos(ang) * 0.866 * tri_side +
yMin + j * y_cell_size +
128 cos(ang) * 0.5 * tri_side +
xMin + i * x_cell_size +
130 sin(ang) * 0.5 * tri_side +
yMin + j * y_cell_size +
134 -cos(ang) * 0.5 * tri_side +
xMin + i * x_cell_size +
136 -sin(ang) * 0.5 * tri_side +
yMin + j * y_cell_size +
212 const float x_cell_size = (
xMax -
xMin) / (
xcomp.getColCount() - 1);
213 const float y_cell_size = (
yMax -
yMin) / (
ycomp.getRowCount() - 1);
215 for (
unsigned int i = 0; i <
xcomp.getColCount(); i++)
216 for (
unsigned int j = 0; j <
xcomp.getRowCount(); j++)
218 const float tri_side =
221 const float ang = ::atan2(
ycomp(j, i),
xcomp(j, i)) - 1.5708;
223 if (-sin(ang) * 0.866 * tri_side +
xMin + i * x_cell_size +
226 bb_min.
x = -sin(ang) * 0.866 * tri_side +
xMin +
227 i * x_cell_size +
xcomp(j, i);
229 if (cos(ang) * 0.866 * tri_side +
yMin + j * y_cell_size +
232 bb_min.
y = cos(ang) * 0.866 * tri_side +
yMin +
233 j * y_cell_size +
ycomp(j, i);
235 if (-sin(ang) * 0.866 * tri_side +
xMin + i * x_cell_size +
238 bb_max.
x = -sin(ang) * 0.866 * tri_side +
xMin +
239 i * x_cell_size +
xcomp(j, i);
241 if (cos(ang) * 0.866 * tri_side +
yMin + j * y_cell_size +
244 bb_max.
y = cos(ang) * 0.866 * tri_side +
yMin +
245 j * y_cell_size +
ycomp(j, i);
257 const float ratio_xp =
259 const float ratio_xn =
261 const float ratio_yp =
263 const float ratio_yn =
265 const float norm_factor =
266 0.85 / max(max(ratio_xp, abs(ratio_xn)), max(ratio_yp, abs(ratio_yn)));
268 xcomp *= norm_factor;
269 ycomp *= norm_factor;
void writeToStreamRender(utils::CStream &out) const
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
GLAPI void GLAPIENTRY glEnable(GLenum cap)
GLAPI void GLAPIENTRY glPointSize(GLfloat size)
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
mrpt::math::CMatrix ycomp
Y component of the vector field.
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated) ...
#define GL_ONE_MINUS_SRC_ALPHA
mrpt::math::CMatrix xcomp
X component of the vector field.
GLAPI void GLAPIENTRY glPopAttrib(void)
GLAPI void GLAPIENTRY glLineWidth(GLfloat width)
mrpt::poses::CPose3D m_pose
6D pose wrt the parent coordinate reference.
GLAPI void GLAPIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor)
mrpt::utils::TColor m_point_color
A renderizable object suitable for rendering with OpenGL's display lists.
#define GL_COLOR_BUFFER_BIT
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
This base provides a set of functions for maths stuff.
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const override
Introduces a pure virtual method responsible for writing to a CStream.
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
mrpt::utils::TColor m_field_color
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
void readFromStreamRender(mrpt::utils::CStream &in)
mrpt::utils::TColor m_color
Color components in the range [0,255].
double x
X,Y,Z coordinates.
GLAPI void GLAPIENTRY glBegin(GLenum mode)
A 2D vector field representation, consisting of points and arrows drawn on a plane (invisible grid)...
GLAPI void GLAPIENTRY glVertex3f(GLfloat x, GLfloat y, GLfloat z)
GLAPI void GLAPIENTRY glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
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...
static void checkOpenGLError()
Checks glGetError and throws an exception if an error situation is found.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
bool m_antiAliasing
By default is true.
GLAPI void GLAPIENTRY glPushAttrib(GLbitfield mask)
void composePoint(double lx, double ly, double lz, double &gx, double &gy, double &gz, mrpt::math::CMatrixFixedNumeric< double, 3, 3 > *out_jacobian_df_dpoint=nullptr, mrpt::math::CMatrixFixedNumeric< double, 3, 6 > *out_jacobian_df_dpose=nullptr, mrpt::math::CMatrixFixedNumeric< double, 3, 6 > *out_jacobian_df_dse3=nullptr, bool use_small_rot_approx=false) const
An alternative, slightly more efficient way of doing with G and L being 3D points and P this 6D pose...
The namespace for 3D scene representation and rendering.
void adjustVectorFieldToGrid()
Adjust the vector field in the scene (vectors magnitude) according to the grid size.
GLAPI void GLAPIENTRY glEnd(void)
A matrix of dynamic size.
float m_pointSize
By default is 1.0.
void render_dl() const override
Render.
GLAPI void GLAPIENTRY glDisable(GLenum cap)
void readFromStream(mrpt::utils::CStream &in, int version) override
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
float m_LineWidth
By default is 1.0.