DGtal 1.3.0
Loading...
Searching...
No Matches
shapes/exampleEuclideanShapesDecorator.cpp

Example of EuclideanShapesDecorator

See also
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" );
trace.endBlock();
return 0;
}
// //
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....
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
DGtal is the top-level namespace which contains all DGtal functions and types.
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