DGtal 1.3.0
Loading...
Searching...
No Matches
Functions
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 <boost/algorithm/minmax_element.hpp>

Go to the source code of this file.

Functions

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

Author
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
Date
2018/11/23

This file is part of the DGtal library.

Definition in file examplePointFunctorHolder.cpp.

Function Documentation

◆ main()

int main ( void  )

[examplePointFunctorHolder-hold]

[examplePointFunctorHolder-hold]

[examplePointFunctorHolder-DT]

[examplePointFunctorHolder-DT]

[examplePointFunctorHolder-DTvis]

[examplePointFunctorHolder-DTvis]

Definition at line 52 of file examplePointFunctorHolder.cpp.

53{
55 auto mickey = functors::holdPointFunctor<Z2i::Point>(
56 [] ( Z2i::Point const& pt ) {
57 return
58 (pt - Z2i::Point(0, -5)).norm() > 3
59 && ( pt.norm() <= 20
60 || (pt - Z2i::Point(-18,21)).norm() <= 10
61 || (pt - Z2i::Point( 18,21)).norm() <= 10
62 );
63 });
65
67 Z2i::Domain domain( Z2i::Point(-35,-25), Z2i::Point(35, 35) );
68
69 using DTL2 = DistanceTransformation<Z2i::Space, decltype(mickey), Z2i::L2Metric>;
70
71 DTL2 dt( domain, mickey, Z2i::l2Metric );
73
74
76 DTL2::Value maxDT = *boost::first_max_element( dt.constRange().begin(), dt.constRange().end() );
77 using HueTwice = HueShadeColorMap<DTL2::Value, 1>;
78
79 Board2D aBoard;
80 aBoard << domain;
81 Display2DFactory::drawImage<HueTwice>(aBoard, dt, 0, maxDT);
82 aBoard.saveEPS("examplePointFunctorHolder.eps");
84
85 return 0;
86
87}
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Definition: Board2D.h:71
Aim: Implementation of the linear in time distance transformation for separable metrics.
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...
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
SpaceND< 2, Integer > Space
Definition: StdDefs.h:75
static const L2Metric l2Metric
Definition: StdDefs.h:123
Domain domain

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