DGtal  1.4.beta
shapes/exampleEuclideanShapesDecorator.cpp

Example of EuclideanShapesDecorator

Shapes, Shapers and Digitizers
Result obtained from CSG operations with implicit balls.
#include <iostream>
#include "DGtal/base/Common.h"
// Shape construction
#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"
// Drawing
#include "DGtal/io/boards/Board2D.h"
using namespace std;
using namespace DGtal;
int main( int argc, char** argv )
{
trace.beginBlock ( "Example EuclideanShapesDecorator" );
trace.info() << "Args:";
for ( int i = 0; i < argc; ++i )
trace.info() << " " << argv[ i ];
trace.info() << endl;
double h = 1.0;
typedef ImplicitBall< Z2i::Space > MyEuclideanShapeA;
typedef ImplicitBall< Z2i::Space > MyEuclideanShapeB;
MyEuclideanShapeA shapeA( Z2i::RealPoint( 0.0, 0.0 ), 15 );
MyEuclideanShapeB shapeB( Z2i::RealPoint( 0.0, 0.0 ), 10 );
MyEuclideanShapeB shapeC( Z2i::RealPoint( -5.0, 0.0 ), 5 );
Minus s_minus ( shapeA );
s_minus.minus( shapeB );
s_minus.plus( shapeC );
typedef GaussDigitizer< Z2i::Space, Minus > MyGaussDigitizer;
MyGaussDigitizer digShape;
digShape.attach( s_minus );
digShape.init( s_minus.getLowerBound(), s_minus.getUpperBound(), h );
Z2i::Domain domainShape = digShape.getDomain();
Z2i::DigitalSet aSet( domainShape );
Board2D board;
board << SetMode( domainShape.className(), "Paving" )
<< domainShape;
Color dorange ( 255, 136, 0, 220 );
board << CustomStyle( aSet.className(), new CustomFillColor( dorange ));
board << aSet;
board.saveSVG ( "example-EuclideanShapesDecorator.svg" );
return 0;
}
// //
DGtal::GaussDigitizer
Aim: A class for computing the Gauss digitization of some Euclidean shape, i.e. its intersection with...
Definition: GaussDigitizer.h:79
DGtal::HyperRectDomain< Space >
DGtal::Trace::endBlock
double endBlock()
DGtal::Color
Structure representing an RGB triple with alpha component.
Definition: Color.h:67
DGtal::DigitalSetByAssociativeContainer::className
std::string className() const
DGtal::trace
Trace trace
Definition: Common.h:154
DGtal::HyperRectDomain::className
std::string className() const
DGtal::GaussDigitizer::attach
void attach(ConstAlias< EuclideanShape > shape)
DGtal::Trace::beginBlock
void beginBlock(const std::string &keyword="")
DGtal::CustomStyle
Definition: Board2D.h:217
DGtal::Trace::info
std::ostream & info()
DGtal::CustomFillColor
Custom style class redefining the fill color. You may use Board2D::Color::None for transparent color.
Definition: Board2D.h:342
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::EuclideanShapesCSG
Aim: Constructive Solid Geometry (CSG) between models of CEuclideanBoundedShape and CEuclideanOriente...
Definition: EuclideanShapesDecorator.h:67
DGtal::ImplicitBall
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create a ball in nD....
Definition: ImplicitBall.h:64
LibBoard::Board::saveSVG
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition: Board.cpp:1012
main
int main(int argc, char **argv)
Definition: testArithmeticDSS-benchmark.cpp:147
DGtal::Board2D
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Definition: Board2D.h:70
DGtal::Shapes
Aim: A utility class for constructing different shapes (balls, diamonds, and others).
Definition: DGtal/shapes/Shapes.h:71
DGtal::PointVector
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:165
DGtal::SetMode
Modifier class in a Board2D stream. Useful to choose your own mode for a given class....
Definition: Board2D.h:247
DGtal::DigitalSetByAssociativeContainer
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
Definition: DigitalSetByAssociativeContainer.h:89