DGtal 2.1.0
Loading...
Searching...
No Matches
shapeDTViewer.cpp File Reference

An example of generating a grid curve from a parametric shape and estimating its length. More...

#include <iostream>
#include <fstream>
#include <algorithm>
#include "DGtal/base/Common.h"
#include "DGtal/helpers/StdDefs.h"
#include "ConfigExamples.h"
#include "DGtal/shapes/Shapes.h"
#include "DGtal/shapes/ShapeFactory.h"
#include "DGtal/io/viewers/PolyscopeViewer.h"
#include "DGtal/geometry/volumes/distance/DistanceTransformation.h"
#include "DGtal/io/colormaps/GradientColorMap.h"
#include <boost/algorithm/minmax_element.hpp>
Include dependency graph for shapeDTViewer.cpp:

Go to the source code of this file.

Functions

int main ()
 

Detailed Description

An example of generating a grid curve from a parametric shape and estimating its length.

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
David Coeurjolly (david.nosp@m..coe.nosp@m.urjol.nosp@m.ly@l.nosp@m.iris..nosp@m.cnrs.nosp@m..fr)
Date
2011/10/17

This file is part of the DGtal library.

Definition in file shapeDTViewer.cpp.

Function Documentation

◆ main()

int main ( void  )

[ImageSetDT-DT]

[ImageSetDT-DT]

Definition at line 58 of file shapeDTViewer.cpp.

59{
61 viewer.allowReuseList = true;
62
64 DGtal::ImplicitRoundedHyperCube<Z3i::Space> myCube( center, 20, 2.8);
65 DGtal::Z3i::Domain domain(myCube.getLowerBound(),
66 myCube.getUpperBound());
67
69
71
72
73 // viewer << mySet << DGtal::Display3D::updateDisplay;
74
75
78 DTL2 dt(&domain,&mySet,&Z3i::l2Metric );
80
81 DTL2::Value maxDT = (*boost::first_max_element(dt.constRange().begin(),
82 dt.constRange().end()));
83
84
85 GradientColorMap<DTL2::Value> gradient( 0, maxDT);
86 gradient.addColor(DGtal::Color::Blue);
87 gradient.addColor(DGtal::Color::Green);
88 gradient.addColor(DGtal::Color::Yellow);
89 gradient.addColor(DGtal::Color::Red);
90
92 itend = domain.end(); it != itend;
93 ++it)
94 if (dt(*it) != 0)
95 {
96 viewer << DGtal::WithQuantity(*it, "value", dt(*it));
97 }
98 viewer << DGtal::ClippingPlane(1,0,0,0);
99
100 viewer.show();
101 return 0;
102}
static const Color Red
Definition Color.h:425
static const Color Blue
Definition Color.h:428
static const Color Yellow
Definition Color.h:431
static const Color Green
Definition Color.h:426
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
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...
const ConstIterator & begin() const
const ConstIterator & end() const
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create a rounded hypercu...
void show() override
Starts the event loop and display of elements.
static void euclideanShaper(TDigitalSet &aSet, const TShapeFunctor &aFunctor, const double h=1.0)
static const L2Metric l2Metric
Definition StdDefs.h:204
Point center(const std::vector< Point > &points)
Clipping plane.
Definition Display3D.h:299
Attach a property to an element.
Definition Display3D.h:331
Domain domain

References DGtal::GradientColorMap< PValue, PDefaultPreset, PDefaultFirstColor, PDefaultLastColor >::addColor(), DGtal::Display3D< Space, KSpace >::allowReuseList, DGtal::HyperRectDomain< TSpace >::begin(), DGtal::Color::Blue, domain, dt, DGtal::HyperRectDomain< TSpace >::end(), DGtal::Shapes< TDomain >::euclideanShaper(), DGtal::ImplicitRoundedHyperCube< TSpace >::getLowerBound(), DGtal::ImplicitRoundedHyperCube< TSpace >::getUpperBound(), DGtal::Color::Green, DGtal::Z3i::l2Metric, DGtal::Color::Red, DGtal::PolyscopeViewer< Space, KSpace >::show(), and DGtal::Color::Yellow.