DGtal  1.2.0
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 #ifdef WITH_QT5
63  #include <QApplication>
64 #else
65  #include <QtGui/qapplication.h>
66 #endif
67 
68 #include <QGLViewer/qglviewer.h>
69 #include <QGLWidget>
70 #include <QKeyEvent>
71 
72 #include "DGtal/kernel/SpaceND.h"
73 #include "DGtal/topology/KhalimskySpaceND.h"
74 #include "DGtal/base/CountedPtr.h"
75 #include "DGtal/io/Display3D.h"
76 #include "DGtal/math/BasicMathFunctions.h"
77 
78 #include "DGtal/kernel/CSpace.h"
79 
81 
82 namespace DGtal
83 {
84 
86  // class Viewer3D
133  template <typename TSpace = SpaceND<3>,
134  typename TKSpace = KhalimskySpaceND<3>>
135  class Viewer3D : public QGLViewer, public Display3D<TSpace, TKSpace>
136  {
137 
139 
140  //---------------overwritting some functions of Display3D -------------------
141 
142  // ----------------------- public types ------------------------------
143  public:
144  typedef TSpace Space;
145  typedef TKSpace KSpace;
149  typedef typename Display::RealPoint RealPoint;
151 
153  {
158  };
159 
166  struct Extension
167  {
170 
171  virtual ~Extension() = default;
172 
181  virtual bool keyPressEvent( Viewer & viewer, QKeyEvent * event )
182  {
183  boost::ignore_unused_variable_warning( viewer );
184  boost::ignore_unused_variable_warning( event );
185  return false;
186  }
187 
193  virtual void drawWithNames( Viewer & viewer )
194  {
195  boost::ignore_unused_variable_warning( viewer );
196  }
197 
203  virtual void draw( Viewer & viewer )
204  {
205  boost::ignore_unused_variable_warning( viewer );
206  }
207 
212  virtual void init( Viewer & viewer )
213  {
214  boost::ignore_unused_variable_warning( viewer );
215  }
216 
223  virtual QString helpString( const Viewer & viewer ) const
224  {
225  boost::ignore_unused_variable_warning( viewer );
226  return "";
227  }
228 
238  virtual bool postSelection( const Viewer & viewer, const QPoint & point )
239  {
240  boost::ignore_unused_variable_warning( viewer );
241  boost::ignore_unused_variable_warning( point );
242  return false;
243  }
244 
253  virtual bool mouseMoveEvent( const Viewer & viewer, QMouseEvent * event )
254  {
255  boost::ignore_unused_variable_warning( viewer );
256  boost::ignore_unused_variable_warning( event );
257  return false;
258  }
259 
268  virtual bool mousePressEvent( const Viewer & viewer, QMouseEvent * event )
269  {
270  boost::ignore_unused_variable_warning( viewer );
271  boost::ignore_unused_variable_warning( event );
272  return false;
273  }
274 
284  virtual bool mouseReleaseEvent( const Viewer & viewer, QMouseEvent * event )
285  {
286  boost::ignore_unused_variable_warning( viewer );
287  boost::ignore_unused_variable_warning( event );
288  return false;
289  }
290  };
291 
292  // ----------------------- Standard services ------------------------------
293  public:
294 
298  Viewer3D() : QGLViewer(), Display3D<Space, KSpace>(), myExtension( 0 )
299  {
300  resize( 800, 600 );
301  };
302 
307  Viewer3D( const KSpace & KSEmb )
308  : QGLViewer(), Display3D<Space, KSpace>( KSEmb ), myExtension( 0 )
309  {
310  resize(800,600);
311  }
312 
316  void setExtension( Extension * ext )
317  {
318  if ( myExtension != 0 )
319  delete myExtension;
320  myExtension = ext;
321  }
322 
326  {
327  if ( myExtension != 0 )
328  delete myExtension;
329  myExtension = 0;
330  }
331 
338  void setCameraPosition(double ax, double ay, double az)
339  {
340  camera_position[0] = ax; camera_position[1] = ay; camera_position[2] = az;
341  }
342 
349  void setCameraDirection(double ax, double ay, double az)
350  {
351  camera_direction[0] = ax; camera_direction[1] = ay; camera_direction[2] = az;
352  }
353 
360  void setCameraUpVector(double ax, double ay, double az)
361  {
362  camera_upVector[0] = ax; camera_upVector[1] = ay; camera_upVector[2] = az;
363  }
364 
370  void setNearFar(double _near, double _far)
371  {
372  ZNear = _near; ZFar = _far;
373  }
374 
384  void setGLScale(float sx, float sy, float sz)
385  {
386  myGLScaleFactorX=sx;
387  myGLScaleFactorY=sy;
388  myGLScaleFactorZ=sz;
389  // In order to have the light source rendering the same as wtih the default scale 1.
390  glEnable(GL_NORMALIZE);
391  }
392 
393 
405  void setGLDoubleRenderingMode(bool doubleSidedRendering);
406 
407 
415  void setGLMaterialShininessCoefficient(const GLfloat matShininessCoeff);
416 
417 
426  void setGLLightAmbientCoefficients(const GLfloat lightAmbientCoeffs [4]);
427 
436  void setGLLightDiffuseCoefficients(const GLfloat lightDiffuseCoeffs [4]);
437 
438 
446  void setGLLightSpecularCoefficients(const GLfloat lightSpecularCoeffs [4]);
447 
448 
449 
460  void setUseGLPointForBalls(bool useOpenGLPt);
461 
462 
470  void updateRenderingCoefficients(const RenderingMode aRenderMode, bool displayState=true);
471 
472 
477 
486  double myGLPointMinWidth = 1.5;
487  double myGLLineMinWidth = 1.5;
490  // define the default rendering mode of the viewer
492 
498  {
499 
508  unsigned int myDomainWidth;
510  unsigned int myDomainHeight;
514  std::string myMode;
516  std::size_t myLineSetIndex;
517 
527  template<typename TDomain>
528  Image2DDomainD3D( TDomain aDomain, ImageDirection normalDir=zDirection,
529  double xBottomLeft=0.0, double yBottomLeft=0.0, double zBottomLeft=0.0, std::string mode= "BoundingBox")
530  {
532  myMode = mode;
533  myDirection=normalDir;
534  myDomainWidth = (aDomain.upperBound())[0]-(aDomain.lowerBound())[0]+1;
535  myDomainHeight = (aDomain.upperBound())[1]-(aDomain.lowerBound())[1]+1;
536  updateDomainOrientation(normalDir, xBottomLeft, yBottomLeft, zBottomLeft);
537  }
538 
539 
550  double xBottomLeft, double yBottomLeft, double zBottomLeft);
551 
552 
559  void translateDomain(double xTranslation=0.0,
560  double yTranslation=0.0, double zTranslation=0.0);
561 
562  };
563 
564 
570  {
571 
576 
578 
579  unsigned int myImageWidth;
580  unsigned int myImageHeight;
581  //TODO complete desc attribute
582  unsigned int * myTabImage;
583 
585  unsigned int myIndexDomain;
587 
592  {
593  delete [] myTabImage;
594  };
595 
601  point3(img.point3), point4(img.point4),
604  myTabImage(img.myTabImage),
607  myMode(img.myMode)
608  {
609 
610  if(img.myImageHeight>0 && img.myImageWidth>0)
611  {
612  myTabImage = new unsigned int [img.myImageWidth*img.myImageHeight];
613  for(unsigned int i=0; i<img.myImageWidth*img.myImageHeight; i++)
614  {
615  myTabImage[i] = img.myTabImage[i];
616  }
617  }else
618  {
619  myTabImage=img.myTabImage;
620  }
621  };
622 
623 
624 
644  template <typename TImageType, typename TFunctor>
645 
646  TextureImage( const TImageType & image, const TFunctor &aFunctor,
647  ImageDirection normalDir=zDirection,
648  double xBottomLeft=0.0, double yBottomLeft=0.0, double zBottomLeft=0.0,
649  TextureMode aMode= GrayScaleMode)
650  {
653  myDrawDomain=false;
654  myDirection=normalDir;
655  myImageWidth = (image.domain().upperBound())[0]-(image.domain().lowerBound())[0]+1;
656  myImageHeight = (image.domain().upperBound())[1]-(image.domain().lowerBound())[1]+1;
657  myTabImage = new unsigned int [myImageWidth*myImageHeight];
658  updateImageOrientation(normalDir, xBottomLeft, yBottomLeft, zBottomLeft);
659  myMode=aMode;
660  updateImageDataAndParam(image, aFunctor);
661  }
662 
673  double xBottomLeft, double yBottomLeft, double zBottomLeft);
674 
675 
683  void
685  RealPoint aPoint2,
686  RealPoint aPoint3,
687  RealPoint aPoint4)
688  {
689  point1 = aPoint1; point2 = aPoint2; point3 = aPoint3; point4 = aPoint4;
691  }
692 
693 
709  template <typename TImageType, typename TFunctor>
710  void updateImageDataAndParam(const TImageType & image, const TFunctor &aFunctor, double xTranslation=0.0,
711  double yTranslation=0.0, double zTranslation=0.0)
712  {
715  assert ( (image.domain().upperBound())[0]-(image.domain().lowerBound())[0]+1== static_cast<int>(myImageWidth) &&
716  (image.domain().upperBound())[1]-(image.domain().lowerBound())[1]+1== static_cast<int>(myImageHeight));
717 
718  point1[0] += xTranslation; point1[1] += yTranslation; point1[2] += zTranslation;
719  point2[0] += xTranslation; point2[1] +=yTranslation; point2[2] += zTranslation;
720  point3[0] += xTranslation; point3[1] += yTranslation; point3[2] += zTranslation;
721  point4[0] += xTranslation; point4[1] += yTranslation; point4[2] += zTranslation;
722 
723  unsigned int pos=0;
724  for(typename TImageType::Domain::ConstIterator it = image.domain().begin(), itend=image.domain().end();
725  it!=itend; ++it)
726  {
727  myTabImage[pos]= aFunctor(image(*it));
728  pos++;
729  }
730  }
731 
735  std::string className() const;
736 
737  private:
743  {};
744  };
745 
752 
753 
760 
761 
766 
771 
776 
781 
782 
783 
784  template <typename TDrawableWithViewer3D>
793  Viewer3D<Space, KSpace> & operator<< ( const TDrawableWithViewer3D & object );
794 
795 
796 
797  // ----------------------- Interface --------------------------------------
798  public:
799 
804  void selfDisplay ( std::ostream & out ) const;
805 
810  bool isValid() const;
811 
812 
813 
814  virtual unsigned int getCurrentDomainNumber();
815 
816  virtual unsigned int getCurrentGLImageNumber();
817 
818 
824  virtual void paintGL();
825 
826 
833  virtual void show();
834 
835 
841  void addTextureImage(const TextureImage &image);
842 
843 
856  template <typename TImageType, typename TFunctor>
857 
858  void updateTextureImage(unsigned int imageIndex, const TImageType & image, const TFunctor & aFunctor,
859  double xTranslation=0.0, double yTranslation=0.0, double zTranslation=0.0,
860  double rotationAngle=0.0, ImageDirection rotationDir=zDirection);
861 
862 
863 
864 
874  void updateOrientationTextureImage(unsigned int imageIndex,
875  double xPosition, double yPosition,
876  double zPosition, ImageDirection newDirection);
877 
878 
879 
888  void updateEmbeddingTextureImage(unsigned int anImageIndex,
889  typename Space::Point aPoint1, typename Space::Point aPoint2,
890  typename Space::Point aPoint3, typename Space::Point aPoint4);
891 
892 
893 
900  template<typename TDomain>
901  void addImage2DDomainD3D(const TDomain &anImageDomain, std::string mode,
902  const DGtal::Color &aColor=DGtal::Color::Red );
903 
904 
913  void updateAn2DDomainOrientation(unsigned int imageIndex,
914  double xPosition, double yPosition,
915  double zPosition, ImageDirection newDirection);
916 
924  void translateAn2DDomain(unsigned int domainIndex, double xTranslation,
925  double yTranslation, double zTranslation);
926 
933  std::vector<typename DGtal::Viewer3D< Space , KSpace >::LineD3D>
934  compute2DDomainLineRepresentation( Image2DDomainD3D &anImageDomain, double delta );
935 
941  std::vector<typename DGtal::Viewer3D< Space , KSpace >::LineD3D>
943 
944 
953  template < typename TContainer >
955  double angleRotation, ImageDirection dirRotation);
956 
957 
958 
967  void rotateDomain(Image2DDomainD3D &anDom, double angle, ImageDirection rotationDir);
968 
969 
970 
971 
972 
973 
974  // ------------------------- Protected Datas ------------------------------
975  private:
976 
977 
978 
979  public:
981  void drawSomeLight( GLenum light ) const
982  {
983  QGLViewer::drawLight( light );
984  }
986  void drawSomeLight( GLenum light, float zoom ) const
987  {
988  QGLViewer::drawLight( light, zoom );
989  }
990 
991  // ------------------------- Hidden services ------------------------------
992  // protected:
993 
1000  void updateList( bool needToUpdateBoundingBox = true );
1001 
1006  void glDrawGLBall( const typename Viewer3D<Space, KSpace>::BallD3D & aBall );
1007 
1025  virtual void keyPressEvent( QKeyEvent * e );
1026 
1032  virtual void mouseMoveEvent( QMouseEvent * e );
1033 
1039  virtual void mousePressEvent( QMouseEvent * e );
1040 
1046  virtual void mouseReleaseEvent( QMouseEvent * e );
1047 
1052  {
1053  qglviewer::Vec posCam;
1055  typename Viewer3D<Space, KSpace>::CubeD3D s2 )
1056  {
1057  double dist1 =
1058  sqrt( ( posCam.x - s1.center[ 0 ] ) * ( posCam.x - s1.center[ 0 ] ) +
1059  ( posCam.y - s1.center[ 1 ] ) * ( posCam.y - s1.center[ 1 ] ) +
1060  ( posCam.z - s1.center[ 2 ] ) * ( posCam.z - s1.center[ 2 ] ) );
1061  double dist2 =
1062  sqrt( ( posCam.x - s2.center[ 0 ] ) * ( posCam.x - s2.center[ 0 ] ) +
1063  ( posCam.y - s2.center[ 1 ] ) * ( posCam.y - s2.center[ 1 ] ) +
1064  ( posCam.z - s2.center[ 2 ] ) * ( posCam.z - s2.center[ 2 ] ) );
1065  return dist1 > dist2;
1066  }
1067  };
1068 
1069 
1074  {
1075  qglviewer::Vec posCam;
1078  {
1079  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 );
1080  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 );
1081  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 ) );
1082  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 ) );
1083 
1084  return dist1>dist2;
1085  }
1086  };
1087 
1092  {
1093  qglviewer::Vec posCam;
1095  typename Viewer3D<Space,KSpace>::QuadD3D q2 )
1096  {
1097 
1098  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 );
1099  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 );
1100 
1101  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 ) );
1102  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 ) );
1103  return dist1>dist2;
1104  }
1105  };
1106 
1111  {
1112  qglviewer::Vec posCam;
1115  {
1116  double c1x=0.0, c1y=0.0, c1z=0.0;
1117  double c2x=0.0, c2y=0.0, c2z=0.0;
1118  for(unsigned int i=0; i< q1.vertices.size(); i++){
1119  c1x+=q1.vertices.at(i)[0];
1120  c1y+=q1.vertices.at(i)[1];
1121  c1z+=q1.vertices.at(i)[2];
1122  }
1123  for(unsigned int i=0; i< q2.vertices.size(); i++){
1124  c2x+=q2.vertices.at(i)[0];
1125  c2y+=q2.vertices.at(i)[1];
1126  c2z+=q2.vertices.at(i)[2];
1127  }
1128 
1129  qglviewer::Vec center1 ( c1x/(double)q1.vertices.size(),c1y/(double)q1.vertices.size(), c1z/(double)q1.vertices.size() );
1130  qglviewer::Vec center2 ( c2x/(double)q2.vertices.size(),c2y/(double)q2.vertices.size(), c2z/(double)q2.vertices.size() );
1131 
1132  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 ) );
1133  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 ) );
1134  return dist1>dist2;
1135  }
1136  };
1137 
1138 
1139 
1143  virtual void drawWithNames();
1144 
1148  virtual void draw();
1149 
1153  virtual void init();
1154 
1158  virtual QString helpString() const;
1159 
1164  virtual void postSelection ( const QPoint& point );
1165 
1166 
1167 
1177  virtual QDomElement domElement(const QString& name, QDomDocument& document) const;
1178 
1179 
1190  virtual void initFromDOMElement(const QDomElement& element);
1191 
1192 
1200  protected: virtual void closeEvent ( QCloseEvent * e );
1201 
1202 
1203 
1204  // ------------------------- Internals ------------------------------------
1205  private:
1206 
1207 
1213  {
1219 
1221  unsigned int myImageWidth;
1222  unsigned int myImageHeight;
1223 
1224  unsigned int myBufferWidth;
1225  unsigned int myBufferHeight;
1228  unsigned char * myTextureImageBufferGS;
1229  unsigned char * myTextureImageBufferRGB;
1230  double vectNormal[3];
1231 
1232 
1233  // By definition in OpenGL the image size of texture should power of 2
1236 
1237 
1238  // Destructor
1240  {
1241  if(myMode== 1)
1242  {
1243  if(myTextureImageBufferGS!=0)
1244  delete [] myTextureImageBufferGS;
1245  }
1247  {
1249  delete [] myTextureImageBufferRGB;
1250  }
1251 
1252  }
1253 
1254  //Copy constructor from a GLTextureImage
1257  myTextureName(aGLImg.myTextureName),
1258  myMode(aGLImg.myMode),
1259  myTextureFitX(aGLImg.myTextureFitX),
1261 
1262  {
1263  point1[0]=aGLImg.point1[0]; point1[1]=aGLImg.point1[1]; point1[2]=aGLImg.point1[2];
1264  point2[0]=aGLImg.point2[0]; point2[1]=aGLImg.point2[1]; point2[2]=aGLImg.point2[2];
1265  point3[0]=aGLImg.point3[0]; point3[1]=aGLImg.point3[1]; point3[2]=aGLImg.point3[2];
1266  point4[0]=aGLImg.point4[0]; point4[1]=aGLImg.point4[1]; point4[2]=aGLImg.point4[2];
1268  myDirection = aGLImg.myDirection;
1269  vectNormal[0]=aGLImg.vectNormal[0];
1270  vectNormal[1]=aGLImg.vectNormal[1];
1271  vectNormal[2]=aGLImg.vectNormal[2];
1272 
1273  if(myMode== 1)
1274  {
1275  myTextureImageBufferGS = new unsigned char [myBufferHeight*myBufferWidth];
1276  for(unsigned int i=0; i<myBufferHeight*myBufferWidth;i++)
1277  {
1279  }
1281  {
1282  myTextureImageBufferRGB = new unsigned char [3*myBufferHeight*myBufferWidth];
1283  for(unsigned int i=0; i<3*myBufferHeight*myBufferWidth;i+=3)
1284  {
1288  }
1289  }
1290  }
1291 
1292 
1293  //Copy constructor from a TextureImage
1295  {
1296  point1[0]=aGSImage.point1[0]; point1[1]=aGSImage.point1[1]; point1[2]=aGSImage.point1[2];
1297  point2[0]=aGSImage.point2[0]; point2[1]=aGSImage.point2[1]; point2[2]=aGSImage.point2[2];
1298  point3[0]=aGSImage.point3[0]; point3[1]=aGSImage.point3[1]; point3[2]=aGSImage.point3[2];
1299  point4[0]=aGSImage.point4[0]; point4[1]=aGSImage.point4[1]; point4[2]=aGSImage.point4[2];
1300  myImageWidth=aGSImage.myImageWidth; myImageHeight=aGSImage.myImageHeight;
1301  myDirection = aGSImage.myDirection;
1302  myMode= aGSImage.myMode;
1307  RealPoint v1 = point2-point1;
1308  RealPoint v2 = point4-point1;
1309  vectNormal[0] = v1[1]*v2[2] - v1[2]*v2[1];
1310  vectNormal[1] = v1[2]*v2[0] - v1[0]*v2[2];
1311  vectNormal[2] = v1[0]*v2[1] - v1[1]*v2[0];
1312  double norm = sqrt(vectNormal[0]*vectNormal[0]+vectNormal[1]*vectNormal[1]+vectNormal[2]*vectNormal[2]);
1313  vectNormal[0] /=norm; vectNormal[1] /=norm; vectNormal[2] /=norm;
1314  }
1315 
1318 
1319  if(myMode== 1)
1320  {
1321  myTextureImageBufferGS = new unsigned char [myBufferHeight*myBufferWidth];
1322  unsigned int pos=0;
1323  for (unsigned int i=0; i<myBufferHeight; i++)
1324  {
1325  for (unsigned int j=0; j<myBufferWidth; j++)
1326  {
1327  if(i<myImageHeight && j< myImageWidth)
1328  {
1329  myTextureImageBufferGS[pos]= aGSImage.myTabImage[i*myImageWidth+j];
1330  }else{
1331  myTextureImageBufferGS[pos]=0;
1332  }
1333  pos++;
1334  }
1335  }
1337  {
1338  myTextureImageBufferRGB = new unsigned char [3*myBufferHeight*myBufferWidth];
1339  unsigned int pos=0;
1340  for (unsigned int i=0; i<myBufferHeight; i++)
1341  {
1342  for (unsigned int j=0; j<myBufferWidth; j++)
1343  {
1344  if(i<myImageHeight && j< myImageWidth)
1345  {
1346  DGtal::Color aCol(aGSImage.myTabImage[i*myImageWidth+j]);
1347  myTextureImageBufferRGB[pos]= aCol.red();
1348  myTextureImageBufferRGB[pos+1]= aCol.green();
1349  myTextureImageBufferRGB[pos+2]= aCol.blue();
1350  }else{
1351  myTextureImageBufferRGB[pos]=0;
1352  myTextureImageBufferRGB[pos+1]=0;
1353  myTextureImageBufferRGB[pos+2]=0;
1354  }
1355  pos+=3;
1356  }
1357  }
1358  }
1359 
1362  }
1363  };
1364 
1365 
1366 
1372  typedef typename std::vector<typename Viewer3D<Space, KSpace>::CubeD3D> VectorCubes;
1373  typedef typename std::vector<typename Viewer3D<Space, KSpace>::QuadD3D> VectorQuad;
1374  typedef typename std::vector<typename Viewer3D<Space, KSpace>::LineD3D> VectorLine;
1375  typedef typename std::vector<typename Viewer3D<Space, KSpace>::BallD3D> VectorBall;
1376  typedef typename std::vector<typename Viewer3D<Space, KSpace>::TriangleD3D> VectorTriangle;
1377  typedef typename std::vector<typename Viewer3D<Space, KSpace>::PolygonD3D> VectorPolygon;
1378  typedef typename std::vector<typename Viewer3D<Space, KSpace>::TextureImage> VectorTextureImage;
1379 
1380 
1381  typedef typename VectorCubes::iterator ItCube;
1382 
1383 
1393  void glCreateListCubesMaps(const typename Display3D<Space, KSpace>::CubesMap &aCubeMap, unsigned int idList);
1394 
1395 
1396 
1402  void glCreateListQuadD3D(const VectorQuad &aVectQuad, unsigned int idList);
1403 
1404 
1410  void glCreateListLines(const VectorLine &aVectLine, unsigned int idList);
1411 
1412 
1418  void glCreateListBalls(const VectorBall &aVectBall, unsigned int idList);
1419 
1420 
1430  void glCreateListQuadMaps(const typename Display3D<Space, KSpace>::QuadsMap &aQuadMap, unsigned int idList);
1431 
1432 
1442  void glCreateListQuadMapsWired(const typename Display3D<Space, KSpace>::QuadsMap &aQuadMap, unsigned int idList);
1443 
1444 
1453  void glCreateListTriangles(const std::vector<VectorTriangle> &aVectTriangle, unsigned int idList);
1454 
1455 
1464  void glCreateListTrianglesWired(const std::vector<VectorTriangle> &aVectTriangle, unsigned int idList);
1465 
1466 
1475  void glCreateListPolygons(const std::vector<VectorPolygon> &aVectPolygon, unsigned int idList);
1476 
1477 
1486  void glCreateListPolygonsWired(const std::vector<VectorPolygon> &aVectPolygon, unsigned int idList);
1487 
1488 
1495 
1496 
1504 
1510 
1518 
1526 
1527 
1528 
1529  public:
1541  template<typename TImageORDomain>
1542  static
1543  void
1544  rotateImageVertex(TImageORDomain &anImageOrDom, double angle, ImageDirection rotationDir){
1545  double xB = (anImageOrDom.point1[0]+anImageOrDom.point2[0]+anImageOrDom.point3[0]+anImageOrDom.point4[0])/4.0;
1546  double yB = (anImageOrDom.point1[1]+anImageOrDom.point2[1]+anImageOrDom.point3[1]+anImageOrDom.point4[1])/4.0;
1547  double zB = (anImageOrDom.point1[2]+anImageOrDom.point2[2]+anImageOrDom.point3[2]+anImageOrDom.point4[2])/4.0;
1548  rotatePoint( anImageOrDom.point1[0], anImageOrDom.point1[1], anImageOrDom.point1[2], xB, yB, zB, angle, rotationDir);
1549  rotatePoint( anImageOrDom.point2[0], anImageOrDom.point2[1], anImageOrDom.point2[2], xB, yB, zB, angle, rotationDir);
1550  rotatePoint( anImageOrDom.point3[0], anImageOrDom.point3[1], anImageOrDom.point3[2], xB, yB, zB, angle, rotationDir);
1551  rotatePoint( anImageOrDom.point4[0], anImageOrDom.point4[1], anImageOrDom.point4[2], xB, yB, zB, angle, rotationDir);
1552 
1553  }
1554 
1568  template <typename TValues>
1569  static
1570  void rotatePoint(TValues &x, TValues &y, TValues &z,
1571  double cx, double cy, double cz,
1572  double rotationAngle, ImageDirection rotationDir);
1573 
1574 
1575 
1576 
1577 
1578  // ------------------------- Private Datas --------------------------------
1579  private:
1580 
1582  //GLuint myListToAff;
1583 
1586 
1589 
1593 
1596 
1599 
1601 
1602  unsigned int myNbListe;
1603  unsigned int myNbLineSetList;
1604  unsigned int myNbBallSetList;
1605  unsigned int myNbPrismSetList;
1606 
1609  unsigned char mySelectionColorShift = 150;
1610 
1616  std::vector<GLTextureImage> myVectTextureImage;
1617 
1619 
1620  double camera_position[3];
1621  double camera_direction[3];
1622  double camera_upVector[3];
1623 
1624  bool myLightPositionFixToCamera = true; // when false the light position is fix according to the scene.
1625  double myLightTheta;
1626  double myLightPhi;
1627  double myLightR;
1628  GLfloat myLightPosition [4] = {0.0f, 0.0f, 1.0f, 1.0f}; // the light position in cartesian coordinate
1629  GLfloat myLightPositionRefCameraDefault [3] = {-100.0f, 100.0f, 0.0f}; // the light default position according to the camera position
1630  GLfloat myLightPositionRefCamera [3] = {0.0f, 0.0f, 0.0f}; // the light position according to the camera position
1631  GLfloat myMaterialShininessCoeff[1] = {50.0f} ; // the material shininess coefficient used in opengl rendering
1632  GLfloat myMaterialSpecularCoeffs[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; // the light specular coefficients used in opengl rendering
1633  GLfloat myLightSpecularCoeffs[4] = { 0.3f, 0.3f, 0.3f, 1.0f }; // the light specular coefficients used in opengl rendering
1634  GLfloat myLightAmbientCoeffs[4] = { 0.0f, 0.0f, 0.0f, 1.0f }; // the material ambient coefficients used in opengl rendering
1635  GLfloat myLightDiffuseCoeffs[4] = { 0.7f, 0.7f, 0.7f, 1.0f }; // the material diffuse coefficients used in opengl rendering
1636 
1637  const GLfloat myDefaultRenderSpec = 0.3f; // default specular coefficients for default mode rendering
1638  const GLfloat myDefaultRenderDiff = 0.7f; // default diffuse coefficients for metallic mode rendering
1639  const GLfloat myLambertRenderSpec = 0.0f; // default specular coefficients for default mode rendering
1640  const GLfloat myLambertRenderDiff = 0.9f; // default diffuse coefficients for metallic mode rendering
1641  const GLfloat myMetallicRenderSpec = 0.5f; // default specular coefficients for metallic mode rendering
1642  const GLfloat myMetallicRenderDiff = 0.5f; // default diffuse coefficients for metallic mode rendering
1643  const GLfloat myPlasticRenderSpec = 0.8f; // default specular coefficients for platic mode rendering
1644  const GLfloat myPlasticRenderDiff = 0.2f; // default diffuse coefficients for platic mode rendering
1645 
1646  bool myUseGLPointsForBalls = false; // to display balls with GL points (instead real ball)
1647 
1648  double ZNear;
1649  double ZFar;
1650 
1651  //the default width of the mesh line
1653 
1654  // To apply openGL ajustment only on visualisation
1655  float myGLScaleFactorX=1.0;
1656  float myGLScaleFactorY=1.0;
1657  float myGLScaleFactorZ=1.0;
1658 
1659  // Used to apply interactive light rotation
1664 
1666  std::vector<TextureImage> myGSImageList;
1668  std::vector<Image2DDomainD3D> myImageDomainList;
1671 
1672  }; // end of class Viewer3D
1673 
1674  template <typename TSpace, typename TKSpace>
1681  std::ostream & operator<<( std::ostream & out,
1682  const Viewer3D<TSpace, TKSpace> & object );
1683 } // namespace DGtal
1684 
1685 
1687 // Includes inline functions.
1688 #include "DGtal/io/viewers/Viewer3D.ih"
1689 
1690 // //
1692 
1693 #endif // !defined Viewer3D_h
1694 
1695 #undef Viewer3D_RECURSES
1696 #endif // else defined(Viewer3D_RECURSES)
Structure representing an RGB triple with alpha component.
Definition: Color.h:67
void green(const unsigned char aGreenValue)
void red(const unsigned char aRedValue)
static const Color Red
Definition: Color.h:392
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:1612
void glCreateListPolygonsWired(const std::vector< VectorPolygon > &aVectPolygon, unsigned int idList)
bool myIsBackgroundDefault
true if the background is default
Definition: Viewer3D.h:483
unsigned int myNbLineSetList
Definition: Viewer3D.h:1603
bool myViewWire
objects have shadows which follow the camera if false
Definition: Viewer3D.h:485
void drawSomeLight(GLenum light) const
To call the protected method drawLight.
Definition: Viewer3D.h:981
GLuint myTriangleSetListId
lists of the list to draw
Definition: Viewer3D.h:1584
virtual QString helpString() const
void setCameraPosition(double ax, double ay, double az)
Definition: Viewer3D.h:338
float myGLScaleFactorY
Definition: Viewer3D.h:1656
Viewer3D< Space, KSpace > & operator<<(const DGtal::Color &aColor)
qglviewer::Vec myDir
Definition: Viewer3D.h:1612
const GLfloat myLambertRenderSpec
Definition: Viewer3D.h:1639
virtual void mouseMoveEvent(QMouseEvent *e)
const GLfloat myPlasticRenderSpec
Definition: Viewer3D.h:1643
float myGLScaleFactorX
Definition: Viewer3D.h:1655
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:1622
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:1625
void sortQuadFromCamera()
void glCreateListQuadMapsWired(const typename Display3D< Space, KSpace >::QuadsMap &aQuadMap, unsigned int idList)
GLfloat myLightSpecularCoeffs[4]
Definition: Viewer3D.h:1633
GLfloat myLightDiffuseCoeffs[4]
Definition: Viewer3D.h:1635
bool myIsDoubleFaceRendering
true if is double face rendering
Definition: Viewer3D.h:1618
void setExtension(Extension *ext)
Definition: Viewer3D.h:316
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:481
GLuint myPrismListId
Definition: Viewer3D.h:1592
bool myLightPositionFixToCamera
Definition: Viewer3D.h:1624
GLuint myBallSetListId
Definition: Viewer3D.h:1591
void setCameraDirection(double ax, double ay, double az)
Definition: Viewer3D.h:349
void setGLLightDiffuseCoefficients(const GLfloat lightDiffuseCoeffs[4])
qglviewer::Vec myOrig
information linked to the navigation in the viewer
Definition: Viewer3D.h:1612
bool myAutoSaveState
flag to save automatically or not the Viewer3d state when closing the viewer
Definition: Viewer3D.h:489
GLfloat myLightPositionRefCameraDefault[3]
Definition: Viewer3D.h:1629
virtual void init()
init
int myRefMouseXPos
the angle rotation increment used for interactive light move
Definition: Viewer3D.h:1661
void setNearFar(double _near, double _far)
Definition: Viewer3D.h:370
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:1660
GLfloat myLightAmbientCoeffs[4]
Definition: Viewer3D.h:1634
std::vector< GLTextureImage > myVectTextureImage
list of the images textures in this viewer
Definition: Viewer3D.h:1616
float myMeshDefaultLineWidth
Definition: Viewer3D.h:1652
unsigned char mySelectionColorShift
Definition: Viewer3D.h:1609
VectorCubes::iterator ItCube
Definition: Viewer3D.h:1381
void translateAn2DDomain(unsigned int domainIndex, double xTranslation, double yTranslation, double zTranslation)
bool isValid() const
GLuint myPolygonSetListWiredId
Definition: Viewer3D.h:1588
static void rotateImageVertex(TImageORDomain &anImageOrDom, double angle, ImageDirection rotationDir)
Definition: Viewer3D.h:1544
std::vector< typename Viewer3D< Space, KSpace >::TriangleD3D > VectorTriangle
Definition: Viewer3D.h:1376
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:476
void drawSomeLight(GLenum light, float zoom) const
To call the protected method drawLight.
Definition: Viewer3D.h:986
void glCreateListPolygons(const std::vector< VectorPolygon > &aVectPolygon, unsigned int idList)
void selfDisplay(std::ostream &out) const
qglviewer::Vec mySelectedPoint
Definition: Viewer3D.h:1612
std::vector< typename Viewer3D< Space, KSpace >::BallD3D > VectorBall
Definition: Viewer3D.h:1375
Viewer3D(const KSpace &KSEmb)
Definition: Viewer3D.h:307
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:1372
double myLightR
the light position (azimuth)
Definition: Viewer3D.h:1627
RenderingMode myRenderingMode
Definition: Viewer3D.h:491
const GLfloat myMetallicRenderDiff
Definition: Viewer3D.h:1642
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:1374
void removeExtension()
Definition: Viewer3D.h:325
GLfloat myMaterialSpecularCoeffs[4]
Definition: Viewer3D.h:1632
GLuint myQuadsMapWiredId
Definition: Viewer3D.h:1595
std::vector< Image2DDomainD3D > myImageDomainList
Used to store all the domains.
Definition: Viewer3D.h:1668
void updateRenderingCoefficients(const RenderingMode aRenderMode, bool displayState=true)
std::vector< typename Viewer3D< Space, KSpace >::PolygonD3D > VectorPolygon
Definition: Viewer3D.h:1377
double myGLPointMinWidth
Definition: Viewer3D.h:486
bool myIsMovingLight
the reference mouse y-position used to determince the light position change (inclination)
Definition: Viewer3D.h:1663
std::vector< typename Viewer3D< Space, KSpace >::QuadD3D > VectorQuad
Definition: Viewer3D.h:1373
QPoint myPosSelector
a point selected with postSelection
Definition: Viewer3D.h:1614
void updateRelativeCameraFromLightPosition()
Display::RealPoint RealPoint
Definition: Viewer3D.h:149
unsigned int myNbBallSetList
Definition: Viewer3D.h:1604
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:1587
const GLfloat myPlasticRenderDiff
Definition: Viewer3D.h:1644
const GLfloat myDefaultRenderDiff
Definition: Viewer3D.h:1638
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:1641
virtual void draw()
draw
double myGLLineMinWidth
to improve the display of gl points
Definition: Viewer3D.h:487
void glCreateListCubesMaps(const typename Display3D< Space, KSpace >::CubesMap &aCubeMap, unsigned int idList)
GLuint myLineSetListId
Definition: Viewer3D.h:1590
GLuint myCubesMapId
Definition: Viewer3D.h:1597
void setGLLightSpecularCoefficients(const GLfloat lightSpecularCoeffs[4])
int myRefMouseYPos
the reference mouse x-position used to determince the light position change (azimuth)
Definition: Viewer3D.h:1662
std::vector< typename Viewer3D< Space, KSpace >::TextureImage > VectorTextureImage
Definition: Viewer3D.h:1378
GLuint myCubeSetListWiredId
Definition: Viewer3D.h:1598
int mySelectedElementId
used to displayed selected elements
Definition: Viewer3D.h:1608
void setGLScale(float sx, float sy, float sz)
Definition: Viewer3D.h:384
void glCreateListBalls(const VectorBall &aVectBall, unsigned int idList)
unsigned int myNbPrismSetList
Definition: Viewer3D.h:1605
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:1631
TSpace Space
Definition: Viewer3D.h:144
const GLfloat myLambertRenderDiff
Definition: Viewer3D.h:1640
BOOST_CONCEPT_ASSERT((concepts::CSpace< TSpace >))
DGtal::Color myDefaultBackgroundColor
the default background color of the viewer
Definition: Viewer3D.h:479
void sortTriangleFromCamera()
void updateList(bool needToUpdateBoundingBox=true)
Display::SelectCallbackFct SelectCallbackFct
Definition: Viewer3D.h:148
void glUpdateLightRenderingMode() const
ImageDirection
the 3 possible axes for the image direction
Definition: Viewer3D.h:474
Display3D< Space, KSpace > Display
Definition: Viewer3D.h:147
bool myUseGLPointsForBalls
Definition: Viewer3D.h:1646
unsigned int myNbListe
number of lists in myListToAff
Definition: Viewer3D.h:1602
GLuint myTriangleSetListWiredId
Definition: Viewer3D.h:1585
virtual void drawWithNames()
drawWithNames
GLuint myQuadsMapId
Definition: Viewer3D.h:1594
void addTextureImage(const TextureImage &image)
GLfloat myLightPosition[4]
the light position (distance)
Definition: Viewer3D.h:1628
void setUseGLPointForBalls(bool useOpenGLPt)
double ZFar
zfar distance
Definition: Viewer3D.h:1649
void addImage2DDomainD3D(const TDomain &anImageDomain, std::string mode, const DGtal::Color &aColor=DGtal::Color::Red)
double myLightPhi
the light position (inclination)
Definition: Viewer3D.h:1626
double camera_position[3]
camera position
Definition: Viewer3D.h:1620
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:1648
void glCreateListQuadD3D(const VectorQuad &aVectQuad, unsigned int idList)
float myGLScaleFactorZ
Definition: Viewer3D.h:1657
Viewer3D< Space, KSpace > Self
Definition: Viewer3D.h:146
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:145
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:1621
void setGLDoubleRenderingMode(bool doubleSidedRendering)
GLfloat myLightPositionRefCamera[3]
Definition: Viewer3D.h:1630
void setCameraUpVector(double ax, double ay, double az)
Definition: Viewer3D.h:360
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:1637
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:1666
Extension * myExtension
Stored a possible extension to the viewer (pointer owned).
Definition: Viewer3D.h:1670
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 ClosedIntegerHalfPlane< TSpace > &object)
bool operator()(typename Viewer3D< Space, KSpace >::PolygonD3D q1, typename Viewer3D< Space, KSpace >::PolygonD3D q2)
Definition: Viewer3D.h:1113
bool operator()(typename Viewer3D< Space, KSpace >::QuadD3D q1, typename Viewer3D< Space, KSpace >::QuadD3D q2)
Definition: Viewer3D.h:1094
bool operator()(typename Viewer3D< Space, KSpace >::TriangleD3D t1, typename Viewer3D< Space, KSpace >::TriangleD3D t2)
Definition: Viewer3D.h:1076
bool operator()(typename Viewer3D< Space, KSpace >::CubeD3D s1, typename Viewer3D< Space, KSpace >::CubeD3D s2)
Definition: Viewer3D.h:1054
virtual bool mouseMoveEvent(const Viewer &viewer, QMouseEvent *event)
Definition: Viewer3D.h:253
virtual ~Extension()=default
virtual QString helpString(const Viewer &viewer) const
Definition: Viewer3D.h:223
virtual void draw(Viewer &viewer)
Definition: Viewer3D.h:203
virtual bool mouseReleaseEvent(const Viewer &viewer, QMouseEvent *event)
Definition: Viewer3D.h:284
virtual bool mousePressEvent(const Viewer &viewer, QMouseEvent *event)
Definition: Viewer3D.h:268
virtual bool postSelection(const Viewer &viewer, const QPoint &point)
Definition: Viewer3D.h:238
virtual void drawWithNames(Viewer &viewer)
Definition: Viewer3D.h:193
virtual void init(Viewer &viewer)
Definition: Viewer3D.h:212
virtual bool keyPressEvent(Viewer &viewer, QKeyEvent *event)
Definition: Viewer3D.h:181
Viewer3D< Space, KSpace > Viewer
The associated viewer.
Definition: Viewer3D.h:169
Viewer3D< Space, KSpace >::ImageDirection myDirection
Definition: Viewer3D.h:1220
unsigned char * myTextureImageBufferGS
Definition: Viewer3D.h:1228
GLTextureImage(const GLTextureImage &aGLImg)
Definition: Viewer3D.h:1255
GLTextureImage(const typename Viewer3D< Space, KSpace >::TextureImage &aGSImage)
Definition: Viewer3D.h:1294
unsigned char * myTextureImageBufferRGB
Definition: Viewer3D.h:1229
Viewer3D< Space, KSpace >::TextureMode myMode
Definition: Viewer3D.h:1227
RealPoint point1
coordinates
Definition: Viewer3D.h:1215
unsigned int myDomainWidth
the width of the image domain
Definition: Viewer3D.h:508
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:528
unsigned int myDomainHeight
the height of the image domain
Definition: Viewer3D.h:510
ImageDirection myDirection
the direction of the domain (x, y or z axe)
Definition: Viewer3D.h:512
DGtal::Color color
The image domain color.
Definition: Viewer3D.h:506
std::size_t myLineSetIndex
the index of the line of the domain in the lineSetList of the viewer
Definition: Viewer3D.h:516
void translateDomain(double xTranslation=0.0, double yTranslation=0.0, double zTranslation=0.0)
RealPoint point1
The image domain coordinates.
Definition: Viewer3D.h:501
std::string myMode
the mode of representation of the image domain
Definition: Viewer3D.h:514
void updateDomainOrientation(ImageDirection normalDir, double xBottomLeft, double yBottomLeft, double zBottomLeft)
unsigned int myImageHeight
the width of the image
Definition: Viewer3D.h:580
void updateImageOrientation(ImageDirection normalDir, double xBottomLeft, double yBottomLeft, double zBottomLeft)
unsigned int * myTabImage
the height of the image
Definition: Viewer3D.h:582
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:646
bool myDrawDomain
for each pixel of the image, color or height ?
Definition: Viewer3D.h:584
ImageDirection myDirection
Definition: Viewer3D.h:577
~TextureImage()
the mode of representation of the image
Definition: Viewer3D.h:591
TextureMode myMode
index of the image domain if exist
Definition: Viewer3D.h:586
TextureImage(const TextureImage &img)
Copy constructor (needed due to myTabImage)
Definition: Viewer3D.h:600
void updateImageDataAndParam(const TImageType &image, const TFunctor &aFunctor, double xTranslation=0.0, double yTranslation=0.0, double zTranslation=0.0)
Definition: Viewer3D.h:710
unsigned int myImageWidth
direction of the image (x, y or z axe)
Definition: Viewer3D.h:579
std::string className() const
unsigned int myIndexDomain
true if the draw have a domain
Definition: Viewer3D.h:585
void updateImage3DEmbedding(RealPoint aPoint1, RealPoint aPoint2, RealPoint aPoint3, RealPoint aPoint4)
Definition: Viewer3D.h:684
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)