Go to the documentation of this file.
10 #ifndef opengl_CMesh_H
11 #define opengl_CMesh_H
66 void updateColorsMatrix()
const;
67 void updateTriangles()
const;
68 void updatePolygons()
const;
71 mutable std::vector<std::pair<CSetOfTriangles::TTriangle,TTriangleVertexIndices> >
actualMesh;
75 mutable std::vector<mrpt::math::TPolygonWithPlane>
tmpPolys;
80 xMin=xmin; xMax = xmax;
81 yMin=ymin; yMax = ymax;
85 void getGridLimits(
float &xmin,
float &xmax,
float &ymin,
float &ymax)
const
96 m_colorMap = colorMap;
160 static CMeshPtr Create(
bool enableTransparency,
float xMin = 0.0f,
float xMax = 0.0f,
float yMin = 0.0f,
float yMax = 0.0f );
171 void assignImage(const
mrpt::utils::CImage& img );
175 void assignImageAndZ( const
mrpt::utils::CImage& img, const
mrpt::math::CMatrixTemplateNumeric<
float> &in_Z);
179 inline
void adjustGridToImageAR() {
181 const float ycenter = 0.5*(yMin+yMax);
182 const float xwidth = xMax - xMin;
183 const float newratio = float(m_textureImage.
getWidth())/
float(m_textureImage.
getHeight());
184 yMax = ycenter + 0.5*newratio*xwidth;
185 yMin = ycenter - 0.5*newratio*xwidth;
196 CMesh(
bool enableTransparency =
false,
float xMin = 0.0f,
float xMax = 0.0f,
float yMin = 0.0f,
float yMax = 0.0f ) :
198 m_enableTransparency(enableTransparency),
200 m_isWireFrame(false),
202 Z(0,0), mask(0,0), U(0,0), V(0,0), C(0,0), C_r(0,0), C_g(0,0), C_b(0,0),
205 m_modified_Image(false),
206 xMin(xMin), xMax(xMax), yMin(yMin), yMax(yMax),
207 trianglesUpToDate(false)
std::vector< std::pair< mrpt::math::TPoint3D, size_t > > vertex_normals
The accumulated normals & counts for each vertex, so normals can be averaged.
TColormap
Different colormaps.
void setYBounds(const float &min, const float &max)
void enableWireFrame(bool v)
bool m_modified_Z
Whether C is not up-to-date wrt to Z.
mrpt::utils::CImage m_textureImage
math::CMatrix C_g
Green Component of the Color [0,1] for each cell, updated by updateColorsMatrix.
void enableTransparency(bool v)
A renderizable object suitable for rendering with OpenGL's display lists.
math::CMatrix V
Texture coordinates.
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void getGridLimits(float &xmin, float &xmax, float &ymin, float &ymax) const
A class for storing images as grayscale or RGB bitmaps.
virtual ~CMesh()
Private, virtual destructor: only can be deleted from smart pointers.
A planar (XY) grid where each cell has an associated height and, optionally, a texture map.
bool m_modified_Image
Whether C is not up-to-date wrt to the texture image.
bool trianglesUpToDate
Whether the actual mesh needs to be recalculated.
void getZ(mrpt::math::CMatrixFloat &out) const
Returns a reference to the internal Z matrix, allowing changing it efficiently.
A matrix of dynamic size.
bool m_enableTransparency
This class is a "CSerializable" wrapper for "CMatrixFloat".
size_t getWidth() const MRPT_OVERRIDE
Returns the width of the image in pixels.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
math::CMatrix Z
Z(x,y): Z-coordinate of the point (x,y)
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
math::CMatrix C_b
Blue Component of the Color [0,1] for each cell, updated by updateColorsMatrix.
void setXBounds(const float &min, const float &max)
size_t getHeight() const MRPT_OVERRIDE
Returns the height of the image in pixels.
void setXMin(const float &nxm)
void enableColorFromZ(bool v, mrpt::utils::TColormap colorMap=mrpt::utils::cmJET)
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
mrpt::utils::TColormap m_colorMap
Used when m_colorFromZ is true.
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
void getYBounds(float &min, float &max) const
math::CMatrix C_r
Red Component of the Color [0,1] for each cell, updated by updateColorsMatrix.
void getMask(mrpt::math::CMatrixFloat &out) const
Returns a reference to the internal mask matrix, allowing changing it efficiently.
void setGridLimits(float xmin, float xmax, float ymin, float ymax)
void setYMax(const float &nym)
void getXBounds(float &min, float &max) const
std::vector< std::pair< CSetOfTriangles::TTriangle, TTriangleVertexIndices > > actualMesh
List of triangles in the mesh.
bool BASE_IMPEXP traceRay(const vector< TPolygonWithPlane > &vec, const mrpt::poses::CPose3D &pose, double &dist)
Fast ray tracing method using polygons' properties.
std::vector< mrpt::math::TPolygonWithPlane > tmpPolys
void setYMin(const float &nym)
math::CMatrix C
Grayscale Color [0,1] for each cell, updated by updateColorsMatrix.
CMesh(bool enableTransparency=false, float xMin=0.0f, float xMax=0.0f, float yMin=0.0f, float yMax=0.0f)
Constructor.
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
void setXMax(const float &nxm)
Page generated by Doxygen 1.8.16 for MRPT 1.4.0 SVN: at Mon Oct 14 23:08:25 UTC 2019 | | |