DGtal  1.2.0
Functions
exampleEuclideanShapesDecorator.cpp File Reference
#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/shapes/GaussDigitizer.h"
#include "DGtal/topology/LightImplicitDigitalSurface.h"
#include "DGtal/topology/DigitalSurface.h"
#include "DGtal/io/boards/Board2D.h"
#include "DGtal/images/ImageHelper.h"
#include "DGtal/shapes/Shapes.h"
#include "DGtal/shapes/implicit/ImplicitBall.h"
#include "DGtal/shapes/EuclideanShapesDecorator.h"
Include dependency graph for exampleEuclideanShapesDecorator.cpp:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Author
Jérémy Levallois (jerem.nosp@m.y.le.nosp@m.vallo.nosp@m.is@l.nosp@m.iris..nosp@m.cnrs.nosp@m..fr ) Laboratoire d'InfoRmatique en Image et Systèmes d'information - LIRIS (CNRS, UMR 5205), INSA-Lyon, France LAboratoire de MAthématiques - LAMA (CNRS, UMR 5127), Université de Savoie, France
Date
2012/12/17

An example file named exampleEuclideanShapesDecorator.

This file is part of the DGtal library.

Definition in file exampleEuclideanShapesDecorator.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Construction of the shape + digitalization

[EuclideanShapesDecoratorUsage]

[EuclideanShapesDecoratorUsage]

Definition at line 57 of file exampleEuclideanShapesDecorator.cpp.

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 }
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:67
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....
Definition: ImplicitBall.h:65
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:593
Aim: A utility class for constructing different shapes (balls, diamonds, and others).
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:1012
Trace trace
Definition: Common.h:154
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

References DGtal::GaussDigitizer< TSpace, TEuclideanShape >::attach(), DGtal::Trace::beginBlock(), DGtal::HyperRectDomain< TSpace >::className(), DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::className(), DGtal::Trace::endBlock(), DGtal::Trace::info(), LibBoard::Board::saveSVG(), and DGtal::trace.