DGtal 1.4.2
Loading...
Searching...
No Matches
exampleEuclideanShapesDecorator.cpp
Go to the documentation of this file.
1
32
34#include <iostream>
35#include "DGtal/base/Common.h"
36
37// Shape construction
38#include "DGtal/shapes/GaussDigitizer.h"
39#include "DGtal/topology/LightImplicitDigitalSurface.h"
40#include "DGtal/topology/DigitalSurface.h"
41#include "DGtal/io/boards/Board2D.h"
42#include "DGtal/images/ImageHelper.h"
43#include "DGtal/shapes/Shapes.h"
44#include "DGtal/shapes/implicit/ImplicitBall.h"
45#include "DGtal/shapes/EuclideanShapesDecorator.h"
46
47// Drawing
48#include "DGtal/io/boards/Board2D.h"
49
51
52using namespace std;
53using namespace DGtal;
54
56
57int main( int argc, char** argv )
58{
59 trace.beginBlock ( "Example EuclideanShapesDecorator" );
60 trace.info() << "Args:";
61 for ( int i = 0; i < argc; ++i )
62 trace.info() << " " << argv[ i ];
63 trace.info() << endl;
64
66 double h = 1.0;
67
69 typedef ImplicitBall< Z2i::Space > MyEuclideanShapeA;
70 typedef ImplicitBall< Z2i::Space > MyEuclideanShapeB;
71 MyEuclideanShapeA shapeA( Z2i::RealPoint( 0.0, 0.0 ), 15 );
72 MyEuclideanShapeB shapeB( Z2i::RealPoint( 0.0, 0.0 ), 10 );
73 MyEuclideanShapeB shapeC( Z2i::RealPoint( -5.0, 0.0 ), 5 );
74
76 Minus s_minus ( shapeA );
77 s_minus.minus( shapeB );
78 s_minus.plus( shapeC );
80
81 typedef GaussDigitizer< Z2i::Space, Minus > MyGaussDigitizer;
82 MyGaussDigitizer digShape;
83 digShape.attach( s_minus );
84 digShape.init( s_minus.getLowerBound(), s_minus.getUpperBound(), h );
85 Z2i::Domain domainShape = digShape.getDomain();
86 Z2i::DigitalSet aSet( domainShape );
87 Shapes<Z2i::Domain>::digitalShaper( aSet, digShape );
88
89 Board2D board;
90 board << SetMode( domainShape.className(), "Paving" )
91 << domainShape;
92
93 Color dorange ( 255, 136, 0, 220 );
94
95 board << CustomStyle( aSet.className(), new CustomFillColor( dorange ));
96 board << aSet;
97
98 board.saveSVG ( "example-EuclideanShapesDecorator.svg" );
99
100 trace.endBlock();
101 return 0;
102}
103
105// //
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Definition Board2D.h:71
Structure representing an RGB triple with alpha component.
Definition Color.h:68
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
Aim: Constructive Solid Geometry (CSG) between models of CEuclideanBoundedShape and CEuclideanOriente...
Aim: A class for computing the Gauss digitization of some Euclidean shape, i.e. its intersection with...
void attach(ConstAlias< EuclideanShape > shape)
std::string className() const
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create a ball in nD....
Aim: Implements basic operations that will be used in Point and Vector classes.
static void digitalShaper(TDigitalSet &aSet, const TShapeFunctor &aFunctor)
void beginBlock(const std::string &keyword="")
std::ostream & info()
double endBlock()
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition Board.cpp:1011
DGtal is the top-level namespace which contains all DGtal functions and types.
Trace trace
Definition Common.h:153
STL namespace.
Custom style class redefining the fill color. You may use Board2D::Color::None for transparent color.
Definition Board2D.h:343
Modifier class in a Board2D stream. Useful to choose your own mode for a given class....
Definition Board2D.h:247
int main()
Definition testBits.cpp:56