DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
exampleParametricShapes.cpp
Go to the documentation of this file.
1
16
29
31
33
#include <iostream>
34
#include <DGtal/base/Common.h>
35
36
// Shape construction
37
#include <DGtal/shapes/Shapes.h>
38
#include <DGtal/shapes/GaussDigitizer.h>
39
#include <DGtal/shapes/parametric/Astroid2D.h>
40
41
// Drawing
42
#include <DGtal/io/boards/Board2D.h>
43
44
using namespace
DGtal
;
46
47
int
main
(
int
argc,
char
** argv )
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() );
72
Shapes<Z2i::Domain>::digitalShaper
( aSet, dig );
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
}
83
85
// //
DGtal::Astroid2D
Aim: Model of the concept StarShaped represents an astroid.
Definition
Astroid2D.h:62
DGtal::Board2D
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Definition
Board2D.h:71
DGtal::Color::Black
static const Color Black
Definition
Color.h:422
DGtal::DigitalSetByAssociativeContainer::className
std::string className() const
DGtal::GaussDigitizer
Aim: A class for computing the Gauss digitization of some Euclidean shape, i.e. its intersection with...
Definition
GaussDigitizer.h:80
DGtal::GaussDigitizer::attach
void attach(ConstAlias< EuclideanShape > shape)
DGtal::Shapes::digitalShaper
static void digitalShaper(TDigitalSet &aSet, const TShapeFunctor &aFunctor)
DGtal::Trace::beginBlock
void beginBlock(const std::string &keyword="")
DGtal::Trace::endBlock
double endBlock()
LibBoard::Board::saveSVG
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition
Board.cpp:1011
DGtal::Z2i::Space
SpaceND< 2, Integer > Space
Definition
StdDefs.h:75
DGtal::Z2i::DigitalSet
DigitalSetSelector< Domain, BIG_DS+HIGH_BEL_DS >::Type DigitalSet
Definition
StdDefs.h:100
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition
ClosedIntegerHalfPlane.h:49
DGtal::trace
Trace trace
DGtal::Space
DGtal::CustomFillColor
Custom style class redefining the fill color. You may use Board2D::Color::None for transparent color.
Definition
Board2D.h:343
DGtal::CustomStyle::CustomStyle
CustomStyle(std::string classname, DrawableWithBoard2D *style)
Definition
Board2D.h:224
main
int main(int, char **)
Definition
testIntegerComputer.cpp:331
examples
shapes
exampleParametricShapes.cpp
Generated on
for DGtal by
1.18.0