Main MRPT website > C++ reference for MRPT 1.9.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 
30  bool enableTransparency, float xMin, float xMax, float yMin, float yMax)
31  : m_textureImage(0, 0),
32  m_enableTransparency(enableTransparency),
33  m_colorFromZ(false),
34  m_isWireFrame(false),
35  m_isImage(false),
36  Z(0, 0),
37  mask(0, 0),
38  U(0, 0),
39  V(0, 0),
40  C(0, 0),
41  C_r(0, 0),
42  C_g(0, 0),
43  C_b(0, 0),
44  m_colorMap(mrpt::utils::cmHOT),
45  m_modified_Z(true),
46  m_modified_Image(false),
47  xMin(xMin),
48  xMax(xMax),
49  yMin(yMin),
50  yMax(yMax),
51  trianglesUpToDate(false)
52 {
53  m_color.A = 255;
54  m_color.R = 0;
55  m_color.G = 0;
56  m_color.B = 150;
57 }
58 
61 {
63 
64  // Remember:
65  /** List of triangles in the mesh */
66  // mutable
67  // std::vector<std::pair<CSetOfTriangles::TTriangle,TTriangleVertexIndices>
68  // > actualMesh;
69  /** The accumulated normals & counts for each vertex, so normals can be
70  * averaged. */
71  // mutable std::vector<std::pair<mrpt::math::TPoint3D,size_t> >
72  // vertex_normals;
73 
74  const size_t cols = Z.getColCount();
75  const size_t rows = Z.getRowCount();
76 
77  actualMesh.clear();
78  if (cols == 0 && rows == 0) return; // empty mesh
79 
80  ASSERT_(cols > 0 && rows > 0)
81  ASSERT_(xMax > xMin && yMax > yMin)
82 
83  // we have 1 more row & col of vertices than of triangles:
84  vertex_normals.assign(
85  (1 + cols) * (1 + rows),
86  std::pair<TPoint3D, size_t>(TPoint3D(0, 0, 0), 0));
87 
88  float cR[3], cG[3], cB[3], cA[3];
89  cA[0] = cA[1] = cA[2] = m_color.A / 255.f;
90 
91  if ((m_colorFromZ) || (m_isImage))
92  {
93  updateColorsMatrix();
94  }
95  else
96  {
97  cR[0] = cR[1] = cR[2] = m_color.R / 255.f;
98  cG[0] = cG[1] = cG[2] = m_color.G / 255.f;
99  cB[0] = cB[1] = cB[2] = m_color.B / 255.f;
100  }
101 
102  bool useMask = false;
103  if (mask.getColCount() != 0 && mask.getRowCount() != 0)
104  {
105  ASSERT_(mask.getColCount() == cols && mask.getRowCount() == rows);
106  useMask = true;
107  }
108  const float sCellX = (xMax - xMin) / (rows - 1);
109  const float sCellY = (yMax - yMin) / (cols - 1);
110 
112  for (size_t iX = 0; iX < rows - 1; iX++)
113  for (size_t iY = 0; iY < cols - 1; iY++)
114  {
115  if (useMask && (!mask(iX, iY) || !mask(iX + 1, iY + 1))) continue;
116  tri.x[0] = xMin + iX * sCellX;
117  tri.y[0] = yMin + iY * sCellY;
118  tri.z[0] = Z(iX, iY);
119  tri.x[2] = tri.x[0] + sCellX;
120  tri.y[2] = tri.y[0] + sCellY;
121  tri.z[2] = Z(iX + 1, iY + 1);
122 
123  // Vertex indices:
125  tvi.vind[0] = iX + rows * iY;
126  tvi.vind[2] = (iX + 1) + rows * (iY + 1);
127 
128  // Each quadrangle has up to 2 triangles:
129  // [0]
130  // |
131  // |
132  // [1]--[2]
133  // Order: 0,1,2
134  if (!useMask || mask(iX + 1, iY))
135  {
136  tri.x[1] = tri.x[2];
137  tri.y[1] = tri.y[0];
138  tri.z[1] = Z(iX + 1, iY);
139  for (int i = 0; i < 3; i++)
140  tri.a[i] = cA[i]; // Assign alpha channel
141 
142  if (m_colorFromZ)
143  {
144  colormap(
145  m_colorMap, C(iX, iY), tri.r[0], tri.g[0], tri.b[0]);
146  colormap(
147  m_colorMap, C(iX + 1, iY), tri.r[1], tri.g[1],
148  tri.b[1]);
149  colormap(
150  m_colorMap, C(iX + 1, iY + 1), tri.r[2], tri.g[2],
151  tri.b[2]);
152  }
153  else if (m_isImage)
154  {
155  if (m_textureImage.isColor())
156  {
157  tri.r[0] = tri.r[1] = tri.r[2] = C_r(iX, iY);
158  tri.g[0] = tri.g[1] = tri.g[2] = C_g(iX, iY);
159  tri.b[0] = tri.b[1] = tri.b[2] = C_b(iX, iY);
160  }
161  else
162  {
163  tri.r[0] = tri.r[1] = tri.r[2] = C(iX, iY);
164  tri.g[0] = tri.g[1] = tri.g[2] = C(iX, iY);
165  tri.b[0] = tri.b[1] = tri.b[2] = C(iX, iY);
166  }
167  }
168  else
169  {
170  tri.r[0] = tri.r[1] = tri.r[2] = m_color.R / 255.f;
171  tri.g[0] = tri.g[1] = tri.g[2] = m_color.G / 255.f;
172  tri.b[0] = tri.b[1] = tri.b[2] = m_color.B / 255.f;
173  }
174 
175  // Compute normal of this triangle, and add it up to the 3
176  // neighboring vertices:
177  // A = P1 - P0, B = P2 - P0
178  float ax = tri.x[1] - tri.x[0];
179  float bx = tri.x[2] - tri.x[0];
180  float ay = tri.y[1] - tri.y[0];
181  float by = tri.y[2] - tri.y[0];
182  float az = tri.z[1] - tri.z[0];
183  float bz = tri.z[2] - tri.z[0];
184  const TPoint3D this_normal(
185  ay * bz - az * by, az * bx - ax * bz, ax * by - ay * bx);
186 
187  // Vertex indices:
188  tvi.vind[1] = iX + 1 + rows * iY;
189 
190  // Add triangle:
191  actualMesh.push_back(
192  std::pair<CSetOfTriangles::TTriangle,
193  TTriangleVertexIndices>(tri, tvi));
194 
195  // For averaging normals:
196  for (int k = 0; k < 3; k++)
197  {
198  vertex_normals[tvi.vind[k]].first += this_normal;
199  vertex_normals[tvi.vind[k]].second++;
200  }
201  }
202  // 2:
203  // [0]--[1->2]
204  // \ |
205  // \|
206  // [2->1]
207  // Order: 0,2,1
208  if (!useMask || mask(iX, iY + 1))
209  {
210  tri.x[1] = tri.x[2];
211  tri.y[1] = tri.y[2];
212  tri.z[1] = tri.z[2];
213 
214  tri.x[2] = tri.x[0];
215  // tri.y[2]=tri.y[1];
216  tri.z[2] = Z(iX, iY + 1);
217  if (m_colorFromZ)
218  {
219  colormap(
220  m_colorMap, C(iX, iY), tri.r[0], tri.g[0], tri.b[0]);
221  colormap(
222  m_colorMap, C(iX + 1, iY + 1), tri.r[1], tri.g[1],
223  tri.b[1]);
224  colormap(
225  m_colorMap, C(iX, iY + 1), tri.r[2], tri.g[2],
226  tri.b[2]);
227  }
228  else if (m_isImage)
229  {
230  if (m_textureImage.isColor())
231  {
232  tri.r[0] = tri.r[1] = tri.r[2] = C_r(iX, iY);
233  tri.g[0] = tri.g[1] = tri.g[2] = C_g(iX, iY);
234  tri.b[0] = tri.b[1] = tri.b[2] = C_b(iX, iY);
235  }
236  else
237  {
238  tri.r[0] = tri.r[1] = tri.r[2] = C(iX, iY);
239  tri.g[0] = tri.g[1] = tri.g[2] = C(iX, iY);
240  tri.b[0] = tri.b[1] = tri.b[2] = C(iX, iY);
241  }
242  }
243  else
244  {
245  tri.r[0] = tri.r[1] = tri.r[2] = m_color.R / 255.f;
246  tri.g[0] = tri.g[1] = tri.g[2] = m_color.G / 255.f;
247  tri.b[0] = tri.b[1] = tri.b[2] = m_color.B / 255.f;
248  }
249 
250  // Compute normal of this triangle, and add it up to the 3
251  // neighboring vertices:
252  // A = P1 - P0, B = P2 - P0
253  float ax = tri.x[1] - tri.x[0];
254  float bx = tri.x[2] - tri.x[0];
255  float ay = tri.y[1] - tri.y[0];
256  float by = tri.y[2] - tri.y[0];
257  float az = tri.z[1] - tri.z[0];
258  float bz = tri.z[2] - tri.z[0];
259  const TPoint3D this_normal(
260  ay * bz - az * by, az * bx - ax * bz, ax * by - ay * bx);
261 
262  // Vertex indices:
263  tvi.vind[1] = tvi.vind[2];
264  tvi.vind[2] = iX + rows * (iY + 1);
265 
266  // Add triangle:
267  actualMesh.push_back(
268  std::pair<CSetOfTriangles::TTriangle,
269  TTriangleVertexIndices>(tri, tvi));
270 
271  // For averaging normals:
272  for (int k = 0; k < 3; k++)
273  {
274  vertex_normals[tvi.vind[k]].first += this_normal;
275  vertex_normals[tvi.vind[k]].second++;
276  }
277  }
278  }
279 
280  // Average normals:
281  for (size_t i = 0; i < vertex_normals.size(); i++)
282  {
283  const size_t N = vertex_normals[i].second;
284  if (N > 0) vertex_normals[i].first *= 1.0 / N;
285  }
286 
287  trianglesUpToDate = true;
288  polygonsUpToDate = false;
289 }
290 
291 /*---------------------------------------------------------------
292  render
293  ---------------------------------------------------------------*/
294 void CMesh::render_dl() const
295 {
296 #if MRPT_HAS_OPENGL_GLUT
297  if (m_enableTransparency)
298  {
302  }
303  else
304  {
307  }
308  glEnable(GL_NORMALIZE); // So the GPU normalizes the normals instead of
309  // doing it in the CPU
312  if (!trianglesUpToDate) updateTriangles();
313  if (!m_isWireFrame) glBegin(GL_TRIANGLES);
314  for (size_t i = 0; i < actualMesh.size(); i++)
315  {
316  const CSetOfTriangles::TTriangle& t = actualMesh[i].first;
317  const TTriangleVertexIndices& tvi = actualMesh[i].second;
318 
319  if (m_isWireFrame)
320  {
321  glDisable(GL_LIGHTING); // Disable lights when drawing lines
323  }
324  for (int i = 0; i < 3; i++)
325  {
326  const mrpt::math::TPoint3D& n = vertex_normals[tvi.vind[i]].first;
327  glNormal3f(n.x, n.y, n.z);
328  glColor4f(t.r[i], t.g[i], t.b[i], t.a[i]);
329  glVertex3f(t.x[i], t.y[i], t.z[i]);
330  }
331  if (m_isWireFrame)
332  {
333  glEnd();
335  }
336  }
337  if (!m_isWireFrame) glEnd();
341 #endif
342 }
343 
344 /*---------------------------------------------------------------
345  assignImage
346  ---------------------------------------------------------------*/
348 {
349  MRPT_START
350 
351  // Make a copy:
352  m_textureImage = img;
353 
354  // Delete content in Z
355  Z.setSize(img.getHeight(), img.getWidth());
356  Z.assign(0);
357 
358  m_modified_Image = true;
359  m_enableTransparency = false;
360  m_colorFromZ = false;
361  m_isImage = true;
362  trianglesUpToDate = false;
363 
365 
366  MRPT_END
367 }
368 
369 /*---------------------------------------------------------------
370  assign Image and Z
371  ---------------------------------------------------------------*/
374 {
375  MRPT_START
376 
377  ASSERT_(
378  (img.getWidth() == static_cast<size_t>(in_Z.cols())) &&
379  (img.getHeight() == static_cast<size_t>(in_Z.rows())))
380 
381  Z = in_Z;
382 
383  // Make a copy:
384  m_textureImage = img;
385 
386  m_modified_Image = true;
387  m_enableTransparency = false;
388  m_colorFromZ = false;
389  m_isImage = true;
390  trianglesUpToDate = false;
391 
393 
394  MRPT_END
395 }
396 
397 /*---------------------------------------------------------------
398  Implements the writing to a CStream capability of
399  CSerializable objects
400  ---------------------------------------------------------------*/
401 void CMesh::writeToStream(mrpt::utils::CStream& out, int* version) const
402 {
403  if (version)
404  *version = 1;
405  else
406  {
407  writeToStreamRender(out);
408 
409  // Version 0:
410  out << m_textureImage;
411  out << xMin << xMax << yMin << yMax;
412  out << Z << U << V
413  << mask; // We don't need to serialize C, it's computed
414  out << m_enableTransparency;
415  out << m_colorFromZ;
416  // new in v1
417  out << m_isWireFrame;
418  out << int16_t(m_colorMap);
419  }
420 }
421 
422 /*---------------------------------------------------------------
423  Implements the reading from a CStream capability of
424  CSerializable objects
425  ---------------------------------------------------------------*/
427 {
428  switch (version)
429  {
430  case 0:
431  case 1:
432  {
433  readFromStreamRender(in);
434 
435  in >> m_textureImage;
436 
437  in >> xMin;
438  in >> xMax;
439  in >> yMin;
440  in >> yMax;
441 
442  in >> Z >> U >> V >> mask;
443  in >> m_enableTransparency;
444  in >> m_colorFromZ;
445 
446  if (version >= 1)
447  {
448  in >> m_isWireFrame;
449  int16_t i;
450  in >> i;
451  m_colorMap = TColormap(i);
452  }
453  else
454  m_isWireFrame = false;
455 
456  m_modified_Z = true;
457  }
458  trianglesUpToDate = false;
459  break;
460  default:
462  };
463  trianglesUpToDate = false;
465 }
466 
468 {
469  if ((!m_modified_Z) && (!m_modified_Image)) return;
470 
472 
473  if (m_isImage)
474  {
475  const size_t cols = m_textureImage.getWidth();
476  const size_t rows = m_textureImage.getHeight();
477 
478  if ((cols != Z.getColCount()) || (rows != Z.getRowCount()))
479  printf("\nTexture Image and Z sizes have to be equal");
480 
481  else if (m_textureImage.isColor())
482  {
483  C_r.setSize(rows, cols);
484  C_g.setSize(rows, cols);
485  C_b.setSize(rows, cols);
486  m_textureImage.getAsRGBMatrices(C_r, C_g, C_b);
487  }
488  else
489  {
490  C.setSize(rows, cols);
491  m_textureImage.getAsMatrix(C);
492  }
493  }
494  else
495  {
496  const size_t cols = Z.getColCount();
497  const size_t rows = Z.getRowCount();
498  C.setSize(rows, cols);
499 
500  // Color is proportional to height:
501  C = Z;
502 
503  // If mask is empty -> Normalize the whole mesh
504  if (mask.empty()) C.normalize(0.01f, 0.99f);
505 
506  // Else -> Normalize color ignoring masked-out cells:
507  else
508  {
509  float val_max = -std::numeric_limits<float>::max(),
510  val_min = std::numeric_limits<float>::max();
511  bool any_valid = false;
512 
513  for (size_t c = 0; c < cols; c++)
514  for (size_t r = 0; r < rows; r++)
515  {
516  if (!mask(r, c)) continue;
517  any_valid = true;
518  const float val = C(r, c);
519  mrpt::utils::keep_max(val_max, val);
520  mrpt::utils::keep_min(val_min, val);
521  }
522 
523  if (any_valid)
524  {
525  float minMaxDelta = val_max - val_min;
526  if (minMaxDelta == 0) minMaxDelta = 1;
527  const float minMaxDelta_ = 1.0f / minMaxDelta;
528  C.array() = (C.array() - val_min) * minMaxDelta_;
529  }
530  }
531  }
532 
533  m_modified_Image = false;
534  m_modified_Z = false;
535  trianglesUpToDate = false;
536 }
537 
539 {
540  Z = in_Z;
541  m_modified_Z = true;
542  trianglesUpToDate = false;
543 
544  // Delete previously loaded images
545  m_isImage = false;
546 
548 }
549 
551 {
552  mask = in_mask;
553  trianglesUpToDate = false;
555 }
556 
560 {
561  U = in_U;
562  V = in_V;
564 }
565 
566 bool CMesh::traceRay(const mrpt::poses::CPose3D& o, double& dist) const
567 {
568  if (!trianglesUpToDate || !polygonsUpToDate) updatePolygons();
569  return mrpt::math::traceRay(tmpPolys, o - this->m_pose, dist);
570 }
571 
572 static math::TPolygon3D tmpPoly(3);
574  const std::pair<CSetOfTriangles::TTriangle, CMesh::TTriangleVertexIndices>&
575  p)
576 {
577  const CSetOfTriangles::TTriangle& t = p.first;
578  for (size_t i = 0; i < 3; i++)
579  {
580  tmpPoly[i].x = t.x[i];
581  tmpPoly[i].y = t.y[i];
582  tmpPoly[i].z = t.z[i];
583  }
585 }
586 
588 {
589  if (!trianglesUpToDate) updateTriangles();
590  size_t N = actualMesh.size();
591  tmpPolys.resize(N);
592  transform(
593  actualMesh.begin(), actualMesh.end(), tmpPolys.begin(),
595  polygonsUpToDate = true;
597 }
598 
600  mrpt::math::TPoint3D& bb_min, mrpt::math::TPoint3D& bb_max) const
601 {
602  bb_min.x = xMin;
603  bb_min.y = yMin;
604  bb_min.z = Z.minCoeff();
605 
606  bb_max.x = xMax;
607  bb_max.y = yMax;
608  bb_max.z = Z.maxCoeff();
609 
610  // Convert to coordinates of my parent:
611  m_pose.composePoint(bb_min, bb_min);
612  m_pose.composePoint(bb_max, bb_max);
613 }
GLenum GLint GLuint mask
Definition: glext.h:4050
virtual ~CMesh()
Private, virtual destructor: only can be deleted from smart pointers.
Definition: CMesh.cpp:59
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
GLdouble GLdouble t
Definition: glext.h:3689
GLbyte GLbyte bz
Definition: glext.h:6105
GLAPI void GLAPIENTRY glEnable(GLenum cap)
TColormap
Different colormaps for use in mrpt::utils::colormap()
Definition: color_maps.h:31
A class for storing images as grayscale or RGB bitmaps.
Definition: CImage.h:118
[New in MRPT 1.5.0]
Definition: color_maps.h:36
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
bool traceRay(const std::vector< TPolygonWithPlane > &vec, const mrpt::poses::CPose3D &pose, double &dist)
Fast ray tracing method using polygons&#39; properties.
Definition: geometry.cpp:2582
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const override
Introduces a pure virtual method responsible for writing to a CStream.
Definition: CMesh.cpp:401
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:538
GLAPI void GLAPIENTRY glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
GLenum GLsizei n
Definition: glext.h:5074
Slightly heavyweight type to speed-up calculations with polygons in 3D.
Definition: geometry.h:32
#define GL_TRIANGLES
Definition: glew.h:276
void render_dl() const override
Render.
Definition: CMesh.cpp:294
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:416
#define GL_ONE_MINUS_SRC_ALPHA
Definition: glew.h:287
#define GL_COLOR_MATERIAL
Definition: glew.h:392
void 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:115
#define GL_DEPTH_TEST
Definition: glew.h:401
#define GL_SMOOTH
Definition: glew.h:635
GLAPI void GLAPIENTRY glShadeModel(GLenum mode)
#define GL_LIGHTING
Definition: glew.h:385
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:347
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:41
This base provides a set of functions for maths stuff.
Definition: CArrayNumeric.h:19
__int16 int16_t
Definition: rptypes.h:43
#define MRPT_END
const GLubyte * c
Definition: glext.h:6313
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
GLint GLvoid * img
Definition: glext.h:3763
bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const override
Trace ray.
Definition: CMesh.cpp:566
int val
Definition: mrpt_jpeglib.h:955
double x
X,Y,Z coordinates.
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:372
GLAPI void GLAPIENTRY glBegin(GLenum mode)
void updatePolygons() const
Definition: CMesh.cpp:587
#define GL_BLEND
Definition: glew.h:432
#define GL_LINE_LOOP
Definition: glew.h:274
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:286
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
GLdouble GLdouble GLdouble r
Definition: glext.h:3705
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...
Definition: CMesh.cpp:599
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:88
GLuint in
Definition: glext.h:7274
The namespace for 3D scene representation and rendering.
Definition: CGlCanvasBase.h:15
void updateColorsMatrix() const
Called internally to assure C is updated.
Definition: CMesh.cpp:467
#define ASSERT_(f)
GLAPI void GLAPIENTRY glEnd(void)
GLbyte by
Definition: glext.h:6105
mrpt::math::TPolygonWithPlane createPolygonFromTriangle(const std::pair< CSetOfTriangles::TTriangle, CMesh::TTriangleVertexIndices > &p)
Definition: CMesh.cpp:573
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:557
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:39
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:550
Lightweight 3D point.
GLuint GLenum GLenum transform
Definition: glext.h:6975
GLAPI void GLAPIENTRY glDisable(GLenum cap)
GLfloat GLfloat p
Definition: glext.h:6305
void readFromStream(mrpt::utils::CStream &in, int version) override
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
Definition: CMesh.cpp:426
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:60
3D polygon, inheriting from std::vector<TPoint3D>



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019