29 m_point_color = m_color;
30 m_field_color = m_color;
36 float ymin,
float ymax)
37 : m_LineWidth(1.0), m_pointSize(1.0), m_antiAliasing(true)
54 #if MRPT_HAS_OPENGL_GLUT 109 const float tri_side =
112 const float ang = ::atan2(
ycomp(j, i),
xcomp(j, i)) - 1.5708;
114 -sin(ang) * 0.866 * tri_side +
xMin + i * x_cell_size +
116 cos(ang) * 0.866 * tri_side +
yMin + j * y_cell_size +
120 cos(ang) * 0.5 * tri_side +
xMin + i * x_cell_size +
122 sin(ang) * 0.5 * tri_side +
yMin + j * y_cell_size +
126 -cos(ang) * 0.5 * tri_side +
xMin + i * x_cell_size +
128 -sin(ang) * 0.5 * tri_side +
yMin + j * y_cell_size +
202 const float tri_side =
205 const float ang = ::atan2(
ycomp(j, i),
xcomp(j, i)) - 1.5708;
207 if (-sin(ang) * 0.866 * tri_side +
xMin + i * x_cell_size +
210 bb_min.x = -sin(ang) * 0.866 * tri_side +
xMin +
211 i * x_cell_size +
xcomp(j, i);
213 if (cos(ang) * 0.866 * tri_side +
yMin + j * y_cell_size +
216 bb_min.y = cos(ang) * 0.866 * tri_side +
yMin +
217 j * y_cell_size +
ycomp(j, i);
219 if (-sin(ang) * 0.866 * tri_side +
xMin + i * x_cell_size +
222 bb_max.x = -sin(ang) * 0.866 * tri_side +
xMin +
223 i * x_cell_size +
xcomp(j, i);
225 if (cos(ang) * 0.866 * tri_side +
yMin + j * y_cell_size +
228 bb_max.y = cos(ang) * 0.866 * tri_side +
yMin +
229 j * y_cell_size +
ycomp(j, i);
241 const float ratio_xp =
243 const float ratio_xn =
245 const float ratio_yp =
247 const float ratio_yn =
249 const float norm_factor =
250 0.85 / max(max(ratio_xp, abs(ratio_xn)), max(ratio_yp, abs(ratio_yn)));
252 xcomp *= norm_factor;
253 ycomp *= norm_factor;
Scalar maxCoeff() const
Maximum value in the matrix/vector.
void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated) ...
void composePoint(double lx, double ly, double lz, double &gx, double &gy, double &gz, mrpt::math::CMatrixFixed< double, 3, 3 > *out_jacobian_df_dpoint=nullptr, mrpt::math::CMatrixFixed< double, 3, 6 > *out_jacobian_df_dpose=nullptr, mrpt::math::CMatrixFixed< 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...
GLAPI void GLAPIENTRY glEnable(GLenum cap)
GLAPI void GLAPIENTRY glPointSize(GLfloat size)
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
To be added to all CSerializable-classes implementation files.
mrpt::math::CMatrixF ycomp
Y component of the vector field.
mrpt::img::TColor m_point_color
#define GL_ONE_MINUS_SRC_ALPHA
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)
A renderizable object suitable for rendering with OpenGL's display lists.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
#define ASSERT_(f)
Defines an assertion mechanism.
#define GL_COLOR_BUFFER_BIT
This base provides a set of functions for maths stuff.
mrpt::math::CMatrixF xcomp
X component of the vector field.
void writeToStreamRender(mrpt::serialization::CArchive &out) const
GLAPI void GLAPIENTRY glBegin(GLenum mode)
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)...
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...
mrpt::img::TColor m_color
Color components in the range [0,255].
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
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.
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
bool m_antiAliasing
By default is true.
Virtual base class for "archives": classes abstracting I/O streams.
GLAPI void GLAPIENTRY glPushAttrib(GLbitfield mask)
matrix_size_t size() const
Get a 2-vector with [NROWS NCOLS] (as in MATLAB command size(x))
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)
Scalar minCoeff() const
Minimum value in the matrix/vector.
float m_pointSize
By default is 1.0.
void render_dl() const override
Render.
mrpt::img::TColor m_field_color
GLAPI void GLAPIENTRY glDisable(GLenum cap)
This template class provides the basic functionality for a general 2D any-size, resizable container o...
void readFromStreamRender(mrpt::serialization::CArchive &in)
float m_LineWidth
By default is 1.0.
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
#define MRPT_UNUSED_PARAM(a)
Determines whether this is an X86 or AMD64 platform.