DGtal 1.3.0
Loading...
Searching...
No Matches
shapeDTViewer.cpp
1
32#include <iostream>
33#include <fstream>
34#include <algorithm>
36
38#include "DGtal/base/Common.h"
39#include "DGtal/helpers/StdDefs.h"
40#include "ConfigExamples.h"
41
42#include "DGtal/shapes/Shapes.h"
43#include "DGtal/shapes/ShapeFactory.h"
44#include "DGtal/io/DrawWithDisplay3DModifier.h"
45#include "DGtal/io/viewers/Viewer3D.h"
46
47#include "DGtal/geometry/volumes/distance/DistanceTransformation.h"
48#include "DGtal/io/colormaps/GradientColorMap.h"
49#include "DGtal/helpers/StdDefs.h"
50
51#include <boost/algorithm/minmax_element.hpp>
53
54
56
57using namespace DGtal;
58
59int main(int argc, char **argv)
60{
61 QApplication application(argc,argv);
62
63 DGtal::Viewer3D<> viewer;
64
66 DGtal::ImplicitRoundedHyperCube<Z3i::Space> myCube( center, 20, 2.8);
67 DGtal::Z3i::Domain domain(myCube.getLowerBound(),
68 myCube.getUpperBound());
69
71
73
74
75 viewer.show();
76 // viewer << mySet << DGtal::Display3D::updateDisplay;
77
78
81 DTL2 dt(&domain,&mySet,&Z3i::l2Metric );
83
84 DTL2::Value maxDT = (*boost::first_max_element(dt.constRange().begin(),
85 dt.constRange().end()));
86
87
88 GradientColorMap<DTL2::Value> gradient( 0, maxDT);
89 gradient.addColor(DGtal::Color::Blue);
90 gradient.addColor(DGtal::Color::Green);
91 gradient.addColor(DGtal::Color::Yellow);
92 gradient.addColor(DGtal::Color::Red);
93
94
96 itend = domain.end(); it != itend;
97 ++it)
98 if (dt(*it) != 0)
99 {
100 DTL2::Value val= dt( *it );
101 DGtal::Color c= gradient(val);
102
103 viewer << DGtal::CustomColors3D(c,c) << *it ;
104
105 }
106
107
108 viewer << DGtal::ClippingPlane(1,0,0,0);
109 //@todo updateDisplay is in Display3D or Viewer3D (cf doc)?
110 viewer << DGtal::Viewer3D<>::updateDisplay;
111
112 return application.exec();
113
114
115}
116
Structure representing an RGB triple with alpha component.
Definition: Color.h:68
static const Color Yellow
Definition: Color.h:422
static const Color Green
Definition: Color.h:417
static const Color Red
Definition: Color.h:416
static const Color Blue
Definition: Color.h:419
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...
Iterator for HyperRectDomain.
const ConstIterator & begin() const
const ConstIterator & end() const
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create a rounded hypercu...
static void euclideanShaper(TDigitalSet &aSet, const TShapeFunctor &aFunctor, const double h=1.0)
virtual void show()
Overload QWidget method in order to add a call to updateList() method (to ensure that the lists are w...
static const L2Metric l2Metric
Definition: StdDefs.h:204
Point center(const std::vector< Point > &points)
DGtal is the top-level namespace which contains all DGtal functions and types.
Class for adding a Clipping plane through the Viewer3D stream. Realizes the concept CDrawableWithView...
int main()
Definition: testBits.cpp:56
Domain domain