29 CMeshFastPtr
CMeshFast::Create(
bool enableTransparency,
float xMin,
float xMax ,
float yMin,
float yMax )
31 return CMeshFastPtr(
new CMeshFast( enableTransparency, xMin ,xMax , yMin ,yMax ) );
36 const size_t cols = Z.getColCount();
37 const size_t rows = Z.getRowCount();
39 if ((m_colorFromZ)||(m_isImage))
43 ASSERT_((xMax>xMin)&&(yMax>yMin))
47 const float sCellX=(xMax-xMin)/(rows-1);
48 const float sCellY=(yMax-yMin)/(cols-1);
50 for (
size_t iX=0;iX<rows;iX++)
51 for (
size_t iY=0;iY<cols;iY++)
53 X(iX,iY) = xMin+iX*sCellX;
54 Y(iX,iY) = yMin+iY*sCellY;
58 pointsUpToDate =
true;
65 #if MRPT_HAS_OPENGL_GLUT 73 if ( m_color.A != 255 )
90 for (
unsigned int i=0; i<X.getRowCount(); i++)
91 for (
unsigned int j=0; j<X.getColCount(); j++)
93 if ( m_isImage && m_textureImage.isColor())
94 glColor4f(C_r(i,j), C_g(i,j), C_b(i,j), m_color.A/255.f);
97 glColor4f(C(i,j), C(i,j), C(i,j), m_color.A/255.f);
99 else if (m_colorFromZ)
107 glColor4f(m_color.R/255.f, m_color.G/255.f, m_color.B/255.f, m_color.A/255.f);
117 if ( m_color.A != 255 )
136 m_textureImage =
img;
139 Z.setSize(
img.getHeight(),
img.getWidth());
143 m_modified_Image =
true;
144 m_enableTransparency =
false;
145 m_colorFromZ =
false;
147 pointsUpToDate=
false;
162 ASSERT_((
img.getWidth() ==
static_cast<size_t>(in_Z.cols()))&&(
img.getHeight() ==
static_cast<size_t>(in_Z.rows())))
167 m_textureImage =
img;
170 m_modified_Image =
true;
171 m_enableTransparency =
false;
172 m_colorFromZ =
false;
174 pointsUpToDate =
false;
193 writeToStreamRender(out);
195 out << m_textureImage;
197 out << xMin << xMax << yMin << yMax;
199 out << m_enableTransparency;
203 out << m_pointSmooth;
217 readFromStreamRender(
in);
219 in >> m_textureImage;
228 in >> m_enableTransparency;
239 pointsUpToDate =
false;
252 if ((!m_modified_Z)&&(!m_modified_Image))
return;
258 const size_t cols = m_textureImage.getWidth();
259 const size_t rows = m_textureImage.getHeight();
261 if ((cols != Z.getColCount())||(rows != Z.getRowCount()))
263 printf(
"\nTexture Image and Z sizes have to be equal");
266 else if (m_textureImage.isColor())
268 C_r.setSize(rows, cols);
269 C_g.setSize(rows, cols);
270 C_b.setSize(rows, cols);
271 m_textureImage.getAsRGBMatrices(C_r, C_g, C_b);
275 C.setSize(rows, cols);
276 m_textureImage.getAsMatrix(C);
281 const size_t cols = Z.getColCount();
282 const size_t rows = Z.getRowCount();
284 C.setSize(rows,cols);
289 C.normalize(0.01f,0.99f);
293 m_modified_Image =
false;
294 m_modified_Z =
false;
295 pointsUpToDate =
false;
302 pointsUpToDate =
false;
315 bb_min.
z = Z.minCoeff();
319 bb_max.
z = Z.maxCoeff();
322 m_pose.composePoint(bb_min, bb_min);
323 m_pose.composePoint(bb_max, bb_max);
void updateColorsMatrix() const
Called internally to assure C is updated.
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const
Introduces a pure virtual method responsible for writing to a CStream.
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)
TColormap
Different colormaps for use in mrpt::utils::colormap()
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...
A class for storing images as grayscale or RGB bitmaps.
A planar (XY) grid where each cell has an associated height and, optionally, a texture map...
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.
void BASE_IMPEXP colormap(const TColormap &color_map, const float color_index, float &r, float &g, float &b)
Transform a float number in the range [0,1] into RGB components.
void assignImageAndZ(const mrpt::utils::CImage &img, const mrpt::math::CMatrixTemplateNumeric< float > &in_Z)
Assigns a texture image and Z simultaneously, and disable transparency.
IMPLEMENTS_SERIALIZABLE(CLogFileRecord_FullEval, CHolonomicLogFileRecord, mrpt::nav) IMPLEMENTS_SERIALIZABLE(CHolonomicFullEval
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...
GLAPI void GLAPIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor)
A renderizable object suitable for rendering with OpenGL's display lists.
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_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
void setZ(const mrpt::math::CMatrixTemplateNumeric< float > &in_Z)
This method sets the matrix of heights for each position (cell) in the mesh grid. ...
GLAPI void GLAPIENTRY glBegin(GLenum mode)
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
GLAPI void GLAPIENTRY glVertex3f(GLfloat x, GLfloat y, GLfloat z)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void assignImage(const mrpt::utils::CImage &img)
Assigns a texture image, and disable transparency.
void OPENGL_IMPEXP checkOpenGLError()
Checks glGetError and throws an exception if an error situation is found.
void updatePoints() const
The namespace for 3D scene representation and rendering.
GLAPI void GLAPIENTRY glEnd(void)
A matrix of dynamic size.
void render_dl() const MRPT_OVERRIDE
Render.
GLAPI void GLAPIENTRY glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
GLAPI void GLAPIENTRY glDisable(GLenum cap)