34#include "DGtal/base/Common.h"
35#include "ConfigTest.h"
36#include "DGtal/helpers/StdDefs.h"
37#include "DGtal/geometry/volumes/distance/ChamferNorm2D.h"
38#include "DGtal/geometry/volumes/distance/CMetricSpace.h"
39#include "DGtal/geometry/volumes/distance/CSeparableMetric.h"
41#include "DGtal/geometry/volumes/distance/VoronoiMap.h"
43#include "DGtal/io/colormaps/HueShadeColorMap.h"
44#include "DGtal/io/colormaps/RandomColorMap.h"
46#include "DGtal/io/boards/Board2D.h"
55template <
typename VoroMap>
56void saveVoroMap(
const std::string &filename,
const VoroMap &output)
61 for (
typename VoroMap::Domain::ConstIterator it = output.domain().begin(), itend = output.domain().end();
63 if ( output(*it) > maxdt)
70 for(
typename VoroMap::Domain::ConstIterator it = output.domain().begin(),
71 itend = output.domain().end();
74 typename VoroMap::Value point = output(*it);
78 board.
saveSVG(filename.c_str());
86 unsigned int nbok = 0;
92 Metric::Directions dirs5711;
93 Metric::Directions normals5711;
113 Metric mask5711(dirs5711,normals5711);
124 mySet.insertNew( *it );
161 VoroChamf voro(&
domain, &mySet,&mask5711);
167 for(VoroChamf::OutputImage::Domain::ConstIterator it = voro.domain().begin(),
168 itend = voro.domain().end();
172 int c =
abs(p[1]*11+ p[0]*17);
187 for(
int j= -20; j <= 20 ; j++)
196bool testChamferVoroLarge()
198 unsigned int nbok = 0;
204 Metric::Directions dirs5711;
205 Metric::Directions normals5711;
225 Metric mask5711(dirs5711,normals5711);
237 mySet.insertNew( *it );
241 for(
unsigned int i = 0; i < N; i++)
242 sites.insert(
Z2i::Point( rand() % N , rand()% N ));
244 std::copy(sites.begin(), sites.end() , std::ostream_iterator<Z2i::Point>(std::cout,
", "));
251 VoroChamf voro(&
domain, &mySet,&mask5711);
255 for(VoroChamf::OutputImage::Domain::ConstIterator it = voro.domain().begin(),
256 itend = voro.domain().end();
260 int c =
abs(p[1]*11+ p[0]*17);
274 board.
saveSVG(
"Voromap-large.svg");
284int main(
int argc,
char** argv )
288 for (
int i = 0; i < argc; ++i )
292 bool res = testChamferVoro()&& testChamferVoroLarge();
293 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << std::endl;
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...
Container::const_iterator ConstIterator
ConstIterator type of the container;.
Aim: This class template may be used to (linearly) convert scalar values in a given range into a colo...
Iterator for HyperRectDomain.
const ConstIterator & begin() const
const ConstIterator & end() const
Aim: access to random color from a gradientColorMap.
void beginBlock(const std::string &keyword="")
Aim: Implementation of the linear in time Voronoi map construction.
Aim: implements a model of CSeparableMetric for Chamfer and path based norms.
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
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 ...