DGtal 1.4.2
Loading...
Searching...
No Matches
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
78namespace 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;
147
155
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
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 {
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 {
527 BOOST_CONCEPT_ASSERT(( concepts::CDomain < TDomain >));
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),
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,
646 {
647 BOOST_CONCEPT_ASSERT(( concepts::CConstImage < TImageType > ));
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;
686 myDirection=undefDirection;
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 {
709 BOOST_CONCEPT_ASSERT(( concepts::CConstImage < TImageType > ));
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
776 void sortPolygonFromCamera();
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>
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
971 void setLightModeFixToCamera(bool fixedToCam, bool verbose = true)
972 {
973 myLightPositionFixToCamera = fixedToCam;
974 updateLightCoordsFromCamera();
975 if(myLightPositionFixToCamera)
976 {
977 if (verbose)
978 {
979 displayMessage(QString("Light source position fixed to camera."), 3000);
980 }
981 updateRelativeCameraFromLightPosition();
982 }
983 else if (verbose)
984 {
985 {
986 displayMessage(QString("Light source position fixed to main scene."), 3000);
987 }
988 update();
989 }
990 };
991
992
993 // ------------------------- Protected Datas ------------------------------
994 private:
995
996
997
998 public:
1000 void drawSomeLight( GLenum light ) const
1001 {
1002 QGLViewer::drawLight( light );
1003 }
1005 void drawSomeLight( GLenum light, float zoom ) const
1006 {
1007 QGLViewer::drawLight( light, zoom );
1008 }
1009
1010 // ------------------------- Hidden services ------------------------------
1011 // protected:
1012
1019 void updateList( bool needToUpdateBoundingBox = true );
1020
1025 void glDrawGLBall( const typename Viewer3D<Space, KSpace>::BallD3D & aBall );
1026
1044 virtual void keyPressEvent( QKeyEvent * e );
1045
1051 virtual void mouseMoveEvent( QMouseEvent * e );
1052
1058 virtual void mousePressEvent( QMouseEvent * e );
1059
1065 virtual void mouseReleaseEvent( QMouseEvent * e );
1066
1071 {
1072 qglviewer::Vec posCam;
1075 {
1076 double dist1 =
1077 sqrt( ( posCam.x - s1.center[ 0 ] ) * ( posCam.x - s1.center[ 0 ] ) +
1078 ( posCam.y - s1.center[ 1 ] ) * ( posCam.y - s1.center[ 1 ] ) +
1079 ( posCam.z - s1.center[ 2 ] ) * ( posCam.z - s1.center[ 2 ] ) );
1080 double dist2 =
1081 sqrt( ( posCam.x - s2.center[ 0 ] ) * ( posCam.x - s2.center[ 0 ] ) +
1082 ( posCam.y - s2.center[ 1 ] ) * ( posCam.y - s2.center[ 1 ] ) +
1083 ( posCam.z - s2.center[ 2 ] ) * ( posCam.z - s2.center[ 2 ] ) );
1084 return dist1 > dist2;
1085 }
1086 };
1087
1088
1093 {
1094 qglviewer::Vec posCam;
1095 bool operator() ( typename Viewer3D<Space,KSpace>::TriangleD3D t1,
1097 {
1098 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 );
1099 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 );
1100 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 ) );
1101 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 ) );
1102
1103 return dist1>dist2;
1104 }
1105 };
1106
1111 {
1112 qglviewer::Vec posCam;
1113 bool operator() (typename Viewer3D<Space,KSpace>::QuadD3D q1,
1115 {
1116
1117 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 );
1118 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 );
1119
1120 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 ) );
1121 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 ) );
1122 return dist1>dist2;
1123 }
1124 };
1125
1130 {
1131 qglviewer::Vec posCam;
1132 bool operator() ( typename Viewer3D<Space,KSpace>::PolygonD3D q1,
1134 {
1135 double c1x=0.0, c1y=0.0, c1z=0.0;
1136 double c2x=0.0, c2y=0.0, c2z=0.0;
1137 for(unsigned int i=0; i< q1.vertices.size(); i++){
1138 c1x+=q1.vertices.at(i)[0];
1139 c1y+=q1.vertices.at(i)[1];
1140 c1z+=q1.vertices.at(i)[2];
1141 }
1142 for(unsigned int i=0; i< q2.vertices.size(); i++){
1143 c2x+=q2.vertices.at(i)[0];
1144 c2y+=q2.vertices.at(i)[1];
1145 c2z+=q2.vertices.at(i)[2];
1146 }
1147
1148 qglviewer::Vec center1 ( c1x/(double)q1.vertices.size(),c1y/(double)q1.vertices.size(), c1z/(double)q1.vertices.size() );
1149 qglviewer::Vec center2 ( c2x/(double)q2.vertices.size(),c2y/(double)q2.vertices.size(), c2z/(double)q2.vertices.size() );
1150
1151 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 ) );
1152 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 ) );
1153 return dist1>dist2;
1154 }
1155 };
1156
1157
1158
1162 virtual void drawWithNames();
1163
1167 virtual void draw();
1168
1172 virtual void init();
1173
1177 virtual QString helpString() const;
1178
1183 virtual void postSelection ( const QPoint& point );
1184
1185
1186
1196 virtual QDomElement domElement(const QString& name, QDomDocument& document) const;
1197
1198
1209 virtual void initFromDOMElement(const QDomElement& element);
1210
1211
1219 protected: virtual void closeEvent ( QCloseEvent * e );
1220
1221
1222
1223 // ------------------------- Internals ------------------------------------
1224 private:
1225
1226
1232 {
1238
1240 unsigned int myImageWidth;
1241 unsigned int myImageHeight;
1242
1243 unsigned int myBufferWidth;
1244 unsigned int myBufferHeight;
1247 unsigned char * myTextureImageBufferGS;
1249 double vectNormal[3];
1250
1251
1252 // By definition in OpenGL the image size of texture should power of 2
1255
1256
1257 // Destructor
1259 {
1260 if(myMode== 1)
1261 {
1262 if(myTextureImageBufferGS!=0)
1263 delete [] myTextureImageBufferGS;
1264 }
1266 {
1267 if(myTextureImageBufferRGB!=0)
1268 delete [] myTextureImageBufferRGB;
1269 }
1270
1271 }
1272
1273 //Copy constructor from a GLTextureImage
1274 GLTextureImage(const GLTextureImage &aGLImg): myBufferWidth(aGLImg.myBufferWidth),
1275 myBufferHeight(aGLImg.myBufferHeight),
1276 myTextureName(aGLImg.myTextureName),
1277 myMode(aGLImg.myMode),
1278 myTextureFitX(aGLImg.myTextureFitX),
1279 myTextureFitY(aGLImg.myTextureFitY)
1280
1281 {
1282 point1[0]=aGLImg.point1[0]; point1[1]=aGLImg.point1[1]; point1[2]=aGLImg.point1[2];
1283 point2[0]=aGLImg.point2[0]; point2[1]=aGLImg.point2[1]; point2[2]=aGLImg.point2[2];
1284 point3[0]=aGLImg.point3[0]; point3[1]=aGLImg.point3[1]; point3[2]=aGLImg.point3[2];
1285 point4[0]=aGLImg.point4[0]; point4[1]=aGLImg.point4[1]; point4[2]=aGLImg.point4[2];
1286 myImageWidth=aGLImg.myImageWidth; myImageHeight=aGLImg.myImageHeight;
1287 myDirection = aGLImg.myDirection;
1288 vectNormal[0]=aGLImg.vectNormal[0];
1289 vectNormal[1]=aGLImg.vectNormal[1];
1290 vectNormal[2]=aGLImg.vectNormal[2];
1291
1292 if(myMode== 1)
1293 {
1294 myTextureImageBufferGS = new unsigned char [myBufferHeight*myBufferWidth];
1295 for(unsigned int i=0; i<myBufferHeight*myBufferWidth;i++)
1296 {
1297 myTextureImageBufferGS[i]=aGLImg.myTextureImageBufferGS[i];
1298 }
1299 }else if(myMode==Viewer3D<Space, KSpace>::RGBMode)
1300 {
1301 myTextureImageBufferRGB = new unsigned char [3*myBufferHeight*myBufferWidth];
1302 for(unsigned int i=0; i<3*myBufferHeight*myBufferWidth;i+=3)
1303 {
1304 myTextureImageBufferRGB[i]=aGLImg.myTextureImageBufferRGB[i];
1305 myTextureImageBufferRGB[i+1]=aGLImg.myTextureImageBufferRGB[i+1];
1306 myTextureImageBufferRGB[i+2]=aGLImg.myTextureImageBufferRGB[i+2];
1307 }
1308 }
1309 }
1310
1311
1312 //Copy constructor from a TextureImage
1314 {
1315 point1[0]=aGSImage.point1[0]; point1[1]=aGSImage.point1[1]; point1[2]=aGSImage.point1[2];
1316 point2[0]=aGSImage.point2[0]; point2[1]=aGSImage.point2[1]; point2[2]=aGSImage.point2[2];
1317 point3[0]=aGSImage.point3[0]; point3[1]=aGSImage.point3[1]; point3[2]=aGSImage.point3[2];
1318 point4[0]=aGSImage.point4[0]; point4[1]=aGSImage.point4[1]; point4[2]=aGSImage.point4[2];
1319 myImageWidth=aGSImage.myImageWidth; myImageHeight=aGSImage.myImageHeight;
1320 myDirection = aGSImage.myDirection;
1321 myMode= aGSImage.myMode;
1322 vectNormal[0]= (myDirection == Viewer3D<Space, KSpace>::xDirection)? 1.0: 0.0;
1323 vectNormal[1]= (myDirection == Viewer3D<Space, KSpace>::yDirection)? -1.0: 0.0;
1324 vectNormal[2]= (myDirection == Viewer3D<Space, KSpace>::zDirection)? 1.0: 0.0;
1325 if(myDirection==undefDirection){
1326 RealPoint v1 = point2-point1;
1327 RealPoint v2 = point4-point1;
1328 vectNormal[0] = v1[1]*v2[2] - v1[2]*v2[1];
1329 vectNormal[1] = v1[2]*v2[0] - v1[0]*v2[2];
1330 vectNormal[2] = v1[0]*v2[1] - v1[1]*v2[0];
1331 double norm = sqrt(vectNormal[0]*vectNormal[0]+vectNormal[1]*vectNormal[1]+vectNormal[2]*vectNormal[2]);
1332 vectNormal[0] /=norm; vectNormal[1] /=norm; vectNormal[2] /=norm;
1333 }
1334
1335 myBufferWidth = functions::roundToUpperPowerOfTwo(myImageWidth);
1336 myBufferHeight = functions::roundToUpperPowerOfTwo(myImageHeight);
1337
1338 if(myMode== 1)
1339 {
1340 myTextureImageBufferGS = new unsigned char [myBufferHeight*myBufferWidth];
1341 unsigned int pos=0;
1342 for (unsigned int i=0; i<myBufferHeight; i++)
1343 {
1344 for (unsigned int j=0; j<myBufferWidth; j++)
1345 {
1346 if(i<myImageHeight && j< myImageWidth)
1347 {
1348 myTextureImageBufferGS[pos]= aGSImage.myTabImage[i*myImageWidth+j];
1349 }else{
1350 myTextureImageBufferGS[pos]=0;
1351 }
1352 pos++;
1353 }
1354 }
1355 }else if(myMode==Viewer3D<Space, KSpace>::RGBMode)
1356 {
1357 myTextureImageBufferRGB = new unsigned char [3*myBufferHeight*myBufferWidth];
1358 unsigned int pos=0;
1359 for (unsigned int i=0; i<myBufferHeight; i++)
1360 {
1361 for (unsigned int j=0; j<myBufferWidth; j++)
1362 {
1363 if(i<myImageHeight && j< myImageWidth)
1364 {
1365 DGtal::Color aCol(aGSImage.myTabImage[i*myImageWidth+j]);
1366 myTextureImageBufferRGB[pos]= aCol.red();
1367 myTextureImageBufferRGB[pos+1]= aCol.green();
1368 myTextureImageBufferRGB[pos+2]= aCol.blue();
1369 }else{
1370 myTextureImageBufferRGB[pos]=0;
1371 myTextureImageBufferRGB[pos+1]=0;
1372 myTextureImageBufferRGB[pos+2]=0;
1373 }
1374 pos+=3;
1375 }
1376 }
1377 }
1378
1379 myTextureFitX = 1.0-((myBufferWidth-myImageWidth)/(double)myBufferWidth);
1380 myTextureFitY = 1.0-((myBufferHeight-myImageHeight)/(double)myBufferHeight);
1381 }
1382 };
1383
1384
1385
1391 typedef typename std::vector<typename Viewer3D<Space, KSpace>::CubeD3D> VectorCubes;
1392 typedef typename std::vector<typename Viewer3D<Space, KSpace>::QuadD3D> VectorQuad;
1393 typedef typename std::vector<typename Viewer3D<Space, KSpace>::LineD3D> VectorLine;
1394 typedef typename std::vector<typename Viewer3D<Space, KSpace>::BallD3D> VectorBall;
1395 typedef typename std::vector<typename Viewer3D<Space, KSpace>::TriangleD3D> VectorTriangle;
1396 typedef typename std::vector<typename Viewer3D<Space, KSpace>::PolygonD3D> VectorPolygon;
1397 typedef typename std::vector<typename Viewer3D<Space, KSpace>::TextureImage> VectorTextureImage;
1398
1399
1400 typedef typename VectorCubes::iterator ItCube;
1401
1402
1412 void glCreateListCubesMaps(const typename Display3D<Space, KSpace>::CubesMap &aCubeMap, unsigned int idList);
1413
1414
1415
1421 void glCreateListQuadD3D(const VectorQuad &aVectQuad, unsigned int idList);
1422
1423
1429 void glCreateListLines(const VectorLine &aVectLine, unsigned int idList);
1430
1431
1437 void glCreateListBalls(const VectorBall &aVectBall, unsigned int idList);
1438
1439
1449 void glCreateListQuadMaps(const typename Display3D<Space, KSpace>::QuadsMap &aQuadMap, unsigned int idList);
1450
1451
1461 void glCreateListQuadMapsWired(const typename Display3D<Space, KSpace>::QuadsMap &aQuadMap, unsigned int idList);
1462
1463
1472 void glCreateListTriangles(const std::vector<VectorTriangle> &aVectTriangle, unsigned int idList);
1473
1474
1483 void glCreateListTrianglesWired(const std::vector<VectorTriangle> &aVectTriangle, unsigned int idList);
1484
1485
1494 void glCreateListPolygons(const std::vector<VectorPolygon> &aVectPolygon, unsigned int idList);
1495
1496
1505 void glCreateListPolygonsWired(const std::vector<VectorPolygon> &aVectPolygon, unsigned int idList);
1506
1507
1514
1515
1523
1529
1537
1545
1546
1547
1548 public:
1560 template<typename TImageORDomain>
1561 static
1562 void
1563 rotateImageVertex(TImageORDomain &anImageOrDom, double angle, ImageDirection rotationDir){
1564 double xB = (anImageOrDom.point1[0]+anImageOrDom.point2[0]+anImageOrDom.point3[0]+anImageOrDom.point4[0])/4.0;
1565 double yB = (anImageOrDom.point1[1]+anImageOrDom.point2[1]+anImageOrDom.point3[1]+anImageOrDom.point4[1])/4.0;
1566 double zB = (anImageOrDom.point1[2]+anImageOrDom.point2[2]+anImageOrDom.point3[2]+anImageOrDom.point4[2])/4.0;
1567 rotatePoint( anImageOrDom.point1[0], anImageOrDom.point1[1], anImageOrDom.point1[2], xB, yB, zB, angle, rotationDir);
1568 rotatePoint( anImageOrDom.point2[0], anImageOrDom.point2[1], anImageOrDom.point2[2], xB, yB, zB, angle, rotationDir);
1569 rotatePoint( anImageOrDom.point3[0], anImageOrDom.point3[1], anImageOrDom.point3[2], xB, yB, zB, angle, rotationDir);
1570 rotatePoint( anImageOrDom.point4[0], anImageOrDom.point4[1], anImageOrDom.point4[2], xB, yB, zB, angle, rotationDir);
1571
1572 }
1573
1587 template <typename TValues>
1588 static
1589 void rotatePoint(TValues &x, TValues &y, TValues &z,
1590 double cx, double cy, double cz,
1591 double rotationAngle, ImageDirection rotationDir);
1592
1593
1594
1595
1596
1597 // ------------------------- Private Datas --------------------------------
1598 private:
1599
1601 //GLuint myListToAff;
1602
1605
1608
1612
1615
1618
1620
1621 unsigned int myNbListe;
1622 unsigned int myNbLineSetList;
1623 unsigned int myNbBallSetList;
1624 unsigned int myNbPrismSetList;
1625
1627 int mySelectedElementId = -1;
1628 unsigned char mySelectionColorShift = 150;
1629
1631 qglviewer::Vec myOrig, myDir, myDirSelector, mySelectedPoint;
1635 std::vector<GLTextureImage> myVectTextureImage;
1636
1637 bool myIsDoubleFaceRendering = true;
1638
1639 double camera_position[3];
1640 double camera_direction[3];
1641 double camera_upVector[3];
1642
1643 bool myLightPositionFixToCamera = true; // when false the light position is fix according to the scene.
1645 double myLightPhi;
1646 double myLightR;
1647 GLfloat myLightPosition [4] = {0.0f, 0.0f, 1.0f, 1.0f}; // the light position in cartesian coordinate
1648 GLfloat myLightPositionRefCameraDefault [3] = {-100.0f, 100.0f, 0.0f}; // the light default position according to the camera position
1649 GLfloat myLightPositionRefCamera [3] = {0.0f, 0.0f, 0.0f}; // the light position according to the camera position
1650 GLfloat myMaterialShininessCoeff[1] = {50.0f} ; // the material shininess coefficient used in opengl rendering
1651 GLfloat myMaterialSpecularCoeffs[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; // the light specular coefficients used in opengl rendering
1652 GLfloat myLightSpecularCoeffs[4] = { 0.3f, 0.3f, 0.3f, 1.0f }; // the light specular coefficients used in opengl rendering
1653 GLfloat myLightAmbientCoeffs[4] = { 0.0f, 0.0f, 0.0f, 1.0f }; // the material ambient coefficients used in opengl rendering
1654 GLfloat myLightDiffuseCoeffs[4] = { 0.7f, 0.7f, 0.7f, 1.0f }; // the material diffuse coefficients used in opengl rendering
1655
1656 const GLfloat myDefaultRenderSpec = 0.3f; // default specular coefficients for default mode rendering
1657 const GLfloat myDefaultRenderDiff = 0.7f; // default diffuse coefficients for metallic mode rendering
1658 const GLfloat myLambertRenderSpec = 0.0f; // default specular coefficients for default mode rendering
1659 const GLfloat myLambertRenderDiff = 0.9f; // default diffuse coefficients for metallic mode rendering
1660 const GLfloat myMetallicRenderSpec = 0.5f; // default specular coefficients for metallic mode rendering
1661 const GLfloat myMetallicRenderDiff = 0.5f; // default diffuse coefficients for metallic mode rendering
1662 const GLfloat myPlasticRenderSpec = 0.8f; // default specular coefficients for platic mode rendering
1663 const GLfloat myPlasticRenderDiff = 0.2f; // default diffuse coefficients for platic mode rendering
1664
1665 bool myUseGLPointsForBalls = false; // to display balls with GL points (instead real ball)
1666
1667 double ZNear;
1668 double ZFar;
1669
1670 //the default width of the mesh line
1672
1673 // To apply openGL ajustment only on visualisation
1674 float myGLScaleFactorX=1.0;
1675 float myGLScaleFactorY=1.0;
1676 float myGLScaleFactorZ=1.0;
1677
1678 // Used to apply interactive light rotation
1683
1685 std::vector<TextureImage> myGSImageList;
1687 std::vector<Image2DDomainD3D> myImageDomainList;
1690
1691 }; // end of class Viewer3D
1692
1693 template <typename TSpace, typename TKSpace>
1700 std::ostream & operator<<( std::ostream & out,
1701 const Viewer3D<TSpace, TKSpace> & object );
1702} // namespace DGtal
1703
1704
1706// Includes inline functions.
1707#include "DGtal/io/viewers/Viewer3D.ih"
1708
1709// //
1711
1712#endif // !defined Viewer3D_h
1713
1714#undef Viewer3D_RECURSES
1715#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)
Definition Display3D.h:109
std::map< DGtal::int32_t, std::vector< CubeD3D > > CubesMap
The type that maps identifier name -> vector of CubeD3D.
Definition Display3D.h:257
SelectCallbackFct getSelectCallback3D(DGtal::int32_t aName, void *&data) const
std::map< DGtal::int32_t, std::vector< QuadD3D > > QuadsMap
The type that maps identifier name -> vector of QuadD3D.
Definition Display3D.h:254
Aim: Implements basic operations that will be used in Point and Vector classes.
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:1622
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:1000
GLuint myTriangleSetListId
lists of the list to draw
Definition Viewer3D.h:1603
virtual QString helpString() const
void setCameraPosition(double ax, double ay, double az)
Definition Viewer3D.h:334
float myGLScaleFactorY
Definition Viewer3D.h:1675
qglviewer::Vec myDir
Definition Viewer3D.h:1631
virtual void mouseMoveEvent(QMouseEvent *e)
float myGLScaleFactorX
Definition Viewer3D.h:1674
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:1641
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:1644
void sortQuadFromCamera()
void glCreateListQuadMapsWired(const typename Display3D< Space, KSpace >::QuadsMap &aQuadMap, unsigned int idList)
std::vector< typename Viewer3D< Space, KSpace >::BallD3D > VectorBall
Definition Viewer3D.h:1394
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:1611
GLuint myBallSetListId
Definition Viewer3D.h:1610
void setCameraDirection(double ax, double ay, double az)
Definition Viewer3D.h:345
void setGLLightDiffuseCoefficients(const GLfloat lightDiffuseCoeffs[4])
bool myAutoSaveState
flag to save automatically or not the Viewer3d state when closing the viewer
Definition Viewer3D.h:485
std::vector< typename Viewer3D< Space, KSpace >::PolygonD3D > VectorPolygon
Definition Viewer3D.h:1396
virtual void init()
init
int myRefMouseXPos
the angle rotation increment used for interactive light move
Definition Viewer3D.h:1680
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...
double myLigthRotationStep
Definition Viewer3D.h:1679
std::vector< GLTextureImage > myVectTextureImage
list of the images textures in this viewer
Definition Viewer3D.h:1635
float myMeshDefaultLineWidth
Definition Viewer3D.h:1671
void translateAn2DDomain(unsigned int domainIndex, double xTranslation, double yTranslation, double zTranslation)
bool isValid() const
GLuint myPolygonSetListWiredId
Definition Viewer3D.h:1607
static void rotateImageVertex(TImageORDomain &anImageOrDom, double angle, ImageDirection rotationDir)
Definition Viewer3D.h:1563
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:1005
void glCreateListPolygons(const std::vector< VectorPolygon > &aVectPolygon, unsigned int idList)
void selfDisplay(std::ostream &out) const
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 >::QuadD3D > VectorQuad
Definition Viewer3D.h:1392
double myLightR
the light position (azimuth)
Definition Viewer3D.h:1646
RenderingMode myRenderingMode
Definition Viewer3D.h:487
std::vector< typename Viewer3D< Space, KSpace >::CubeD3D > VectorCubes
Definition Viewer3D.h:1391
std::vector< typename Viewer3D< Space, KSpace >::TextureImage > VectorTextureImage
Definition Viewer3D.h:1397
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)
void removeExtension()
Definition Viewer3D.h:321
GLuint myQuadsMapWiredId
Definition Viewer3D.h:1614
std::vector< Image2DDomainD3D > myImageDomainList
Used to store all the domains.
Definition Viewer3D.h:1687
void updateRenderingCoefficients(const RenderingMode aRenderMode, bool displayState=true)
Display::RealPoint RealPoint
Definition Viewer3D.h:145
double myGLPointMinWidth
Definition Viewer3D.h:482
bool myIsMovingLight
the reference mouse y-position used to determince the light position change (inclination)
Definition Viewer3D.h:1682
std::vector< typename DGtal::Viewer3D< Space, KSpace >::LineD3D > compute2DDomainLineRepresentation(Image2DDomainD3D &anImageDomain)
QPoint myPosSelector
a point selected with postSelection
Definition Viewer3D.h:1633
void updateRelativeCameraFromLightPosition()
void setLightModeFixToCamera(bool fixedToCam, bool verbose=true)
Definition Viewer3D.h:971
unsigned int myNbBallSetList
Definition Viewer3D.h:1623
Display::SelectCallbackFct SelectCallbackFct
Definition Viewer3D.h:144
virtual unsigned int getCurrentDomainNumber()
TKSpace KSpace
Definition Viewer3D.h:141
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:1606
void updateEmbeddingTextureImage(unsigned int anImageIndex, typename Space::Point aPoint1, typename Space::Point aPoint2, typename Space::Point aPoint3, typename Space::Point aPoint4)
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:1609
GLuint myCubesMapId
Definition Viewer3D.h:1616
void setGLLightSpecularCoefficients(const GLfloat lightSpecularCoeffs[4])
int myRefMouseYPos
the reference mouse x-position used to determince the light position change (azimuth)
Definition Viewer3D.h:1681
VectorCubes::iterator ItCube
Definition Viewer3D.h:1400
GLuint myCubeSetListWiredId
Definition Viewer3D.h:1617
std::vector< typename Viewer3D< Space, KSpace >::LineD3D > VectorLine
Definition Viewer3D.h:1393
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:1624
void glCreateListTrianglesWired(const std::vector< VectorTriangle > &aVectTriangle, unsigned int idList)
Viewer3D< Space, KSpace > Self
Definition Viewer3D.h:142
void updateOrientationTextureImage(unsigned int imageIndex, double xPosition, double yPosition, double zPosition, ImageDirection newDirection)
virtual void postSelection(const QPoint &point)
postSelection
BOOST_CONCEPT_ASSERT((concepts::CSpace< TSpace >))
DGtal::Color myDefaultBackgroundColor
the default background color of the viewer
Definition Viewer3D.h:475
void sortTriangleFromCamera()
Display3D< Space, KSpace > Display
Definition Viewer3D.h:143
void updateList(bool needToUpdateBoundingBox=true)
void glUpdateLightRenderingMode() const
ImageDirection
the 3 possible axes for the image direction
Definition Viewer3D.h:470
unsigned int myNbListe
number of lists in myListToAff
Definition Viewer3D.h:1621
GLuint myTriangleSetListWiredId
Definition Viewer3D.h:1604
virtual void drawWithNames()
drawWithNames
GLuint myQuadsMapId
Definition Viewer3D.h:1613
void addTextureImage(const TextureImage &image)
void setUseGLPointForBalls(bool useOpenGLPt)
std::vector< typename DGtal::Viewer3D< Space, KSpace >::LineD3D > compute2DDomainLineRepresentation(Image2DDomainD3D &anImageDomain, double delta)
double ZFar
zfar distance
Definition Viewer3D.h:1668
void addImage2DDomainD3D(const TDomain &anImageDomain, std::string mode, const DGtal::Color &aColor=DGtal::Color::Red)
double myLightPhi
the light position (inclination)
Definition Viewer3D.h:1645
double camera_position[3]
camera position
Definition Viewer3D.h:1639
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:1667
void glCreateListQuadD3D(const VectorQuad &aVectQuad, unsigned int idList)
float myGLScaleFactorZ
Definition Viewer3D.h:1676
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()
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:1640
std::vector< typename Viewer3D< Space, KSpace >::TriangleD3D > VectorTriangle
Definition Viewer3D.h:1395
void setGLDoubleRenderingMode(bool doubleSidedRendering)
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....
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:1685
Extension * myExtension
Stored a possible extension to the viewer (pointer owned).
Definition Viewer3D.h:1689
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
RealPoint center
The center coordinate of the cube.
Definition Display3D.h:162
std::vector< RealPoint > vertices
Definition Display3D.h:243
bool operator()(typename Viewer3D< Space, KSpace >::CubeD3D s1, typename Viewer3D< Space, KSpace >::CubeD3D s2)
Definition Viewer3D.h:1073
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
Viewer3D< Space, KSpace > Viewer
The associated viewer.
Definition Viewer3D.h:165
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
unsigned char * myTextureImageBufferGS
Definition Viewer3D.h:1247
GLTextureImage(const GLTextureImage &aGLImg)
Definition Viewer3D.h:1274
GLTextureImage(const typename Viewer3D< Space, KSpace >::TextureImage &aGSImage)
Definition Viewer3D.h:1313
unsigned char * myTextureImageBufferRGB
Definition Viewer3D.h:1248
Viewer3D< Space, KSpace >::ImageDirection myDirection
Definition Viewer3D.h:1239
RealPoint point1
coordinates
Definition Viewer3D.h:1234
Viewer3D< Space, KSpace >::TextureMode myMode
Definition Viewer3D.h:1246
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
~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 digital space, ie a cartesian product of integer lines.
Definition CSpace.h:106
Aim: Defines a unary functor, which associates arguments to results.