DGtal  1.3.beta
DrawWithDisplay3DModifier.h
1 
17 #pragma once
18 
30 #if defined(DrawWithDisplay3DModifier_RECURSES)
31 #error Recursive header files inclusion detected in DrawWithDisplay3DModifier.h
32 #else // defined(DrawWithDisplay3DModifier_RECURSES)
33 
34 #define DrawWithDisplay3DModifier_RECURSES
35 
36 #if !defined DrawWithDisplay3DModifier_h
37 
38 #define DrawWithDisplay3DModifier_h
39 
41 // Inclusions
42 #include <iostream>
43 #include "DGtal/base/Common.h"
44 #include "DGtal/helpers/StdDefs.h"
45 #include "DGtal/base/Alias.h"
46 #include "DGtal/base/ConstAlias.h"
47 #include "DGtal/images/CConstImage.h"
48 #include "DGtal/base/CountedPtr.h"
49 #include "DGtal/topology/KhalimskySpaceND.h"
51 
52 namespace DGtal
53 {
54 
61 {
62  std::string className() const;
63 };
64 
65 
66 
74 {
80  SetMode3D( std::string classname, std::string mode )
81  : myClassname( classname ), myMode( mode )
82  {}
83 
84  std::string myClassname;
85  std::string myMode;
86 };
87 
88 
89 
90 
97 {
104  CustomStyle3D( std::string aClassname, DrawableWithDisplay3D* style ): myClassname( aClassname ), myStyle( style )
105  {}
106 
107  std::string className() const;
108 
109  std::string myClassname;
111 };
112 
113 
114 
115 
130 {
133 
140  CustomColors3D( const Color & penColor,
141  const Color & fillColor )
142  : myPenColor( penColor ), myFillColor( fillColor )
143  {}
144 
145 
146 };
147 
148 
149 
150 
157 {
161  ClippingPlane( double a, double b, double c, double d, bool drawPlane=true )
162  : myA( a ), myB( b ), myC( c ), myD ( d ), myDrawPlane(drawPlane)
163  {}
164 
165  double * getEquation();
166  double myA;
167  double myB;
168  double myC;
169  double myD;
171 };
172 
173 
174 
180 {
189  double aShift, double aSizeFactor=1.0 ):mySurfel(aSurfel), myShift(aShift), mySizeFactor(aSizeFactor)
190  {
191  }
192 
193 
203  const DGtal::Z3i::SCell & aVoxel,
204  double aShift=0.05, double aSizeFactor=0.75 )
205  : mySurfel(aSurfel), myShift(aShift), mySizeFactor(aSizeFactor)
206  {
207  auto const& preSurfel = aSurfel.preCell();
208  auto const& preVoxel = aVoxel.preCell();
209 
210  bool xodd = (preSurfel.coordinates[ 0 ] & 1 );
211  bool yodd = (preSurfel.coordinates[ 1 ] & 1 );
212  bool zodd = (preSurfel.coordinates[ 2 ] & 1 );
213  if(!xodd )
214  {
215  myShift*= ((preVoxel.coordinates[ 0 ]-preSurfel.coordinates[ 0 ] <0)? -1.0: 1.0);
216  }else if(!yodd )
217  {
218  myShift*=((preVoxel.coordinates[ 1 ]-preSurfel.coordinates[ 1 ] <0)? -1.0: 1.0);
219  }else if(!zodd )
220  {
221  myShift*=((preVoxel.coordinates[ 2 ]-preSurfel.coordinates[ 2 ] <0)? -1.0: 1.0);
222  }
223  }
224 
227  double myShift;
228  double mySizeFactor;
229 };
230 
231 
245  SetName3D( DGtal::int32_t aName = -1 ) : name( aName ) {}
247  std::string className() const { return "SetName3D"; }
250  };
251 
262  typedef int (*CallbackFct)( void* viewer, DGtal::int32_t name, void* data );
264  void* data,
265  DGtal::int32_t min = 0, DGtal::int32_t max = 0x7fffffff )
266  : myFct( f ), myData( data ), myMin( min ), myMax( max ) {}
268  std::string className() const { return "SetSelectCallback3D"; }
271  void* myData;
274  };
275 } // namespace DGtal
276 
277 
279 // Includes inline functions.
280 #include "DGtal/io/DrawWithDisplay3DModifier.ih"
281 
282 
283 // //
285 
286 #endif // !defined DrawWithDisplay3DModifier_h
287 
288 #undef DrawWithDisplay3DModifier_RECURSES
289 #endif // else defined(DrawWithDisplay3DModifier_RECURSES)
DGtal::TransformedPrism
class to modify the position and scale to construct better illustration mode.
Definition: DrawWithDisplay3DModifier.h:179
DGtal::CustomColors3D::myFillColor
Color myFillColor
Definition: DrawWithDisplay3DModifier.h:132
DGtal::SetSelectCallback3D::SetSelectCallback3D
SetSelectCallback3D(CallbackFct f, void *data, DGtal::int32_t min=0, DGtal::int32_t max=0x7fffffff)
Definition: DrawWithDisplay3DModifier.h:263
DGtal::TransformedPrism::TransformedPrism
TransformedPrism(const DGtal::Z3i::SCell &aSurfel, double aShift, double aSizeFactor=1.0)
Definition: DrawWithDisplay3DModifier.h:188
DGtal::CustomStyle3D::CustomStyle3D
CustomStyle3D(std::string aClassname, DrawableWithDisplay3D *style)
Definition: DrawWithDisplay3DModifier.h:104
DGtal::ClippingPlane::ClippingPlane
ClippingPlane(double a, double b, double c, double d, bool drawPlane=true)
Definition: DrawWithDisplay3DModifier.h:161
DGtal::DrawWithDisplay3DModifier
Base class specifying the methods for classes which intend to modify a Viewer3D stream.
Definition: DrawWithDisplay3DModifier.h:60
max
int max(int a, int b)
Definition: testArithmeticalDSS.cpp:1108
DGtal::SetSelectCallback3D::className
std::string className() const
Definition: DrawWithDisplay3DModifier.h:268
DGtal::Color
Structure representing an RGB triple with alpha component.
Definition: Color.h:66
DGtal::ClippingPlane::myB
double myB
Definition: DrawWithDisplay3DModifier.h:167
DGtal::int32_t
boost::int32_t int32_t
signed 32-bit integer.
Definition: BasicTypes.h:72
DGtal::ClippingPlane::getEquation
double * getEquation()
DGtal::ClippingPlane::myD
double myD
Definition: DrawWithDisplay3DModifier.h:169
DGtal::ClippingPlane::myC
double myC
Definition: DrawWithDisplay3DModifier.h:168
DGtal::TransformedPrism::mySizeFactor
double mySizeFactor
Definition: DrawWithDisplay3DModifier.h:228
DGtal::TransformedPrism::TransformedPrism
TransformedPrism(const DGtal::Z3i::SCell &aSurfel, const DGtal::Z3i::SCell &aVoxel, double aShift=0.05, double aSizeFactor=0.75)
Definition: DrawWithDisplay3DModifier.h:202
DGtal::SetMode3D::myMode
std::string myMode
Definition: DrawWithDisplay3DModifier.h:85
DGtal::SignedKhalimskyCell
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
Definition: KhalimskySpaceND.h:208
DGtal::SetName3D::name
DGtal::int32_t name
the "OpenGL name" for selection, or -1 for none.
Definition: DrawWithDisplay3DModifier.h:249
DGtal::SetName3D
Definition: DrawWithDisplay3DModifier.h:242
DGtal::CustomColors3D::myPenColor
Color myPenColor
Definition: DrawWithDisplay3DModifier.h:131
DGtal::CustomStyle3D::myClassname
std::string myClassname
Definition: DrawWithDisplay3DModifier.h:109
DGtal::CustomColors3D::CustomColors3D
CustomColors3D(const Color &penColor, const Color &fillColor)
Definition: DrawWithDisplay3DModifier.h:140
DGtal::CustomStyle3D::className
std::string className() const
DGtal::SetName3D::SetName3D
SetName3D(DGtal::int32_t aName=-1)
Definition: DrawWithDisplay3DModifier.h:245
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::ClippingPlane::myA
double myA
Definition: DrawWithDisplay3DModifier.h:166
DGtal::SignedKhalimskyCell::preCell
SPreCell const & preCell() const
Returns the underlying constant signed pre-cell.
DGtal::SetSelectCallback3D::myMin
DGtal::int32_t myMin
Definition: DrawWithDisplay3DModifier.h:272
DGtal::CustomColors3D
Definition: DrawWithDisplay3DModifier.h:129
DGtal::DrawWithDisplay3DModifier::className
std::string className() const
DGtal::CountedPtr< DrawableWithDisplay3D >
DGtal::SetSelectCallback3D::myMax
DGtal::int32_t myMax
Definition: DrawWithDisplay3DModifier.h:273
DGtal::ClippingPlane
Class for adding a Clipping plane through the Viewer3D stream. Realizes the concept CDrawableWithView...
Definition: DrawWithDisplay3DModifier.h:156
DGtal::TransformedPrism::mySurfel
DGtal::Z3i::SCell mySurfel
Definition: DrawWithDisplay3DModifier.h:226
DGtal::CustomStyle3D
Modifier class in a Display3D stream. Useful to choose your own style for a given class....
Definition: DrawWithDisplay3DModifier.h:96
DGtal::SetMode3D
Modifier class in a Display3D stream. Useful to choose your own mode for a given class....
Definition: DrawWithDisplay3DModifier.h:73
DGtal::SetSelectCallback3D::CallbackFct
int(* CallbackFct)(void *viewer, DGtal::int32_t name, void *data)
Definition: DrawWithDisplay3DModifier.h:262
DGtal::SetName3D::className
std::string className() const
Definition: DrawWithDisplay3DModifier.h:247
DGtal::ClippingPlane::myDrawPlane
bool myDrawPlane
Definition: DrawWithDisplay3DModifier.h:170
DGtal::SetMode3D::myClassname
std::string myClassname
Definition: DrawWithDisplay3DModifier.h:84
DGtal::DrawableWithDisplay3D
Definition: Common.h:207
DGtal::SetMode3D::SetMode3D
SetMode3D(std::string classname, std::string mode)
Definition: DrawWithDisplay3DModifier.h:80
DGtal::SetSelectCallback3D::myFct
CallbackFct myFct
The callback function associated to the selection of an element.
Definition: DrawWithDisplay3DModifier.h:270
DGtal::SetSelectCallback3D::myData
void * myData
Definition: DrawWithDisplay3DModifier.h:271
DGtal::SetSelectCallback3D
Definition: DrawWithDisplay3DModifier.h:257
DGtal::CustomStyle3D::myStyle
CountedPtr< DrawableWithDisplay3D > myStyle
Definition: DrawWithDisplay3DModifier.h:110
DGtal::TransformedPrism::myShift
double myShift
Definition: DrawWithDisplay3DModifier.h:227