Go to the documentation of this file.
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
90 for (
unsigned int i = 0; i <
xcomp.cols(); i++)
91 for (
unsigned int j = 0; j <
xcomp.rows(); j++)
101 for (
unsigned int i = 0; i <
xcomp.cols(); i++)
102 for (
unsigned int j = 0; j <
xcomp.rows(); j++)
107 yMin + j * y_cell_size +
ycomp(j, i), 0);
114 for (
unsigned int i = 0; i <
xcomp.cols(); i++)
115 for (
unsigned int j = 0; j <
xcomp.rows(); 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 +
204 const float x_cell_size = (
xMax -
xMin) / (
xcomp.cols() - 1);
205 const float y_cell_size = (
yMax -
yMin) / (
ycomp.rows() - 1);
207 for (
unsigned int i = 0; i <
xcomp.cols(); i++)
208 for (
unsigned int j = 0; j <
xcomp.rows(); j++)
210 const float tri_side =
213 const float ang = ::atan2(
ycomp(j, i),
xcomp(j, i)) - 1.5708;
215 if (-sin(ang) * 0.866 * tri_side +
xMin + i * x_cell_size +
218 bb_min.
x = -sin(ang) * 0.866 * tri_side +
xMin +
219 i * x_cell_size +
xcomp(j, i);
221 if (cos(ang) * 0.866 * tri_side +
yMin + j * y_cell_size +
224 bb_min.
y = cos(ang) * 0.866 * tri_side +
yMin +
225 j * y_cell_size +
ycomp(j, i);
227 if (-sin(ang) * 0.866 * tri_side +
xMin + i * x_cell_size +
230 bb_max.
x = -sin(ang) * 0.866 * tri_side +
xMin +
231 i * x_cell_size +
xcomp(j, i);
233 if (cos(ang) * 0.866 * tri_side +
yMin + j * y_cell_size +
236 bb_max.
y = cos(ang) * 0.866 * tri_side +
yMin +
237 j * y_cell_size +
ycomp(j, i);
249 const float ratio_xp =
251 const float ratio_xn =
253 const float ratio_yp =
255 const float ratio_yn =
257 const float norm_factor =
258 0.85 / max(max(ratio_xp, abs(ratio_xn)), max(ratio_yp, abs(ratio_yn)));
260 xcomp *= norm_factor;
261 ycomp *= norm_factor;
GLAPI void GLAPIENTRY glBegin(GLenum mode)
CVectorField2D()
Constructor.
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
void adjustVectorFieldToGrid()
Adjust the vector field in the scene (vectors magnitude) according to the grid size.
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...
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
GLAPI void GLAPIENTRY glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
A renderizable object suitable for rendering with OpenGL's display lists.
float m_pointSize
By default is 1.0.
mrpt::img::TColor m_field_color
GLAPI void GLAPIENTRY glDisable(GLenum cap)
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated)
#define MRPT_UNUSED_PARAM(a)
Determines whether this is an X86 or AMD64 platform.
A 2D vector field representation, consisting of points and arrows drawn on a plane (invisible grid).
GLAPI void GLAPIENTRY glEnable(GLenum cap)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
GLAPI void GLAPIENTRY glVertex3f(GLfloat x, GLfloat y, GLfloat z)
#define ASSERT_(f)
Defines an assertion mechanism.
bool m_antiAliasing
By default is true.
Virtual base class for "archives": classes abstracting I/O streams.
A matrix of dynamic size.
GLAPI void GLAPIENTRY glEnd(void)
mrpt::poses::CPose3D m_pose
6D pose wrt the parent coordinate reference.
mrpt::img::TColor m_color
Color components in the range [0,255].
static void checkOpenGLError()
Checks glGetError and throws an exception if an error situation is found.
GLAPI void GLAPIENTRY glLineWidth(GLfloat width)
#define GL_ONE_MINUS_SRC_ALPHA
GLAPI void GLAPIENTRY glPushAttrib(GLbitfield mask)
double x
X,Y,Z coordinates.
void render_dl() const override
Render.
GLAPI void GLAPIENTRY glPointSize(GLfloat size)
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
float m_LineWidth
By default is 1.0.
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...
mrpt::img::TColor m_point_color
GLAPI void GLAPIENTRY glPopAttrib(void)
mrpt::math::CMatrix xcomp
X component of the vector field.
This base provides a set of functions for maths stuff.
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
void writeToStreamRender(mrpt::serialization::CArchive &out) const
The namespace for 3D scene representation and rendering.
void readFromStreamRender(mrpt::serialization::CArchive &in)
mrpt::math::CMatrix ycomp
Y component of the vector field.
GLAPI void GLAPIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor)
#define GL_COLOR_BUFFER_BIT
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST | |