DGtal  1.0.0
examplePointFunctorHolder.cpp File Reference

An example file for DGtal::functors::PointFunctorHolder. More...

#include <algorithm>
#include "DGtal/base/Common.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/kernel/PointFunctorHolder.h"
#include "DGtal/geometry/volumes/distance/DistanceTransformation.h"
#include "DGtal/io/boards/Board2D.h"
#include "DGtal/io/colormaps/HueShadeColorMap.h"
Include dependency graph for examplePointFunctorHolder.cpp:

Go to the source code of this file.


int main ()

Detailed Description

An example file for DGtal::functors::PointFunctorHolder.

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/.

Roland Denis (denis.nosp@m.@mat.nosp@m.h.uni.nosp@m.v-ly.nosp@m.on1.f.nosp@m.r ) CNRS, Institut Camille Jordan (UMR 5208), Université Lyon 1, France

This file is part of the DGtal library.

Definition in file examplePointFunctorHolder.cpp.

Function Documentation

◆ main()

int main ( )







Definition at line 50 of file examplePointFunctorHolder.cpp.

51 {
53  auto mickey = functors::holdPointFunctor<Z2i::Point>(
54  [] ( Z2i::Point const& pt ) {
55  return
56  (pt - Z2i::Point(0, -5)).norm() > 3
57  && ( pt.norm() <= 20
58  || (pt - Z2i::Point(-18,21)).norm() <= 10
59  || (pt - Z2i::Point( 18,21)).norm() <= 10
60  );
61  });
65  Z2i::Domain domain( Z2i::Point(-35,-25), Z2i::Point(35, 35) );
67  using DTL2 = DistanceTransformation<Z2i::Space, decltype(mickey), Z2i::L2Metric>;
69  DTL2 dt( domain, mickey, Z2i::l2Metric );
74  DTL2::Value maxDT = *std::max_element( dt.constRange().begin(), dt.constRange().end() );
75  using HueTwice = HueShadeColorMap<DTL2::Value, 1>;
77  Board2D aBoard;
78  aBoard << domain;
79  Display2DFactory::drawImage<HueTwice>(aBoard, dt, 0, maxDT);
80  aBoard.saveEPS("examplePointFunctorHolder.eps");
83  return 0;
85 }
Aim: Implementation of the linear in time distance transformation for separable metrics.
Aim: This class template may be used to (linearly) convert scalar values in a given range into a colo...
Domain domain
Aim: implements separable l_p metrics with exact predicates.
double norm(const NormType type=L_2) const
void saveEPS(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition: Board.cpp:805
MyPointD Point
Definition: testClone2.cpp:383
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Definition: Board2D.h:70

References domain, DGtal::Z2i::l2Metric, DGtal::PointVector< dim, TEuclideanRing, TContainer >::norm(), and LibBoard::Board::saveEPS().