DGtal  1.0.0
Functions
exampleParametricShapes.cpp File Reference
#include <iostream>
#include <DGtal/base/Common.h>
#include <DGtal/shapes/Shapes.h>
#include <DGtal/shapes/GaussDigitizer.h>
#include <DGtal/shapes/parametric/Astroid2D.h>
#include <DGtal/io/boards/Board2D.h>
Include dependency graph for exampleParametricShapes.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
Adrien Krähenbühl (krahe.nosp@m.nbuh.nosp@m.l@uni.nosp@m.stra.nosp@m..fr ) Laboratoire des sciences de l'ingénieur, de l'informatique et de l'imagerie - ICube (UMR 7357), France
Date
2018/08/14

An example file named exampleParametricShapes.

This file is part of the DGtal library.

Definition in file exampleParametricShapes.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 47 of file exampleParametricShapes.cpp.

48 {
49  trace.beginBlock ( "Example Parametric Shapes" );
50 
51  typedef Z2i::Space Space;
52 
53  /* This example consider the Lemniscate shape.
54  *
55  * To test other shapes, replace Astroid2D by the desirated shape
56  * and adapt parameters of the shape constructor.
57  */
58  typedef Astroid2D<Space> MyShape;
59  MyShape shape( 0, 0, 10, 5 );
60 
61  // Grid step parameter for the Gauzz digitization
62  double h = 1;
63 
64  // Gauss digitization
65  typedef GaussDigitizer< Z2i::Space, MyShape > MyGaussDigitizer;
66  MyGaussDigitizer dig;
67  dig.attach( shape );
68  dig.init( shape.getLowerBound(), shape.getUpperBound(), h );
69 
70  // Create the digital point set from the digitizer
71  Z2i::DigitalSet aSet( dig.getDomain() );
73 
74  // Draw the digitized shape in a file named "shape.svg"
75  Board2D board;
76  board << aSet;
77  board << CustomStyle( aSet.className(), new CustomFillColor(Color::Black));
78  board.saveSVG( "shape.svg" );
79 
80  trace.endBlock();
81  return 0;
82 }
void beginBlock(const std::string &keyword="")
Trace trace
Definition: Common.h:144
Custom style class redefining the fill color. You may use Board2D::Color::None for transparent color.
Definition: Board2D.h:342
void attach(ConstAlias< EuclideanShape > shape)
double endBlock()
Aim: Model of the concept StarShaped represents an astroid.
Definition: Astroid2D.h:61
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition: Board.cpp:1012
Aim: A class for computing the Gauss digitization of some Euclidean shape, i.e. its intersection with...
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
Aim: A utility class for constructing different shapes (balls, diamonds, and others).
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Definition: Board2D.h:70

References DGtal::GaussDigitizer< TSpace, TEuclideanShape >::attach(), DGtal::Trace::beginBlock(), DGtal::Color::Black, DGtal::Shapes< TDomain >::digitalShaper(), DGtal::Trace::endBlock(), LibBoard::Board::saveSVG(), and DGtal::trace.