DGtal  1.4.beta
Viewer3D.h
1 
17 #pragma once
18 
31 #if defined(Viewer3D_RECURSES)
32 #error Recursive header files inclusion detected in Viewer3D.h
33 #else // defined(Viewer3D_RECURSES)
35 #define Viewer3D_RECURSES
36 
37 #if !defined Viewer3D_h
39 #define Viewer3D_h
40 
42 // Inclusions
43 #include "DGtal/base/Common.h"
44 
45 #include <iostream>
46 #include <vector>
47 #include <algorithm>
48 #ifdef WIN32
49 #include <windows.h>
50 #endif
51 
52 #ifdef APPLE
53 /* Defined before OpenGL and GLUT includes to avoid deprecation messages */
54 #define GL_SILENCE_DEPRECATION
55 #include <OpenGL/gl.h>
56 #include <OpenGL/glu.h>
57 #else
58 #include <GL/gl.h>
59 #include <GL/glu.h>
60 #endif
61 
62 #include <QApplication>
63 
64 #include <QGLViewer/qglviewer.h>
65 #include <QGLWidget>
66 #include <QKeyEvent>
67 
68 #include "DGtal/kernel/SpaceND.h"
69 #include "DGtal/topology/KhalimskySpaceND.h"
70 #include "DGtal/base/CountedPtr.h"
71 #include "DGtal/io/Display3D.h"
72 #include "DGtal/math/BasicMathFunctions.h"
73 
74 #include "DGtal/kernel/CSpace.h"
75 
77 
78 namespace DGtal
79 {
80 
82  // class Viewer3D
129  template <typename TSpace = SpaceND<3>,
130  typename TKSpace = KhalimskySpaceND<3>>
131  class Viewer3D : public QGLViewer, public Display3D<TSpace, TKSpace>
132  {
133 
135 
136  //---------------overwritting some functions of Display3D -------------------
137 
138  // ----------------------- public types ------------------------------
139  public:
140  typedef TSpace Space;
141  typedef TKSpace KSpace;
145  typedef typename Display::RealPoint RealPoint;
147 
149  {
154  };
155 
162  struct Extension
163  {
166 
167  virtual ~Extension() = default;
168 
177  virtual bool keyPressEvent( Viewer & viewer, QKeyEvent * event )
178  {
179  boost::ignore_unused_variable_warning( viewer );
180  boost::ignore_unused_variable_warning( event );
181  return false;
182  }
183 
189  virtual void drawWithNames( Viewer & viewer )
190  {
191  boost::ignore_unused_variable_warning( viewer );
192  }
193 
199  virtual void draw( Viewer & viewer )
200  {
201  boost::ignore_unused_variable_warning( viewer );
202  }
203 
208  virtual void init( Viewer & viewer )
209  {
210  boost::ignore_unused_variable_warning( viewer );
211  }
212 
219  virtual QString helpString( const Viewer & viewer ) const
220  {
221  boost::ignore_unused_variable_warning( viewer );
222  return "";
223  }
224 
234  virtual bool postSelection( const Viewer & viewer, const QPoint & point )
235  {
236  boost::ignore_unused_variable_warning( viewer );
237  boost::ignore_unused_variable_warning( point );
238  return false;
239  }
240 
249  virtual bool mouseMoveEvent( const Viewer & viewer, QMouseEvent * event )
250  {
251  boost::ignore_unused_variable_warning( viewer );
252  boost::ignore_unused_variable_warning( event );
253  return false;
254  }
255 
264  virtual bool mousePressEvent( const Viewer & viewer, QMouseEvent * event )
265  {
266  boost::ignore_unused_variable_warning( viewer );
267  boost::ignore_unused_variable_warning( event );
268  return false;
269  }
270 
280  virtual bool mouseReleaseEvent( const Viewer & viewer, QMouseEvent * event )
281  {
282  boost::ignore_unused_variable_warning( viewer );
283  boost::ignore_unused_variable_warning( event );
284  return false;
285  }
286  };
287 
288  // ----------------------- Standard services ------------------------------
289  public:
290 
294  Viewer3D() : QGLViewer(), Display3D<Space, KSpace>(), myExtension( 0 )
295  {
296  resize( 800, 600 );
297  };
298 
303  Viewer3D( const KSpace & KSEmb )
304  : QGLViewer(), Display3D<Space, KSpace>( KSEmb ), myExtension( 0 )
305  {
306  resize(800,600);
307  }
308 
312  void setExtension( Extension * ext )
313  {
314  if ( myExtension != 0 )
315  delete myExtension;
316  myExtension = ext;
317  }
318 
322  {
323  if ( myExtension != 0 )
324  delete myExtension;
325  myExtension = 0;
326  }
327 
334  void setCameraPosition(double ax, double ay, double az)
335  {
336  camera_position[0] = ax; camera_position[1] = ay; camera_position[2] = az;
337  }
338 
345  void setCameraDirection(double ax, double ay, double az)
346  {
347  camera_direction[0] = ax; camera_direction[1] = ay; camera_direction[2] = az;
348  }
349 
356  void setCameraUpVector(double ax, double ay, double az)
357  {
358  camera_upVector[0] = ax; camera_upVector[1] = ay; camera_upVector[2] = az;
359  }
360 
366  void setNearFar(double _near, double _far)
367  {
368  ZNear = _near; ZFar = _far;
369  }
370 
380  void setGLScale(float sx, float sy, float sz)
381  {
382  myGLScaleFactorX=sx;
383  myGLScaleFactorY=sy;
384  myGLScaleFactorZ=sz;
385  // In order to have the light source rendering the same as wtih the default scale 1.
386  glEnable(GL_NORMALIZE);
387  }
388 
389 
401  void setGLDoubleRenderingMode(bool doubleSidedRendering);
402 
403 
411  void setGLMaterialShininessCoefficient(const GLfloat matShininessCoeff);
412 
413 
422  void setGLLightAmbientCoefficients(const GLfloat lightAmbientCoeffs [4]);
423 
432  void setGLLightDiffuseCoefficients(const GLfloat lightDiffuseCoeffs [4]);
433 
434 
442  void setGLLightSpecularCoefficients(const GLfloat lightSpecularCoeffs [4]);
443 
444 
445 
456  void setUseGLPointForBalls(bool useOpenGLPt);
457 
458 
466  void updateRenderingCoefficients(const RenderingMode aRenderMode, bool displayState=true);
467 
468 
473 
482  double myGLPointMinWidth = 1.5;
483  double myGLLineMinWidth = 1.5;
486  // define the default rendering mode of the viewer
488 
494  {
495 
504  unsigned int myDomainWidth;
506  unsigned int myDomainHeight;
510  std::string myMode;
512  std::size_t myLineSetIndex;
513 
523  template<typename TDomain>
524  Image2DDomainD3D( TDomain aDomain, ImageDirection normalDir=zDirection,
525  double xBottomLeft=0.0, double yBottomLeft=0.0, double zBottomLeft=0.0, std::string mode= "BoundingBox")
526  {
528  myMode = mode;
529  myDirection=normalDir;
530  myDomainWidth = (aDomain.upperBound())[0]-(aDomain.lowerBound())[0]+1;
531  myDomainHeight = (aDomain.upperBound())[1]-(aDomain.lowerBound())[1]+1;
532  updateDomainOrientation(normalDir, xBottomLeft, yBottomLeft, zBottomLeft);
533  }
534 
535 
546  double xBottomLeft, double yBottomLeft, double zBottomLeft);
547 
548 
555  void translateDomain(double xTranslation=0.0,
556  double yTranslation=0.0, double zTranslation=0.0);
557 
558  };
559 
560 
566  {
567 
572 
574 
575  unsigned int myImageWidth;
576  unsigned int myImageHeight;
577  //TODO complete desc attribute
578  unsigned int * myTabImage;
579 
581  unsigned int myIndexDomain;
583 
588  {
589  delete [] myTabImage;
590  };
591 
597  point3(img.point3), point4(img.point4),
600  myTabImage(img.myTabImage),
603  myMode(img.myMode)
604  {
605 
606  if(img.myImageHeight>0 && img.myImageWidth>0)
607  {
608  myTabImage = new unsigned int [img.myImageWidth*img.myImageHeight];
609  for(unsigned int i=0; i<img.myImageWidth*img.myImageHeight; i++)
610  {
611  myTabImage[i] = img.myTabImage[i];
612  }
613  }else
614  {
615  myTabImage=img.myTabImage;
616  }
617  };
618 
619 
620 
640  template <typename TImageType, typename TFunctor>
641 
642  TextureImage( const TImageType & image, const TFunctor &aFunctor,
643  ImageDirection normalDir=zDirection,
644  double xBottomLeft=0.0, double yBottomLeft=0.0, double zBottomLeft=0.0,
645  TextureMode aMode= GrayScaleMode)
646  {
649  myDrawDomain=false;
650  myDirection=normalDir;
651  myImageWidth = (image.domain().upperBound())[0]-(image.domain().lowerBound())[0]+1;
652  myImageHeight = (image.domain().upperBound())[1]-(image.domain().lowerBound())[1]+1;
653  myTabImage = new unsigned int [myImageWidth*myImageHeight];
654  updateImageOrientation(normalDir, xBottomLeft, yBottomLeft, zBottomLeft);
655  myMode=aMode;
656  updateImageDataAndParam(image, aFunctor);
657  }
658 
669  double xBottomLeft, double yBottomLeft, double zBottomLeft);
670 
671 
679  void
681  RealPoint aPoint2,
682  RealPoint aPoint3,
683  RealPoint aPoint4)
684  {
685  point1 = aPoint1; point2 = aPoint2; point3 = aPoint3; point4 = aPoint4;
687  }
688 
689 
705  template <typename TImageType, typename TFunctor>
706  void updateImageDataAndParam(const TImageType & image, const TFunctor &aFunctor, double xTranslation=0.0,
707  double yTranslation=0.0, double zTranslation=0.0)
708  {
711  assert ( (image.domain().upperBound())[0]-(image.domain().lowerBound())[0]+1== static_cast<int>(myImageWidth) &&
712  (image.domain().upperBound())[1]-(image.domain().lowerBound())[1]+1== static_cast<int>(myImageHeight));
713 
714  point1[0] += xTranslation; point1[1] += yTranslation; point1[2] += zTranslation;
715  point2[0] += xTranslation; point2[1] +=yTranslation; point2[2] += zTranslation;
716  point3[0] += xTranslation; point3[1] += yTranslation; point3[2] += zTranslation;
717  point4[0] += xTranslation; point4[1] += yTranslation; point4[2] += zTranslation;
718 
719  unsigned int pos=0;
720  for(typename TImageType::Domain::ConstIterator it = image.domain().begin(), itend=image.domain().end();
721  it!=itend; ++it)
722  {
723  myTabImage[pos]= aFunctor(image(*it));
724  pos++;
725  }
726  }
727 
731  std::string className() const;
732 
733  private:
739  {};
740  };
741 
748 
749 
756 
757 
762 
767 
772 
777 
778 
779 
780  template <typename TDrawableWithViewer3D>
789  Viewer3D<Space, KSpace> & operator<< ( const TDrawableWithViewer3D & object );
790 
791 
792 
793  // ----------------------- Interface --------------------------------------
794  public:
795 
800  void selfDisplay ( std::ostream & out ) const;
801 
806  bool isValid() const;
807 
808 
809 
810  virtual unsigned int getCurrentDomainNumber();
811 
812  virtual unsigned int getCurrentGLImageNumber();
813 
814 
820  virtual void paintGL();
821 
822 
829  virtual void show();
830 
831 
837  void addTextureImage(const TextureImage &image);
838 
839 
852  template <typename TImageType, typename TFunctor>
853 
854  void updateTextureImage(unsigned int imageIndex, const TImageType & image, const TFunctor & aFunctor,
855  double xTranslation=0.0, double yTranslation=0.0, double zTranslation=0.0,
856  double rotationAngle=0.0, ImageDirection rotationDir=zDirection);
857 
858 
859 
860 
870  void updateOrientationTextureImage(unsigned int imageIndex,
871  double xPosition, double yPosition,
872  double zPosition, ImageDirection newDirection);
873 
874 
875 
884  void updateEmbeddingTextureImage(unsigned int anImageIndex,
885  typename Space::Point aPoint1, typename Space::Point aPoint2,
886  typename Space::Point aPoint3, typename Space::Point aPoint4);
887 
888 
889 
896  template<typename TDomain>
897  void addImage2DDomainD3D(const TDomain &anImageDomain, std::string mode,
898  const DGtal::Color &aColor=DGtal::Color::Red );
899 
900 
909  void updateAn2DDomainOrientation(unsigned int imageIndex,
910  double xPosition, double yPosition,
911  double zPosition, ImageDirection newDirection);
912 
920  void translateAn2DDomain(unsigned int domainIndex, double xTranslation,
921  double yTranslation, double zTranslation);
922 
929  std::vector<typename DGtal::Viewer3D< Space , KSpace >::LineD3D>
930  compute2DDomainLineRepresentation( Image2DDomainD3D &anImageDomain, double delta );
931 
937  std::vector<typename DGtal::Viewer3D< Space , KSpace >::LineD3D>
939 
940 
949  template < typename TContainer >
951  double angleRotation, ImageDirection dirRotation);
952 
953 
954 
963  void rotateDomain(Image2DDomainD3D &anDom, double angle, ImageDirection rotationDir);
964 
965 
966 
967 
968 
969 
970  // ------------------------- Protected Datas ------------------------------
971  private:
972 
973 
974 
975  public:
977  void drawSomeLight( GLenum light ) const
978  {
979  QGLViewer::drawLight( light );
980  }
982  void drawSomeLight( GLenum light, float zoom ) const
983  {
984  QGLViewer::drawLight( light, zoom );
985  }
986 
987  // ------------------------- Hidden services ------------------------------
988  // protected:
989 
996  void updateList( bool needToUpdateBoundingBox = true );
997 
1002  void glDrawGLBall( const typename Viewer3D<Space, KSpace>::BallD3D & aBall );
1003 
1021  virtual void keyPressEvent( QKeyEvent * e );
1022 
1028  virtual void mouseMoveEvent( QMouseEvent * e );
1029 
1035  virtual void mousePressEvent( QMouseEvent * e );
1036 
1042  virtual void mouseReleaseEvent( QMouseEvent * e );
1043 
1048  {
1049  qglviewer::Vec posCam;
1051  typename Viewer3D<Space, KSpace>::CubeD3D s2 )
1052  {
1053  double dist1 =
1054  sqrt( ( posCam.x - s1.center[ 0 ] ) * ( posCam.x - s1.center[ 0 ] ) +
1055  ( posCam.y - s1.center[ 1 ] ) * ( posCam.y - s1.center[ 1 ] ) +
1056  ( posCam.z - s1.center[ 2 ] ) * ( posCam.z - s1.center[ 2 ] ) );
1057  double dist2 =
1058  sqrt( ( posCam.x - s2.center[ 0 ] ) * ( posCam.x - s2.center[ 0 ] ) +
1059  ( posCam.y - s2.center[ 1 ] ) * ( posCam.y - s2.center[ 1 ] ) +
1060  ( posCam.z - s2.center[ 2 ] ) * ( posCam.z - s2.center[ 2 ] ) );
1061  return dist1 > dist2;
1062  }
1063  };
1064 
1065 
1070  {
1071  qglviewer::Vec posCam;
1074  {
1075  qglviewer::Vec center1 ( ( t1.point1[0]+t1.point2[0]+t1.point3[0] ) /3.0, ( t1.point1[1]+t1.point2[1]+t1.point3[1] ) /3.0, ( t1.point1[2]+t1.point2[2]+t1.point3[2] ) /3.0 );
1076  qglviewer::Vec center2 ( ( t2.point1[0]+t2.point2[0]+t2.point3[0] ) /3.0, ( t2.point1[1]+t2.point2[1]+t2.point3[1] ) /3.0, ( t2.point1[2]+t2.point2[2]+t2.point3[2] ) /3.0 );
1077  double dist1= sqrt ( ( posCam.x-center1.x ) * ( posCam.x-center1.x ) + ( posCam.y-center1.y ) * ( posCam.y-center1.y ) + ( posCam.z-center1.z ) * ( posCam.z-center1.z ) );
1078  double dist2= sqrt ( ( posCam.x-center2.x ) * ( posCam.x-center2.x ) + ( posCam.y-center2.y ) * ( posCam.y-center2.y ) + ( posCam.z-center2.z ) * ( posCam.z-center2.z ) );
1079 
1080  return dist1>dist2;
1081  }
1082  };
1083 
1088  {
1089  qglviewer::Vec posCam;
1091  typename Viewer3D<Space,KSpace>::QuadD3D q2 )
1092  {
1093 
1094  qglviewer::Vec center1 ( ( q1.point1[0]+q1.point2[0]+q1.point3[0]+q1.point4[0] ) /4.0, ( q1.point1[1]+q1.point2[1]+q1.point3[1]+q1.point4[1] ) /4.0, ( q1.point1[2]+q1.point2[2]+q1.point3[2]+q1.point4[2] ) /4.0 );
1095  qglviewer::Vec center2 ( ( q2.point1[0]+q2.point2[0]+q2.point3[0]+q2.point4[0] ) /4.0, ( q2.point1[1]+q2.point2[1]+q2.point3[1]+q2.point4[1] ) /4.0, ( q2.point1[2]+q2.point2[2]+q2.point3[2]+q2.point4[2] ) /4.0 );
1096 
1097  double dist1= sqrt ( ( posCam.x-center1.x ) * ( posCam.x-center1.x ) + ( posCam.y-center1.y ) * ( posCam.y-center1.y ) + ( posCam.z-center1.z ) * ( posCam.z-center1.z ) );
1098  double dist2= sqrt ( ( posCam.x-center2.x ) * ( posCam.x-center2.x ) + ( posCam.y-center2.y ) * ( posCam.y-center2.y ) + ( posCam.z-center2.z ) * ( posCam.z-center2.z ) );
1099  return dist1>dist2;
1100  }
1101  };
1102 
1107  {
1108  qglviewer::Vec posCam;
1111  {
1112  double c1x=0.0, c1y=0.0, c1z=0.0;
1113  double c2x=0.0, c2y=0.0, c2z=0.0;
1114  for(unsigned int i=0; i< q1.vertices.size(); i++){
1115  c1x+=q1.vertices.at(i)[0];
1116  c1y+=q1.vertices.at(i)[1];
1117  c1z+=q1.vertices.at(i)[2];
1118  }
1119  for(unsigned int i=0; i< q2.vertices.size(); i++){
1120  c2x+=q2.vertices.at(i)[0];
1121  c2y+=q2.vertices.at(i)[1];
1122  c2z+=q2.vertices.at(i)[2];
1123  }
1124 
1125  qglviewer::Vec center1 ( c1x/(double)q1.vertices.size(),c1y/(double)q1.vertices.size(), c1z/(double)q1.vertices.size() );
1126  qglviewer::Vec center2 ( c2x/(double)q2.vertices.size(),c2y/(double)q2.vertices.size(), c2z/(double)q2.vertices.size() );
1127 
1128  double dist1= sqrt ( ( posCam.x-center1.x ) * ( posCam.x-center1.x ) + ( posCam.y-center1.y ) * ( posCam.y-center1.y ) + ( posCam.z-center1.z ) * ( posCam.z-center1.z ) );
1129  double dist2= sqrt ( ( posCam.x-center2.x ) * ( posCam.x-center2.x ) + ( posCam.y-center2.y ) * ( posCam.y-center2.y ) + ( posCam.z-center2.z ) * ( posCam.z-center2.z ) );
1130  return dist1>dist2;
1131  }
1132  };
1133 
1134 
1135 
1139  virtual void drawWithNames();
1140 
1144  virtual void draw();
1145 
1149  virtual void init();
1150 
1154  virtual QString helpString() const;
1155 
1160  virtual void postSelection ( const QPoint& point );
1161 
1162 
1163 
1173  virtual QDomElement domElement(const QString& name, QDomDocument& document) const;
1174 
1175 
1186  virtual void initFromDOMElement(const QDomElement& element);
1187 
1188 
1196  protected: virtual void closeEvent ( QCloseEvent * e );
1197 
1198 
1199 
1200  // ------------------------- Internals ------------------------------------
1201  private:
1202 
1203 
1209  {
1215 
1217  unsigned int myImageWidth;
1218  unsigned int myImageHeight;
1219 
1220  unsigned int myBufferWidth;
1221  unsigned int myBufferHeight;
1224  unsigned char * myTextureImageBufferGS;
1225  unsigned char * myTextureImageBufferRGB;
1226  double vectNormal[3];
1227 
1228 
1229  // By definition in OpenGL the image size of texture should power of 2
1232 
1233 
1234  // Destructor
1236  {
1237  if(myMode== 1)
1238  {
1239  if(myTextureImageBufferGS!=0)
1240  delete [] myTextureImageBufferGS;
1241  }
1243  {
1245  delete [] myTextureImageBufferRGB;
1246  }
1247 
1248  }
1249 
1250  //Copy constructor from a GLTextureImage
1253  myTextureName(aGLImg.myTextureName),
1254  myMode(aGLImg.myMode),
1255  myTextureFitX(aGLImg.myTextureFitX),
1257 
1258  {
1259  point1[0]=aGLImg.point1[0]; point1[1]=aGLImg.point1[1]; point1[2]=aGLImg.point1[2];
1260  point2[0]=aGLImg.point2[0]; point2[1]=aGLImg.point2[1]; point2[2]=aGLImg.point2[2];
1261  point3[0]=aGLImg.point3[0]; point3[1]=aGLImg.point3[1]; point3[2]=aGLImg.point3[2];
1262  point4[0]=aGLImg.point4[0]; point4[1]=aGLImg.point4[1]; point4[2]=aGLImg.point4[2];
1264  myDirection = aGLImg.myDirection;
1265  vectNormal[0]=aGLImg.vectNormal[0];
1266  vectNormal[1]=aGLImg.vectNormal[1];
1267  vectNormal[2]=aGLImg.vectNormal[2];
1268 
1269  if(myMode== 1)
1270  {
1271  myTextureImageBufferGS = new unsigned char [myBufferHeight*myBufferWidth];
1272  for(unsigned int i=0; i<myBufferHeight*myBufferWidth;i++)
1273  {
1275  }
1277  {
1278  myTextureImageBufferRGB = new unsigned char [3*myBufferHeight*myBufferWidth];
1279  for(unsigned int i=0; i<3*myBufferHeight*myBufferWidth;i+=3)
1280  {
1284  }
1285  }
1286  }
1287 
1288 
1289  //Copy constructor from a TextureImage
1291  {
1292  point1[0]=aGSImage.point1[0]; point1[1]=aGSImage.point1[1]; point1[2]=aGSImage.point1[2];
1293  point2[0]=aGSImage.point2[0]; point2[1]=aGSImage.point2[1]; point2[2]=aGSImage.point2[2];
1294  point3[0]=aGSImage.point3[0]; point3[1]=aGSImage.point3[1]; point3[2]=aGSImage.point3[2];
1295  point4[0]=aGSImage.point4[0]; point4[1]=aGSImage.point4[1]; point4[2]=aGSImage.point4[2];
1296  myImageWidth=aGSImage.myImageWidth; myImageHeight=aGSImage.myImageHeight;
1297  myDirection = aGSImage.myDirection;
1298  myMode= aGSImage.myMode;
1303  RealPoint v1 = point2-point1;
1304  RealPoint v2 = point4-point1;
1305  vectNormal[0] = v1[1]*v2[2] - v1[2]*v2[1];
1306  vectNormal[1] = v1[2]*v2[0] - v1[0]*v2[2];
1307  vectNormal[2] = v1[0]*v2[1] - v1[1]*v2[0];
1308  double norm = sqrt(vectNormal[0]*vectNormal[0]+vectNormal[1]*vectNormal[1]+vectNormal[2]*vectNormal[2]);
1309  vectNormal[0] /=norm; vectNormal[1] /=norm; vectNormal[2] /=norm;
1310  }
1311 
1314 
1315  if(myMode== 1)
1316  {
1317  myTextureImageBufferGS = new unsigned char [myBufferHeight*myBufferWidth];
1318  unsigned int pos=0;
1319  for (unsigned int i=0; i<myBufferHeight; i++)
1320  {
1321  for (unsigned int j=0; j<myBufferWidth; j++)
1322  {
1323  if(i<myImageHeight && j< myImageWidth)
1324  {
1325  myTextureImageBufferGS[pos]= aGSImage.myTabImage[i*myImageWidth+j];
1326  }else{
1327  myTextureImageBufferGS[pos]=0;
1328  }
1329  pos++;
1330  }
1331  }
1333  {
1334  myTextureImageBufferRGB = new unsigned char [3*myBufferHeight*myBufferWidth];
1335  unsigned int pos=0;
1336  for (unsigned int i=0; i<myBufferHeight; i++)
1337  {
1338  for (unsigned int j=0; j<myBufferWidth; j++)
1339  {
1340  if(i<myImageHeight && j< myImageWidth)
1341  {
1342  DGtal::Color aCol(aGSImage.myTabImage[i*myImageWidth+j]);
1343  myTextureImageBufferRGB[pos]= aCol.red();
1344  myTextureImageBufferRGB[pos+1]= aCol.green();
1345  myTextureImageBufferRGB[pos+2]= aCol.blue();
1346  }else{
1347  myTextureImageBufferRGB[pos]=0;
1348  myTextureImageBufferRGB[pos+1]=0;
1349  myTextureImageBufferRGB[pos+2]=0;
1350  }
1351  pos+=3;
1352  }
1353  }
1354  }
1355 
1358  }
1359  };
1360 
1361 
1362 
1368  typedef typename std::vector<typename Viewer3D<Space, KSpace>::CubeD3D> VectorCubes;
1369  typedef typename std::vector<typename Viewer3D<Space, KSpace>::QuadD3D> VectorQuad;
1370  typedef typename std::vector<typename Viewer3D<Space, KSpace>::LineD3D> VectorLine;
1371  typedef typename std::vector<typename Viewer3D<Space, KSpace>::BallD3D> VectorBall;
1372  typedef typename std::vector<typename Viewer3D<Space, KSpace>::TriangleD3D> VectorTriangle;
1373  typedef typename std::vector<typename Viewer3D<Space, KSpace>::PolygonD3D> VectorPolygon;
1374  typedef typename std::vector<typename Viewer3D<Space, KSpace>::TextureImage> VectorTextureImage;
1375 
1376 
1377  typedef typename VectorCubes::iterator ItCube;
1378 
1379 
1389  void glCreateListCubesMaps(const typename Display3D<Space, KSpace>::CubesMap &aCubeMap, unsigned int idList);
1390 
1391 
1392 
1398  void glCreateListQuadD3D(const VectorQuad &aVectQuad, unsigned int idList);
1399 
1400 
1406  void glCreateListLines(const VectorLine &aVectLine, unsigned int idList);
1407 
1408 
1414  void glCreateListBalls(const VectorBall &aVectBall, unsigned int idList);
1415 
1416 
1426  void glCreateListQuadMaps(const typename Display3D<Space, KSpace>::QuadsMap &aQuadMap, unsigned int idList);
1427 
1428 
1438  void glCreateListQuadMapsWired(const typename Display3D<Space, KSpace>::QuadsMap &aQuadMap, unsigned int idList);
1439 
1440 
1449  void glCreateListTriangles(const std::vector<VectorTriangle> &aVectTriangle, unsigned int idList);
1450 
1451 
1460  void glCreateListTrianglesWired(const std::vector<VectorTriangle> &aVectTriangle, unsigned int idList);
1461 
1462 
1471  void glCreateListPolygons(const std::vector<VectorPolygon> &aVectPolygon, unsigned int idList);
1472 
1473 
1482  void glCreateListPolygonsWired(const std::vector<VectorPolygon> &aVectPolygon, unsigned int idList);
1483 
1484 
1491 
1492 
1500 
1506 
1514 
1522 
1523 
1524 
1525  public:
1537  template<typename TImageORDomain>
1538  static
1539  void
1540  rotateImageVertex(TImageORDomain &anImageOrDom, double angle, ImageDirection rotationDir){
1541  double xB = (anImageOrDom.point1[0]+anImageOrDom.point2[0]+anImageOrDom.point3[0]+anImageOrDom.point4[0])/4.0;
1542  double yB = (anImageOrDom.point1[1]+anImageOrDom.point2[1]+anImageOrDom.point3[1]+anImageOrDom.point4[1])/4.0;
1543  double zB = (anImageOrDom.point1[2]+anImageOrDom.point2[2]+anImageOrDom.point3[2]+anImageOrDom.point4[2])/4.0;
1544  rotatePoint( anImageOrDom.point1[0], anImageOrDom.point1[1], anImageOrDom.point1[2], xB, yB, zB, angle, rotationDir);
1545  rotatePoint( anImageOrDom.point2[0], anImageOrDom.point2[1], anImageOrDom.point2[2], xB, yB, zB, angle, rotationDir);
1546  rotatePoint( anImageOrDom.point3[0], anImageOrDom.point3[1], anImageOrDom.point3[2], xB, yB, zB, angle, rotationDir);
1547  rotatePoint( anImageOrDom.point4[0], anImageOrDom.point4[1], anImageOrDom.point4[2], xB, yB, zB, angle, rotationDir);
1548 
1549  }
1550 
1564  template <typename TValues>
1565  static
1566  void rotatePoint(TValues &x, TValues &y, TValues &z,
1567  double cx, double cy, double cz,
1568  double rotationAngle, ImageDirection rotationDir);
1569 
1570 
1571 
1572 
1573 
1574  // ------------------------- Private Datas --------------------------------
1575  private:
1576 
1578  //GLuint myListToAff;
1579 
1582 
1585 
1589 
1592 
1595 
1597 
1598  unsigned int myNbListe;
1599  unsigned int myNbLineSetList;
1600  unsigned int myNbBallSetList;
1601  unsigned int myNbPrismSetList;
1602 
1605  unsigned char mySelectionColorShift = 150;
1606 
1612  std::vector<GLTextureImage> myVectTextureImage;
1613 
1615 
1616  double camera_position[3];
1617  double camera_direction[3];
1618  double camera_upVector[3];
1619 
1620  bool myLightPositionFixToCamera = true; // when false the light position is fix according to the scene.
1621  double myLightTheta;
1622  double myLightPhi;
1623  double myLightR;
1624  GLfloat myLightPosition [4] = {0.0f, 0.0f, 1.0f, 1.0f}; // the light position in cartesian coordinate
1625  GLfloat myLightPositionRefCameraDefault [3] = {-100.0f, 100.0f, 0.0f}; // the light default position according to the camera position
1626  GLfloat myLightPositionRefCamera [3] = {0.0f, 0.0f, 0.0f}; // the light position according to the camera position
1627  GLfloat myMaterialShininessCoeff[1] = {50.0f} ; // the material shininess coefficient used in opengl rendering
1628  GLfloat myMaterialSpecularCoeffs[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; // the light specular coefficients used in opengl rendering
1629  GLfloat myLightSpecularCoeffs[4] = { 0.3f, 0.3f, 0.3f, 1.0f }; // the light specular coefficients used in opengl rendering
1630  GLfloat myLightAmbientCoeffs[4] = { 0.0f, 0.0f, 0.0f, 1.0f }; // the material ambient coefficients used in opengl rendering
1631  GLfloat myLightDiffuseCoeffs[4] = { 0.7f, 0.7f, 0.7f, 1.0f }; // the material diffuse coefficients used in opengl rendering
1632 
1633  const GLfloat myDefaultRenderSpec = 0.3f; // default specular coefficients for default mode rendering
1634  const GLfloat myDefaultRenderDiff = 0.7f; // default diffuse coefficients for metallic mode rendering
1635  const GLfloat myLambertRenderSpec = 0.0f; // default specular coefficients for default mode rendering
1636  const GLfloat myLambertRenderDiff = 0.9f; // default diffuse coefficients for metallic mode rendering
1637  const GLfloat myMetallicRenderSpec = 0.5f; // default specular coefficients for metallic mode rendering
1638  const GLfloat myMetallicRenderDiff = 0.5f; // default diffuse coefficients for metallic mode rendering
1639  const GLfloat myPlasticRenderSpec = 0.8f; // default specular coefficients for platic mode rendering
1640  const GLfloat myPlasticRenderDiff = 0.2f; // default diffuse coefficients for platic mode rendering
1641 
1642  bool myUseGLPointsForBalls = false; // to display balls with GL points (instead real ball)
1643 
1644  double ZNear;
1645  double ZFar;
1646 
1647  //the default width of the mesh line
1649 
1650  // To apply openGL ajustment only on visualisation
1651  float myGLScaleFactorX=1.0;
1652  float myGLScaleFactorY=1.0;
1653  float myGLScaleFactorZ=1.0;
1654 
1655  // Used to apply interactive light rotation
1660 
1662  std::vector<TextureImage> myGSImageList;
1664  std::vector<Image2DDomainD3D> myImageDomainList;
1667 
1668  }; // end of class Viewer3D
1669 
1670  template <typename TSpace, typename TKSpace>
1677  std::ostream & operator<<( std::ostream & out,
1678  const Viewer3D<TSpace, TKSpace> & object );
1679 } // namespace DGtal
1680 
1681 
1683 // Includes inline functions.
1684 #include "DGtal/io/viewers/Viewer3D.ih"
1685 
1686 // //
1688 
1689 #endif // !defined Viewer3D_h
1690 
1691 #undef Viewer3D_RECURSES
1692 #endif // else defined(Viewer3D_RECURSES)
Structure representing an RGB triple with alpha component.
Definition: Color.h:68
void green(const unsigned char aGreenValue)
void red(const unsigned char aRedValue)
static const Color Red
Definition: Color.h:416
void blue(const unsigned char aBlueValue)
Aim: This semi abstract class defines the stream mechanism to display 3d primitive (like BallVector,...
Definition: Display3D.h:93
int(* SelectCallbackFct)(void *viewer, DGtal::int32_t name, void *data)
Select callback function type.
Definition: Display3D.h:109
SelectCallbackFct getSelectCallback3D(DGtal::int32_t aName, void *&data) const
Space::RealPoint RealPoint
RealPoint type.
Definition: Display3D.h:101
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:593
qglviewer::Vec myDirSelector
Definition: Viewer3D.h:1608
void glCreateListPolygonsWired(const std::vector< VectorPolygon > &aVectPolygon, unsigned int idList)
bool myIsBackgroundDefault
true if the background is default
Definition: Viewer3D.h:479
unsigned int myNbLineSetList
Definition: Viewer3D.h:1599
bool myViewWire
objects have shadows which follow the camera if false
Definition: Viewer3D.h:481
void drawSomeLight(GLenum light) const
To call the protected method drawLight.
Definition: Viewer3D.h:977
GLuint myTriangleSetListId
lists of the list to draw
Definition: Viewer3D.h:1580
virtual QString helpString() const
void setCameraPosition(double ax, double ay, double az)
Definition: Viewer3D.h:334
float myGLScaleFactorY
Definition: Viewer3D.h:1652
Viewer3D< Space, KSpace > & operator<<(const DGtal::Color &aColor)
qglviewer::Vec myDir
Definition: Viewer3D.h:1608
const GLfloat myLambertRenderSpec
Definition: Viewer3D.h:1635
virtual void mouseMoveEvent(QMouseEvent *e)
const GLfloat myPlasticRenderSpec
Definition: Viewer3D.h:1639
float myGLScaleFactorX
Definition: Viewer3D.h:1651
virtual void mousePressEvent(QMouseEvent *e)
virtual void paintGL()
Overload of the QGLViewer method in order to change the order of display (to fix the QGLViewer axis d...
double camera_upVector[3]
camera up-vector
Definition: Viewer3D.h:1618
virtual void show()
Overload QWidget method in order to add a call to updateList() method (to ensure that the lists are w...
double myLightTheta
Definition: Viewer3D.h:1621
void sortQuadFromCamera()
void glCreateListQuadMapsWired(const typename Display3D< Space, KSpace >::QuadsMap &aQuadMap, unsigned int idList)
GLfloat myLightSpecularCoeffs[4]
Definition: Viewer3D.h:1629
GLfloat myLightDiffuseCoeffs[4]
Definition: Viewer3D.h:1631
bool myIsDoubleFaceRendering
true if is double face rendering
Definition: Viewer3D.h:1614
void setExtension(Extension *ext)
Definition: Viewer3D.h:312
static void rotatePoint(TValues &x, TValues &y, TValues &z, double cx, double cy, double cz, double rotationAngle, ImageDirection rotationDir)
DGtal::Color myDefaultColor
the default color of the viewer
Definition: Viewer3D.h:477
GLuint myPrismListId
Definition: Viewer3D.h:1588
bool myLightPositionFixToCamera
Definition: Viewer3D.h:1620
GLuint myBallSetListId
Definition: Viewer3D.h:1587
void setCameraDirection(double ax, double ay, double az)
Definition: Viewer3D.h:345
void setGLLightDiffuseCoefficients(const GLfloat lightDiffuseCoeffs[4])
qglviewer::Vec myOrig
information linked to the navigation in the viewer
Definition: Viewer3D.h:1608
bool myAutoSaveState
flag to save automatically or not the Viewer3d state when closing the viewer
Definition: Viewer3D.h:485
GLfloat myLightPositionRefCameraDefault[3]
Definition: Viewer3D.h:1625
virtual void init()
init
int myRefMouseXPos
the angle rotation increment used for interactive light move
Definition: Viewer3D.h:1657
void setNearFar(double _near, double _far)
Definition: Viewer3D.h:366
virtual void closeEvent(QCloseEvent *e)
Overload the QWidget method to customize the viewer state auto saving. Now it save the viewer state i...
void sortPolygonFromCamera()
double myLigthRotationStep
Definition: Viewer3D.h:1656
GLfloat myLightAmbientCoeffs[4]
Definition: Viewer3D.h:1630
std::vector< GLTextureImage > myVectTextureImage
list of the images textures in this viewer
Definition: Viewer3D.h:1612
float myMeshDefaultLineWidth
Definition: Viewer3D.h:1648
unsigned char mySelectionColorShift
Definition: Viewer3D.h:1605
VectorCubes::iterator ItCube
Definition: Viewer3D.h:1377
void translateAn2DDomain(unsigned int domainIndex, double xTranslation, double yTranslation, double zTranslation)
bool isValid() const
GLuint myPolygonSetListWiredId
Definition: Viewer3D.h:1584
static void rotateImageVertex(TImageORDomain &anImageOrDom, double angle, ImageDirection rotationDir)
Definition: Viewer3D.h:1540
std::vector< typename Viewer3D< Space, KSpace >::TriangleD3D > VectorTriangle
Definition: Viewer3D.h:1372
virtual unsigned int getCurrentGLImageNumber()
void updateAn2DDomainOrientation(unsigned int imageIndex, double xPosition, double yPosition, double zPosition, ImageDirection newDirection)
TextureMode
the modes of representation of an image
Definition: Viewer3D.h:472
void drawSomeLight(GLenum light, float zoom) const
To call the protected method drawLight.
Definition: Viewer3D.h:982
void glCreateListPolygons(const std::vector< VectorPolygon > &aVectPolygon, unsigned int idList)
void selfDisplay(std::ostream &out) const
qglviewer::Vec mySelectedPoint
Definition: Viewer3D.h:1608
std::vector< typename Viewer3D< Space, KSpace >::BallD3D > VectorBall
Definition: Viewer3D.h:1371
Viewer3D(const KSpace &KSEmb)
Definition: Viewer3D.h:303
virtual void keyPressEvent(QKeyEvent *e)
void glUpdateBackground()
void glCreateListLines(const VectorLine &aVectLine, unsigned int idList)
std::vector< typename Viewer3D< Space, KSpace >::CubeD3D > VectorCubes
Definition: Viewer3D.h:1368
double myLightR
the light position (azimuth)
Definition: Viewer3D.h:1623
RenderingMode myRenderingMode
Definition: Viewer3D.h:487
const GLfloat myMetallicRenderDiff
Definition: Viewer3D.h:1638
void rotateDomain(Image2DDomainD3D &anDom, double angle, ImageDirection rotationDir)
void glCreateListQuadMaps(const typename Display3D< Space, KSpace >::QuadsMap &aQuadMap, unsigned int idList)
void glDrawGLBall(const typename Viewer3D< Space, KSpace >::BallD3D &aBall)
std::vector< typename DGtal::Viewer3D< Space, KSpace >::LineD3D > compute2DDomainLineRepresentation(Image2DDomainD3D &anImageDomain, double delta)
std::vector< typename Viewer3D< Space, KSpace >::LineD3D > VectorLine
Definition: Viewer3D.h:1370
void removeExtension()
Definition: Viewer3D.h:321
GLfloat myMaterialSpecularCoeffs[4]
Definition: Viewer3D.h:1628
GLuint myQuadsMapWiredId
Definition: Viewer3D.h:1591
std::vector< Image2DDomainD3D > myImageDomainList
Used to store all the domains.
Definition: Viewer3D.h:1664
void updateRenderingCoefficients(const RenderingMode aRenderMode, bool displayState=true)
std::vector< typename Viewer3D< Space, KSpace >::PolygonD3D > VectorPolygon
Definition: Viewer3D.h:1373
double myGLPointMinWidth
Definition: Viewer3D.h:482
bool myIsMovingLight
the reference mouse y-position used to determince the light position change (inclination)
Definition: Viewer3D.h:1659
std::vector< typename Viewer3D< Space, KSpace >::QuadD3D > VectorQuad
Definition: Viewer3D.h:1369
QPoint myPosSelector
a point selected with postSelection
Definition: Viewer3D.h:1610
void updateRelativeCameraFromLightPosition()
Display::RealPoint RealPoint
Definition: Viewer3D.h:145
unsigned int myNbBallSetList
Definition: Viewer3D.h:1600
virtual unsigned int getCurrentDomainNumber()
virtual void initFromDOMElement(const QDomElement &element)
Overload of the QGLViewer method which restores the viewer state from a QDomDocument element....
GLuint myPolygonSetListId
Definition: Viewer3D.h:1583
const GLfloat myPlasticRenderDiff
Definition: Viewer3D.h:1640
const GLfloat myDefaultRenderDiff
Definition: Viewer3D.h:1634
void updateEmbeddingTextureImage(unsigned int anImageIndex, typename Space::Point aPoint1, typename Space::Point aPoint2, typename Space::Point aPoint3, typename Space::Point aPoint4)
const GLfloat myMetallicRenderSpec
Definition: Viewer3D.h:1637
virtual void draw()
draw
double myGLLineMinWidth
to improve the display of gl points
Definition: Viewer3D.h:483
void glCreateListCubesMaps(const typename Display3D< Space, KSpace >::CubesMap &aCubeMap, unsigned int idList)
GLuint myLineSetListId
Definition: Viewer3D.h:1586
GLuint myCubesMapId
Definition: Viewer3D.h:1593
void setGLLightSpecularCoefficients(const GLfloat lightSpecularCoeffs[4])
int myRefMouseYPos
the reference mouse x-position used to determince the light position change (azimuth)
Definition: Viewer3D.h:1658
std::vector< typename Viewer3D< Space, KSpace >::TextureImage > VectorTextureImage
Definition: Viewer3D.h:1374
GLuint myCubeSetListWiredId
Definition: Viewer3D.h:1594
int mySelectedElementId
used to displayed selected elements
Definition: Viewer3D.h:1604
void setGLScale(float sx, float sy, float sz)
Definition: Viewer3D.h:380
void glCreateListBalls(const VectorBall &aVectBall, unsigned int idList)
unsigned int myNbPrismSetList
Definition: Viewer3D.h:1601
void glCreateListTrianglesWired(const std::vector< VectorTriangle > &aVectTriangle, unsigned int idList)
void updateOrientationTextureImage(unsigned int imageIndex, double xPosition, double yPosition, double zPosition, ImageDirection newDirection)
virtual void postSelection(const QPoint &point)
postSelection
GLfloat myMaterialShininessCoeff[1]
Definition: Viewer3D.h:1627
TSpace Space
Definition: Viewer3D.h:140
const GLfloat myLambertRenderDiff
Definition: Viewer3D.h:1636
BOOST_CONCEPT_ASSERT((concepts::CSpace< TSpace >))
DGtal::Color myDefaultBackgroundColor
the default background color of the viewer
Definition: Viewer3D.h:475
void sortTriangleFromCamera()
void updateList(bool needToUpdateBoundingBox=true)
Display::SelectCallbackFct SelectCallbackFct
Definition: Viewer3D.h:144
void glUpdateLightRenderingMode() const
ImageDirection
the 3 possible axes for the image direction
Definition: Viewer3D.h:470
Display3D< Space, KSpace > Display
Definition: Viewer3D.h:143
bool myUseGLPointsForBalls
Definition: Viewer3D.h:1642
unsigned int myNbListe
number of lists in myListToAff
Definition: Viewer3D.h:1598
GLuint myTriangleSetListWiredId
Definition: Viewer3D.h:1581
virtual void drawWithNames()
drawWithNames
GLuint myQuadsMapId
Definition: Viewer3D.h:1590
void addTextureImage(const TextureImage &image)
GLfloat myLightPosition[4]
the light position (distance)
Definition: Viewer3D.h:1624
void setUseGLPointForBalls(bool useOpenGLPt)
double ZFar
zfar distance
Definition: Viewer3D.h:1645
void addImage2DDomainD3D(const TDomain &anImageDomain, std::string mode, const DGtal::Color &aColor=DGtal::Color::Red)
double myLightPhi
the light position (inclination)
Definition: Viewer3D.h:1622
double camera_position[3]
camera position
Definition: Viewer3D.h:1616
void setGLMaterialShininessCoefficient(const GLfloat matShininessCoeff)
void setGLLightAmbientCoefficients(const GLfloat lightAmbientCoeffs[4])
virtual void mouseReleaseEvent(QMouseEvent *e)
void glCreateListTriangles(const std::vector< VectorTriangle > &aVectTriangle, unsigned int idList)
double ZNear
znear distance
Definition: Viewer3D.h:1644
void glCreateListQuadD3D(const VectorQuad &aVectQuad, unsigned int idList)
float myGLScaleFactorZ
Definition: Viewer3D.h:1653
Viewer3D< Space, KSpace > Self
Definition: Viewer3D.h:142
void updateTextureImage(unsigned int imageIndex, const TImageType &image, const TFunctor &aFunctor, double xTranslation=0.0, double yTranslation=0.0, double zTranslation=0.0, double rotationAngle=0.0, ImageDirection rotationDir=zDirection)
void sortSurfelFromCamera()
TKSpace KSpace
Definition: Viewer3D.h:141
std::vector< typename DGtal::Viewer3D< Space, KSpace >::LineD3D > compute2DDomainLineRepresentation(Image2DDomainD3D &anImageDomain)
void rotateLineD3D(typename DGtal::Display3D< Space, KSpace >::LineD3D &aLine, DGtal::PointVector< 3, int, TContainer > pt, double angleRotation, ImageDirection dirRotation)
double camera_direction[3]
camera direction
Definition: Viewer3D.h:1617
void setGLDoubleRenderingMode(bool doubleSidedRendering)
GLfloat myLightPositionRefCamera[3]
Definition: Viewer3D.h:1626
void setCameraUpVector(double ax, double ay, double az)
Definition: Viewer3D.h:356
virtual QDomElement domElement(const QString &name, QDomDocument &document) const
Overload of the QGLViewer method which returns an XML QDomElement representing the QGLViewer state....
const GLfloat myDefaultRenderSpec
Definition: Viewer3D.h:1633
void updateLightCoordsFromCamera()
void glUpdateTextureImages(const VectorTextureImage &aVectImage)
std::vector< TextureImage > myGSImageList
flag to display the ligth source when it is moved by the user
Definition: Viewer3D.h:1662
Extension * myExtension
Stored a possible extension to the viewer (pointer owned).
Definition: Viewer3D.h:1666
MyDigitalSurface::ConstIterator ConstIterator
T roundToUpperPowerOfTwo(const T &n)
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
bool operator()(typename Viewer3D< Space, KSpace >::PolygonD3D q1, typename Viewer3D< Space, KSpace >::PolygonD3D q2)
Definition: Viewer3D.h:1109
bool operator()(typename Viewer3D< Space, KSpace >::QuadD3D q1, typename Viewer3D< Space, KSpace >::QuadD3D q2)
Definition: Viewer3D.h:1090
bool operator()(typename Viewer3D< Space, KSpace >::TriangleD3D t1, typename Viewer3D< Space, KSpace >::TriangleD3D t2)
Definition: Viewer3D.h:1072
bool operator()(typename Viewer3D< Space, KSpace >::CubeD3D s1, typename Viewer3D< Space, KSpace >::CubeD3D s2)
Definition: Viewer3D.h:1050
virtual bool mouseMoveEvent(const Viewer &viewer, QMouseEvent *event)
Definition: Viewer3D.h:249
virtual ~Extension()=default
virtual QString helpString(const Viewer &viewer) const
Definition: Viewer3D.h:219
virtual void draw(Viewer &viewer)
Definition: Viewer3D.h:199
virtual bool mouseReleaseEvent(const Viewer &viewer, QMouseEvent *event)
Definition: Viewer3D.h:280
virtual bool mousePressEvent(const Viewer &viewer, QMouseEvent *event)
Definition: Viewer3D.h:264
virtual bool postSelection(const Viewer &viewer, const QPoint &point)
Definition: Viewer3D.h:234
virtual void drawWithNames(Viewer &viewer)
Definition: Viewer3D.h:189
virtual void init(Viewer &viewer)
Definition: Viewer3D.h:208
virtual bool keyPressEvent(Viewer &viewer, QKeyEvent *event)
Definition: Viewer3D.h:177
Viewer3D< Space, KSpace > Viewer
The associated viewer.
Definition: Viewer3D.h:165
Viewer3D< Space, KSpace >::ImageDirection myDirection
Definition: Viewer3D.h:1216
unsigned char * myTextureImageBufferGS
Definition: Viewer3D.h:1224
GLTextureImage(const GLTextureImage &aGLImg)
Definition: Viewer3D.h:1251
GLTextureImage(const typename Viewer3D< Space, KSpace >::TextureImage &aGSImage)
Definition: Viewer3D.h:1290
unsigned char * myTextureImageBufferRGB
Definition: Viewer3D.h:1225
Viewer3D< Space, KSpace >::TextureMode myMode
Definition: Viewer3D.h:1223
RealPoint point1
coordinates
Definition: Viewer3D.h:1211
unsigned int myDomainWidth
the width of the image domain
Definition: Viewer3D.h:504
Image2DDomainD3D(TDomain aDomain, ImageDirection normalDir=zDirection, double xBottomLeft=0.0, double yBottomLeft=0.0, double zBottomLeft=0.0, std::string mode="BoundingBox")
Definition: Viewer3D.h:524
unsigned int myDomainHeight
the height of the image domain
Definition: Viewer3D.h:506
ImageDirection myDirection
the direction of the domain (x, y or z axe)
Definition: Viewer3D.h:508
DGtal::Color color
The image domain color.
Definition: Viewer3D.h:502
std::size_t myLineSetIndex
the index of the line of the domain in the lineSetList of the viewer
Definition: Viewer3D.h:512
void translateDomain(double xTranslation=0.0, double yTranslation=0.0, double zTranslation=0.0)
RealPoint point1
The image domain coordinates.
Definition: Viewer3D.h:497
std::string myMode
the mode of representation of the image domain
Definition: Viewer3D.h:510
void updateDomainOrientation(ImageDirection normalDir, double xBottomLeft, double yBottomLeft, double zBottomLeft)
unsigned int myImageHeight
the width of the image
Definition: Viewer3D.h:576
void updateImageOrientation(ImageDirection normalDir, double xBottomLeft, double yBottomLeft, double zBottomLeft)
unsigned int * myTabImage
the height of the image
Definition: Viewer3D.h:578
TextureImage(const TImageType &image, const TFunctor &aFunctor, ImageDirection normalDir=zDirection, double xBottomLeft=0.0, double yBottomLeft=0.0, double zBottomLeft=0.0, TextureMode aMode=GrayScaleMode)
Definition: Viewer3D.h:642
bool myDrawDomain
for each pixel of the image, color or height ?
Definition: Viewer3D.h:580
ImageDirection myDirection
Definition: Viewer3D.h:573
~TextureImage()
the mode of representation of the image
Definition: Viewer3D.h:587
TextureMode myMode
index of the image domain if exist
Definition: Viewer3D.h:582
TextureImage(const TextureImage &img)
Copy constructor (needed due to myTabImage)
Definition: Viewer3D.h:596
void updateImageDataAndParam(const TImageType &image, const TFunctor &aFunctor, double xTranslation=0.0, double yTranslation=0.0, double zTranslation=0.0)
Definition: Viewer3D.h:706
unsigned int myImageWidth
direction of the image (x, y or z axe)
Definition: Viewer3D.h:575
std::string className() const
unsigned int myIndexDomain
true if the draw have a domain
Definition: Viewer3D.h:581
void updateImage3DEmbedding(RealPoint aPoint1, RealPoint aPoint2, RealPoint aPoint3, RealPoint aPoint4)
Definition: Viewer3D.h:680
Aim: Defines the concept describing a read-only image, which is a refinement of CPointFunctor.
Definition: CConstImage.h:95
Aim: This concept represents a digital domain, i.e. a non mutable subset of points of the given digit...
Definition: CDomain.h:130
Aim: Defines the concept describing a digital space, ie a cartesian product of integer lines.
Definition: CSpace.h:106
Aim: Defines a unary functor, which associates arguments to results.
Definition: CUnaryFunctor.h:90
Image image(domain)