Main MRPT website > C++ reference for MRPT 1.5.9
CMesh.cpp
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 
10 #include "opengl-precomp.h" // Precompiled header
11 
12 #include <mrpt/poses/CPose3D.h>
13 #include <mrpt/opengl/CMesh.h>
15 #include <mrpt/utils/color_maps.h>
16 #include <mrpt/utils/CStream.h>
17 
18 #include "opengl_internals.h"
19 
20 using namespace mrpt;
21 using namespace mrpt::opengl;
22 using namespace mrpt::utils;
23 using namespace mrpt::poses;
24 using namespace mrpt::math;
25 using namespace std;
26 
28 
29 CMesh::CMesh(bool enableTransparency, float xMin, float xMax, float yMin, float yMax) :
30  m_textureImage(0, 0),
31  m_enableTransparency(enableTransparency),
32  m_colorFromZ(false),
33  m_isWireFrame(false),
34  m_isImage(false),
35  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),
36  m_colorMap(mrpt::utils::cmHOT),
37  m_modified_Z(true),
38  m_modified_Image(false),
39  xMin(xMin), xMax(xMax), yMin(yMin), yMax(yMax),
40  trianglesUpToDate(false)
41 {
42  m_color.A = 255;
43  m_color.R = 0;
44  m_color.G = 0;
45  m_color.B = 150;
46 }
47 
49 {
50 }
51 
52 
53 CMeshPtr CMesh::Create(bool enableTransparency, float xMin, float xMax , float yMin , float yMax )
54 {
55  return CMeshPtr( new CMesh( enableTransparency, xMin ,xMax , yMin ,yMax ) );
56 }
57 void CMesh::updateTriangles() const {
59 
60 // Remember:
61 //mutable std::vector<std::pair<CSetOfTriangles::TTriangle,TTriangleVertexIndices> > actualMesh; //!< List of triangles in the mesh
62 //mutable std::vector<std::pair<mrpt::math::TPoint3D,size_t> > vertex_normals; //!< The accumulated normals & counts for each vertex, so normals can be averaged.
63 
64  const size_t cols=Z.getColCount();
65  const size_t rows=Z.getRowCount();
66 
67  actualMesh.clear();
68  if (cols == 0 && rows == 0)
69  return; // empty mesh
70 
71  ASSERT_(cols>0 && rows>0)
72  ASSERT_(xMax>xMin&&yMax>yMin)
73 
74  // we have 1 more row & col of vertices than of triangles:
75  vertex_normals.assign((1+cols)*(1+rows), std::pair<TPoint3D,size_t>(TPoint3D(0,0,0),0) );
76 
77  float cR[3], cG[3], cB[3], cA[3];
78  cA[0] = cA[1] = cA[2] = m_color.A / 255.f;
79 
80  if ((m_colorFromZ) || (m_isImage)) {
81  updateColorsMatrix();
82  } else {
83  cR[0]=cR[1]=cR[2]=m_color.R/255.f;
84  cG[0]=cG[1]=cG[2]=m_color.G/255.f;
85  cB[0]=cB[1]=cB[2]=m_color.B/255.f;
86  }
87 
88 
89  bool useMask=false;
90  if (mask.getColCount()!=0&&mask.getRowCount()!=0) {
91  ASSERT_(mask.getColCount()==cols&&mask.getRowCount()==rows);
92  useMask=true;
93  }
94  const float sCellX=(xMax-xMin)/(rows-1);
95  const float sCellY=(yMax-yMin)/(cols-1);
96 
98  for (size_t iX=0;iX<rows-1;iX++) for (size_t iY=0;iY<cols-1;iY++) {
99  if (useMask&&(!mask(iX,iY)||!mask(iX+1,iY+1))) continue;
100  tri.x[0]=xMin+iX*sCellX;
101  tri.y[0]=yMin+iY*sCellY;
102  tri.z[0]=Z(iX,iY);
103  tri.x[2]=tri.x[0]+sCellX;
104  tri.y[2]=tri.y[0]+sCellY;
105  tri.z[2]=Z(iX+1,iY+1);
106 
107  // Vertex indices:
109  tvi.vind[0] = iX+rows*iY;
110  tvi.vind[2] = (iX+1)+rows*(iY+1);
111 
112  // Each quadrangle has up to 2 triangles:
113  // [0]
114  // |
115  // |
116  // [1]--[2]
117  // Order: 0,1,2
118  if (!useMask||mask(iX+1,iY))
119  {
120  tri.x[1]=tri.x[2];
121  tri.y[1]=tri.y[0];
122  tri.z[1]=Z(iX+1,iY);
123  for (int i=0;i<3;i++) tri.a[i] = cA[i]; // Assign alpha channel
124 
125  if (m_colorFromZ) {
126  colormap(m_colorMap,C(iX,iY),tri.r[0],tri.g[0],tri.b[0]);
127  colormap(m_colorMap,C(iX+1,iY),tri.r[1],tri.g[1],tri.b[1]);
128  colormap(m_colorMap,C(iX+1,iY+1),tri.r[2],tri.g[2],tri.b[2]);
129  }
130  else if (m_isImage) {
131  if (m_textureImage.isColor())
132  {
133  tri.r[0]=tri.r[1]=tri.r[2]=C_r(iX,iY);
134  tri.g[0]=tri.g[1]=tri.g[2]=C_g(iX,iY);
135  tri.b[0]=tri.b[1]=tri.b[2]=C_b(iX,iY);
136  }
137  else
138  {
139  tri.r[0]=tri.r[1]=tri.r[2]=C(iX,iY);
140  tri.g[0]=tri.g[1]=tri.g[2]=C(iX,iY);
141  tri.b[0]=tri.b[1]=tri.b[2]=C(iX,iY);
142  }
143  }
144  else {
145  tri.r[0]=tri.r[1]=tri.r[2]=m_color.R/255.f;
146  tri.g[0]=tri.g[1]=tri.g[2]=m_color.G/255.f;
147  tri.b[0]=tri.b[1]=tri.b[2]=m_color.B/255.f;
148  }
149 
150  // Compute normal of this triangle, and add it up to the 3 neighboring vertices:
151  // A = P1 - P0, B = P2 - P0
152  float ax=tri.x[1]-tri.x[0];
153  float bx=tri.x[2]-tri.x[0];
154  float ay=tri.y[1]-tri.y[0];
155  float by=tri.y[2]-tri.y[0];
156  float az=tri.z[1]-tri.z[0];
157  float bz=tri.z[2]-tri.z[0];
158  const TPoint3D this_normal(ay*bz-az*by,az*bx-ax*bz,ax*by-ay*bx);
159 
160  // Vertex indices:
161  tvi.vind[1] = iX+1+rows*iY;
162 
163  // Add triangle:
164  actualMesh.push_back( std::pair<CSetOfTriangles::TTriangle,TTriangleVertexIndices>(tri,tvi) );
165 
166  // For averaging normals:
167  for (int k=0;k<3;k++) {
168  vertex_normals[ tvi.vind[k] ].first += this_normal;
169  vertex_normals[ tvi.vind[k] ].second ++;
170  }
171  }
172  // 2:
173  // [0]--[1->2]
174  // \ |
175  // \|
176  // [2->1]
177  // Order: 0,2,1
178  if (!useMask||mask(iX,iY+1))
179  {
180  tri.x[1]=tri.x[2];
181  tri.y[1]=tri.y[2];
182  tri.z[1]=tri.z[2];
183 
184  tri.x[2]=tri.x[0];
185  //tri.y[2]=tri.y[1];
186  tri.z[2]=Z(iX,iY+1);
187  if (m_colorFromZ) {
188  colormap(m_colorMap,C(iX,iY),tri.r[0],tri.g[0],tri.b[0]);
189  colormap(m_colorMap,C(iX+1,iY+1),tri.r[1],tri.g[1],tri.b[1]);
190  colormap(m_colorMap,C(iX,iY+1),tri.r[2],tri.g[2],tri.b[2]);
191  }
192  else if (m_isImage) {
193  if (m_textureImage.isColor())
194  {
195  tri.r[0]=tri.r[1]=tri.r[2]=C_r(iX,iY);
196  tri.g[0]=tri.g[1]=tri.g[2]=C_g(iX,iY);
197  tri.b[0]=tri.b[1]=tri.b[2]=C_b(iX,iY);
198  }
199  else
200  {
201  tri.r[0]=tri.r[1]=tri.r[2]=C(iX,iY);
202  tri.g[0]=tri.g[1]=tri.g[2]=C(iX,iY);
203  tri.b[0]=tri.b[1]=tri.b[2]=C(iX,iY);
204  }
205  }
206  else {
207  tri.r[0]=tri.r[1]=tri.r[2]=m_color.R/255.f;
208  tri.g[0]=tri.g[1]=tri.g[2]=m_color.G/255.f;
209  tri.b[0]=tri.b[1]=tri.b[2]=m_color.B/255.f;
210  }
211 
212  // Compute normal of this triangle, and add it up to the 3 neighboring vertices:
213  // A = P1 - P0, B = P2 - P0
214  float ax=tri.x[1]-tri.x[0];
215  float bx=tri.x[2]-tri.x[0];
216  float ay=tri.y[1]-tri.y[0];
217  float by=tri.y[2]-tri.y[0];
218  float az=tri.z[1]-tri.z[0];
219  float bz=tri.z[2]-tri.z[0];
220  const TPoint3D this_normal(ay*bz-az*by,az*bx-ax*bz,ax*by-ay*bx);
221 
222  // Vertex indices:
223  tvi.vind[1] = tvi.vind[2];
224  tvi.vind[2] = iX+rows*(iY+1);
225 
226  // Add triangle:
227  actualMesh.push_back( std::pair<CSetOfTriangles::TTriangle,TTriangleVertexIndices>(tri,tvi) );
228 
229  // For averaging normals:
230  for (int k=0;k<3;k++) {
231  vertex_normals[ tvi.vind[k] ].first += this_normal;
232  vertex_normals[ tvi.vind[k] ].second ++;
233  }
234  }
235  }
236 
237  // Average normals:
238  for (size_t i=0;i<vertex_normals.size();i++)
239  {
240  const size_t N = vertex_normals[i].second;
241  if (N>0) vertex_normals[i].first *= 1.0/N;
242  }
243 
244  trianglesUpToDate=true;
245  polygonsUpToDate=false;
246 }
247 
248 /*---------------------------------------------------------------
249  render
250  ---------------------------------------------------------------*/
251 void CMesh::render_dl() const {
252 #if MRPT_HAS_OPENGL_GLUT
253  if (m_enableTransparency) {
257  } else {
260  }
261  glEnable(GL_NORMALIZE); // So the GPU normalizes the normals instead of doing it in the CPU
264  if (!trianglesUpToDate) updateTriangles();
265  if (!m_isWireFrame) glBegin(GL_TRIANGLES);
266  for (size_t i=0;i<actualMesh.size();i++) {
267  const CSetOfTriangles::TTriangle &t=actualMesh[i].first;
268  const TTriangleVertexIndices &tvi=actualMesh[i].second;
269 
270  if (m_isWireFrame) {
271  glDisable(GL_LIGHTING); // Disable lights when drawing lines
273  }
274  for (int i=0;i<3;i++) {
275  const mrpt::math::TPoint3D &n = vertex_normals[tvi.vind[i]].first;
276  glNormal3f(n.x,n.y,n.z);
277  glColor4f(t.r[i],t.g[i],t.b[i],t.a[i]);
278  glVertex3f(t.x[i],t.y[i],t.z[i]);
279  }
280  if (m_isWireFrame)
281  {
282  glEnd();
284  }
285  }
286  if (!m_isWireFrame) glEnd();
290 #endif
291 }
292 
293 /*---------------------------------------------------------------
294  assignImage
295  ---------------------------------------------------------------*/
297  const CImage& img )
298 {
299  MRPT_START
300 
301  // Make a copy:
302  m_textureImage = img;
303 
304  // Delete content in Z
305  Z.setSize( img.getHeight(), img.getWidth());
306  Z.assign(0);
307 
308 
309  m_modified_Image = true;
310  m_enableTransparency = false;
311  m_colorFromZ = false;
312  m_isImage = true;
313  trianglesUpToDate=false;
314 
315 
317 
318  MRPT_END
319 }
320 
321 /*---------------------------------------------------------------
322  assign Image and Z
323  ---------------------------------------------------------------*/
325 {
326  MRPT_START
327 
328  ASSERT_((img.getWidth() == static_cast<size_t>(in_Z.cols()))&&(img.getHeight() == static_cast<size_t>(in_Z.rows())))
329 
330  Z = in_Z;
331 
332  // Make a copy:
333  m_textureImage = img;
334 
335 
336  m_modified_Image = true;
337  m_enableTransparency = false;
338  m_colorFromZ = false;
339  m_isImage = true;
340  trianglesUpToDate = false;
341 
342 
344 
345  MRPT_END
346 }
347 
348 /*---------------------------------------------------------------
349  Implements the writing to a CStream capability of
350  CSerializable objects
351  ---------------------------------------------------------------*/
353 {
354 
355  if (version)
356  *version = 1;
357  else
358  {
359  writeToStreamRender(out);
360 
361  // Version 0:
362  out << m_textureImage;
363  out << xMin << xMax << yMin << yMax;
364  out << Z << U << V << mask; // We don't need to serialize C, it's computed
365  out << m_enableTransparency;
366  out << m_colorFromZ;
367  // new in v1
368  out << m_isWireFrame;
369  out << int16_t(m_colorMap);
370  }
371 }
372 
373 /*---------------------------------------------------------------
374  Implements the reading from a CStream capability of
375  CSerializable objects
376  ---------------------------------------------------------------*/
378 {
379  switch(version)
380  {
381  case 0:
382  case 1:
383  {
384  readFromStreamRender(in);
385 
386  in >> m_textureImage;
387 
388  in >> xMin;
389  in >> xMax;
390  in >> yMin;
391  in >> yMax;
392 
393  in >> Z >> U >> V >> mask;
394  in >> m_enableTransparency;
395  in >> m_colorFromZ;
396 
397  if (version>=1)
398  {
399  in >> m_isWireFrame;
400  int16_t i;
401  in >> i;
402  m_colorMap = TColormap(i);
403  }
404  else m_isWireFrame = false;
405 
406  m_modified_Z = true;
407  }
408  trianglesUpToDate=false;
409  break;
410  default:
412 
413  };
414  trianglesUpToDate=false;
416 }
417 
418 
420 {
421  if ((!m_modified_Z)&&(!m_modified_Image)) return;
422 
424 
425  if (m_isImage)
426  {
427  const size_t cols = m_textureImage.getWidth();
428  const size_t rows = m_textureImage.getHeight();
429 
430  if ((cols != Z.getColCount())||(rows != Z.getRowCount()))
431  printf("\nTexture Image and Z sizes have to be equal");
432 
433  else if (m_textureImage.isColor())
434  {
435  C_r.setSize(rows, cols);
436  C_g.setSize(rows, cols);
437  C_b.setSize(rows, cols);
438  m_textureImage.getAsRGBMatrices(C_r, C_g, C_b);
439  }
440  else
441  {
442  C.setSize(rows, cols);
443  m_textureImage.getAsMatrix(C);
444  }
445  }
446  else
447  {
448  const size_t cols = Z.getColCount();
449  const size_t rows = Z.getRowCount();
450  C.setSize(rows,cols);
451 
452  //Color is proportional to height:
453  C = Z;
454 
455  //If mask is empty -> Normalize the whole mesh
456  if (mask.empty())
457  C.normalize(0.01f,0.99f);
458 
459  //Else -> Normalize color ignoring masked-out cells:
460  else
461  {
462  float val_max = -std::numeric_limits<float>::max(), val_min = std::numeric_limits<float>::max();
463  bool any_valid =false;
464 
465  for (size_t c=0;c<cols;c++)
466  for (size_t r=0;r<rows;r++)
467  {
468  if (!mask(r,c)) continue;
469  any_valid = true;
470  const float val = C(r,c);
471  mrpt::utils::keep_max(val_max,val);
472  mrpt::utils::keep_min(val_min,val);
473  }
474 
475  if (any_valid)
476  {
477  float minMaxDelta = val_max - val_min;
478  if (minMaxDelta==0) minMaxDelta = 1;
479  const float minMaxDelta_ = 1.0f/minMaxDelta;
480  C.array() = (C.array()-val_min)*minMaxDelta_;
481  }
482  }
483  }
484 
485  m_modified_Image = false;
486  m_modified_Z = false;
487  trianglesUpToDate=false;
488 }
489 
491 {
492  Z=in_Z;
493  m_modified_Z = true;
494  trianglesUpToDate=false;
495 
496  //Delete previously loaded images
497  m_isImage = false;
498 
500 }
501 
503 {
504  mask = in_mask;
505  trianglesUpToDate=false;
507 }
508 
510 {
511  U=in_U;
512  V=in_V;
514 }
515 
516 bool CMesh::traceRay(const mrpt::poses::CPose3D &o,double &dist) const {
517  if (!trianglesUpToDate||!polygonsUpToDate) updatePolygons();
518  return mrpt::math::traceRay(tmpPolys,o-this->m_pose,dist);
519 }
520 
521 static math::TPolygon3D tmpPoly(3);
522 mrpt::math::TPolygonWithPlane createPolygonFromTriangle(const std::pair<CSetOfTriangles::TTriangle,CMesh::TTriangleVertexIndices> &p) {
523  const CSetOfTriangles::TTriangle &t = p.first;
524  for (size_t i=0;i<3;i++) {
525  tmpPoly[i].x=t.x[i];
526  tmpPoly[i].y=t.y[i];
527  tmpPoly[i].z=t.z[i];
528  }
530 }
531 
532 void CMesh::updatePolygons() const {
533  if (!trianglesUpToDate) updateTriangles();
534  size_t N=actualMesh.size();
535  tmpPolys.resize(N);
536  transform(actualMesh.begin(),actualMesh.end(),tmpPolys.begin(),createPolygonFromTriangle);
537  polygonsUpToDate=true;
539 }
540 
541 
543 {
544  bb_min.x = xMin;
545  bb_min.y = yMin;
546  bb_min.z = Z.minCoeff();
547 
548  bb_max.x = xMax;
549  bb_max.y = yMax;
550  bb_max.z = Z.maxCoeff();
551 
552  // Convert to coordinates of my parent:
553  m_pose.composePoint(bb_min, bb_min);
554  m_pose.composePoint(bb_max, bb_max);
555 }
GLenum GLint GLuint mask
Definition: glext.h:3888
virtual ~CMesh()
Private, virtual destructor: only can be deleted from smart pointers.
Definition: CMesh.cpp:48
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
Definition: zip.h:16
GLdouble GLdouble t
Definition: glext.h:3610
GLbyte GLbyte bz
Definition: glext.h:5451
GLAPI void GLAPIENTRY glEnable(GLenum cap)
TColormap
Different colormaps for use in mrpt::utils::colormap()
Definition: color_maps.h:30
A class for storing images as grayscale or RGB bitmaps.
Definition: CImage.h:101
[New in MRPT 1.5.0]
Definition: color_maps.h:34
bool BASE_IMPEXP traceRay(const std::vector< TPolygonWithPlane > &vec, const mrpt::poses::CPose3D &pose, double &dist)
Fast ray tracing method using polygons&#39; properties.
Definition: geometry.cpp:1989
void setZ(const mrpt::math::CMatrixTemplateNumeric< float > &in_Z)
This method sets the matrix of heights for each position (cell) in the mesh grid. ...
Definition: CMesh.cpp:490
GLAPI void GLAPIENTRY glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
GLenum GLsizei n
Definition: glext.h:4618
Slightly heavyweight type to speed-up calculations with polygons in 3D.
Definition: geometry.h:33
#define GL_TRIANGLES
Definition: glew.h:272
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...
Definition: CMesh.cpp:377
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated) ...
STL namespace.
#define GL_NORMALIZE
Definition: glew.h:412
#define GL_ONE_MINUS_SRC_ALPHA
Definition: glew.h:283
double z
X,Y,Z coordinates.
#define GL_COLOR_MATERIAL
Definition: glew.h:388
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.
Definition: color_maps.cpp:101
#define GL_DEPTH_TEST
Definition: glew.h:397
#define GL_SMOOTH
Definition: glew.h:631
IMPLEMENTS_SERIALIZABLE(CLogFileRecord_FullEval, CHolonomicLogFileRecord, mrpt::nav) IMPLEMENTS_SERIALIZABLE(CHolonomicFullEval
GLAPI void GLAPIENTRY glShadeModel(GLenum mode)
#define GL_LIGHTING
Definition: glew.h:381
void keep_min(T &var, const K test_val)
If the second argument is below the first one, set the first argument to this lower value...
GLAPI void GLAPIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor)
A renderizable object suitable for rendering with OpenGL&#39;s display lists.
void assignImage(const mrpt::utils::CImage &img)
Assigns a texture image, and disable transparency.
Definition: CMesh.cpp:296
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const
Introduces a pure virtual method responsible for writing to a CStream.
Definition: CMesh.cpp:352
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:38
This base provides a set of functions for maths stuff.
Definition: CArrayNumeric.h:19
__int16 int16_t
Definition: rptypes.h:45
#define MRPT_END
const GLubyte * c
Definition: glext.h:5590
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
GLint GLvoid * img
Definition: glext.h:3645
int val
Definition: mrpt_jpeglib.h:953
bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const MRPT_OVERRIDE
Trace ray.
Definition: CMesh.cpp:516
void assignImageAndZ(const mrpt::utils::CImage &img, const mrpt::math::CMatrixTemplateNumeric< float > &in_Z)
Assigns a texture image and Z simultaneously, and disable transparency.
Definition: CMesh.cpp:324
int version
Definition: mrpt_jpeglib.h:898
GLAPI void GLAPIENTRY glBegin(GLenum mode)
void updatePolygons() const
Definition: CMesh.cpp:532
#define GL_BLEND
Definition: glew.h:428
#define GL_LINE_LOOP
Definition: glew.h:270
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
Definition: CPoint.h:17
GLAPI void GLAPIENTRY glVertex3f(GLfloat x, GLfloat y, GLfloat z)
#define MRPT_START
#define GL_SRC_ALPHA
Definition: glew.h:282
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
GLdouble GLdouble GLdouble r
Definition: glext.h:3618
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:72
GLuint in
Definition: glext.h:6301
The namespace for 3D scene representation and rendering.
void updateColorsMatrix() const
Called internally to assure C is updated.
Definition: CMesh.cpp:419
#define ASSERT_(f)
GLAPI void GLAPIENTRY glEnd(void)
GLbyte by
Definition: glext.h:5451
mrpt::math::TPolygonWithPlane createPolygonFromTriangle(const std::pair< CSetOfTriangles::TTriangle, CMesh::TTriangleVertexIndices > &p)
Definition: CMesh.cpp:522
void setUV(const mrpt::math::CMatrixTemplateNumeric< float > &in_U, const mrpt::math::CMatrixTemplateNumeric< float > &in_V)
Sets the (u,v) texture coordinates (in range [0,1]) for each cell.
Definition: CMesh.cpp:509
static CMeshPtr Create()
GLAPI void GLAPIENTRY glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
A planar (XY) grid where each cell has an associated height and, optionally, a texture map...
Definition: CMesh.h:40
void setMask(const mrpt::math::CMatrixTemplateNumeric< float > &in_mask)
This method sets the boolean mask of valid heights for each position (cell) in the mesh grid...
Definition: CMesh.cpp:502
Lightweight 3D point.
GLuint GLenum GLenum transform
Definition: glext.h:6092
GLAPI void GLAPIENTRY glDisable(GLenum cap)
GLfloat GLfloat p
Definition: glext.h:5587
static math::TPolygon3D tmpPoly(3)
void keep_max(T &var, const K test_val)
If the second argument is above the first one, set the first argument to this higher value...
void updateTriangles() const
Called internally to assure the triangle list is updated.
Definition: CMesh.cpp:57
3D polygon, inheriting from std::vector<TPoint3D>
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...
Definition: CMesh.cpp:542
void render_dl() const MRPT_OVERRIDE
Render.
Definition: CMesh.cpp:251



Page generated by Doxygen 1.8.14 for MRPT 1.5.9 Git: 690a4699f Wed Apr 15 19:29:53 2020 +0200 at miƩ abr 15 19:30:12 CEST 2020