41#include "DGtal/base/Common.h"
42#include "DGtal/helpers/StdDefs.h"
45#include "DGtal/kernel/BasicPointPredicates.h"
46#include "DGtal/images/SimpleThresholdForegroundPredicate.h"
47#include "DGtal/geometry/volumes/distance/ExactPredicateLpSeparableMetric.h"
48#include "DGtal/geometry/volumes/distance/VoronoiMap.h"
49#include "DGtal/geometry/volumes/distance/DistanceTransformation.h"
51#include "DGtal/io/colormaps/HueShadeColorMap.h"
52#include "DGtal/io/boards/Board2D.h"
84 board.
saveSVG(
"voronoimap-inputset.svg");
89 NotPredicate notSetPred(set);
94 Voronoi2D voronoimap(
domain,notSetPred,l2);
100 for(Voronoi2D::Domain::ConstIterator it = voronoimap.domain().begin(),
101 itend = voronoimap.domain().end(); it != itend; ++it)
103 Voronoi2D::Value site = voronoimap( *it );
107 board.
saveSVG(
"voronoimap-voro.svg");
112 for(Voronoi2D::Domain::ConstIterator it = voronoimap.domain().begin(),
113 itend = voronoimap.domain().end(); it != itend; ++it)
115 Voronoi2D::Value site = voronoimap( *it );
116 unsigned char c = (site[1]*13 + site[0] * 7) % 256;
120 board.
saveSVG(
"voronoimap-cells.svg");
128 Voronoi2D_l8 voronoimap_l8(
domain,notSetPred,l8);
131 for(Voronoi2D_l8::Domain::ConstIterator it = voronoimap_l8.domain().begin(),
132 itend = voronoimap_l8.domain().end(); it != itend; ++it)
134 Voronoi2D::Value site = voronoimap_l8( *it );
135 unsigned char c = (site[1]*13 + site[0] * 7) % 256;
139 board.
saveSVG(
"voronoimap-vorol8.svg");
144 DT dt(
domain,notSetPred,l2);
150 for(DT::ConstRange::ConstIterator it = dt.constRange().begin(), itend = dt.constRange().end();
152 if ((*it)>maxDT) maxDT = (*it);
158 for(DT::Domain::ConstIterator it = dt.domain().begin(),
159 itend = dt.domain().end(); it != itend; ++it)
161 DT::Value dist = dt( *it );
165 board.
saveSVG(
"voronoimap-dt.svg");
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Structure representing an RGB triple with alpha component.
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
void insertNew(const Point &p)
Aim: implements separable l_p metrics with exact predicates.
Aim: This class template may be used to (linearly) convert scalar values in a given range into a colo...
void beginBlock(const std::string &keyword="")
Aim: Implementation of the linear in time Voronoi map construction.
void clear(const DGtal::Color &color=DGtal::Color::None)
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
functors namespace gathers all DGtal functors.
DGtal is the top-level namespace which contains all DGtal functions and types.
Custom style class redefining the pen color and the fill color. You may use Board2D::Color::None for ...
static void draw(DGtal::Board2D &board, const DGtal::DiscreteExteriorCalculus< dimEmbedded, dimAmbient, TLinearAlgebraBackend, TInteger > &calculus)
Aim: The predicate returns true when the point predicate given at construction return false....
Vector lower(const Vector &z, unsigned int k)
Vector upper(const Vector &z, unsigned int k)