28 return CVectorField2DPtr(
new CVectorField2D( Matrix_x, Matrix_y, xmin, xmax, ymin, ymax));
33 : xcomp(0,0), ycomp(0,0), xMin(-1.0), xMax(1.0), yMin(-1.0), yMax(1.0), m_LineWidth(1.0),m_pointSize(1.0),m_antiAliasing(true)
41 : m_LineWidth(1.0),m_pointSize(1.0),m_antiAliasing(true)
55 #if MRPT_HAS_OPENGL_GLUT 79 const float x_cell_size = (
xMax -
xMin)/(
xcomp.getColCount()-1);
80 const float y_cell_size = (
yMax -
yMin)/(
ycomp.getRowCount()-1);
82 for (
unsigned int i=0; i<
xcomp.getColCount(); i++)
83 for (
unsigned int j=0; j<
xcomp.getRowCount(); j++)
92 for (
unsigned int i=0; i<
xcomp.getColCount(); i++)
93 for (
unsigned int j=0; j<
xcomp.getRowCount(); j++)
102 for (
unsigned int i=0; i<
xcomp.getColCount(); i++)
103 for (
unsigned int j=0; j<
xcomp.getRowCount(); j++)
106 const float ang = ::atan2(
ycomp(j,i),
xcomp(j,i)) - 1.5708;
183 const float x_cell_size = (
xMax -
xMin)/(
xcomp.getColCount()-1);
184 const float y_cell_size = (
yMax -
yMin)/(
ycomp.getRowCount()-1);
186 for (
unsigned int i=0; i<
xcomp.getColCount(); i++)
187 for (
unsigned int j=0; j<
xcomp.getRowCount(); j++)
190 const float ang = ::atan2(
ycomp(j,i),
xcomp(j,i)) - 1.5708;
192 if ( -sin(ang)*0.866*tri_side +
xMin+i*x_cell_size +
xcomp(j,i) < bb_min.
x)
193 bb_min.
x = -sin(ang)*0.866*tri_side +
xMin+i*x_cell_size +
xcomp(j,i);
195 if ( cos(ang)*0.866*tri_side +
yMin+j*y_cell_size +
ycomp(j,i) < bb_min.
y)
196 bb_min.
y = cos(ang)*0.866*tri_side +
yMin+j*y_cell_size +
ycomp(j,i);
198 if ( -sin(ang)*0.866*tri_side +
xMin+i*x_cell_size +
xcomp(j,i) > bb_max.
x)
199 bb_max.
x = -sin(ang)*0.866*tri_side +
xMin+i*x_cell_size +
xcomp(j,i);
201 if ( cos(ang)*0.866*tri_side +
yMin+j*y_cell_size +
ycomp(j,i) > bb_max.
y)
202 bb_max.
y = cos(ang)*0.866*tri_side +
yMin+j*y_cell_size +
ycomp(j,i);
218 const float norm_factor = 0.85/max(max(ratio_xp, abs(ratio_xn)), max(ratio_yp, abs(ratio_yn)));
220 xcomp *= norm_factor;
221 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
double z
X,Y,Z coordinates.
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. This class automatically holds the cached 3x3 rotation m...
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
void composePoint(double lx, double ly, double lz, double &gx, double &gy, double &gz, mrpt::math::CMatrixFixedNumeric< double, 3, 3 > *out_jacobian_df_dpoint=NULL, mrpt::math::CMatrixFixedNumeric< double, 3, 6 > *out_jacobian_df_dpose=NULL, mrpt::math::CMatrixFixedNumeric< double, 3, 6 > *out_jacobian_df_dse3=NULL, 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...
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.
#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)
void render_dl() const MRPT_OVERRIDE
Render.
void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const MRPT_OVERRIDE
Evaluates the bounding box of this object (including possible children) in the coordinate frame of th...
mrpt::utils::TColor m_color
Color components in the range [0,255].
void readFromStream(mrpt::utils::CStream &in, int version)
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
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.
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 writeToStream(mrpt::utils::CStream &out, int *getVersion) const
Introduces a pure virtual method responsible for writing to a CStream.
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.
GLAPI void GLAPIENTRY glDisable(GLenum cap)
float m_LineWidth
By default is 1.0.