DGtal 1.3.0
Loading...
Searching...
No Matches
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)
34#define DrawWithDisplay3DModifier_RECURSES
35
36#if !defined DrawWithDisplay3DModifier_h
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
52namespace 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;
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)
Structure representing an RGB triple with alpha component.
Definition: Color.h:68
Aim: Smart pointer based on reference counts.
Definition: CountedPtr.h:80
DGtal is the top-level namespace which contains all DGtal functions and types.
boost::int32_t int32_t
signed 32-bit integer.
Definition: BasicTypes.h:72
Class for adding a Clipping plane through the Viewer3D stream. Realizes the concept CDrawableWithView...
double * getEquation()
ClippingPlane(double a, double b, double c, double d, bool drawPlane=true)
CustomColors3D(const Color &penColor, const Color &fillColor)
Modifier class in a Display3D stream. Useful to choose your own style for a given class....
std::string className() const
CountedPtr< DrawableWithDisplay3D > myStyle
CustomStyle3D(std::string aClassname, DrawableWithDisplay3D *style)
Base class specifying the methods for classes which intend to modify a Viewer3D stream.
std::string className() const
Modifier class in a Display3D stream. Useful to choose your own mode for a given class....
SetMode3D(std::string classname, std::string mode)
DGtal::int32_t name
the "OpenGL name" for selection, or -1 for none.
SetName3D(DGtal::int32_t aName=-1)
std::string className() const
SetSelectCallback3D(CallbackFct f, void *data, DGtal::int32_t min=0, DGtal::int32_t max=0x7fffffff)
CallbackFct myFct
The callback function associated to the selection of an element.
int(* CallbackFct)(void *viewer, DGtal::int32_t name, void *data)
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
SPreCell const & preCell() const
Returns the underlying constant signed pre-cell.
class to modify the position and scale to construct better illustration mode.
TransformedPrism(const DGtal::Z3i::SCell &aSurfel, const DGtal::Z3i::SCell &aVoxel, double aShift=0.05, double aSizeFactor=0.75)
TransformedPrism(const DGtal::Z3i::SCell &aSurfel, double aShift, double aSizeFactor=1.0)
int max(int a, int b)