DGtal 1.4.2
Loading...
Searching...
No Matches
MetricAdjacency.h
1
17#pragma once
18
31#if defined(MetricAdjacency_RECURSES)
32#error Recursive header files inclusion detected in MetricAdjacency.h
33#else // defined(MetricAdjacency_RECURSES)
35#define MetricAdjacency_RECURSES
36
37#if !defined MetricAdjacency_h
39#define MetricAdjacency_h
40
42// Inclusions
43#include <iostream>
44#include <set>
45#include <map>
46#include "DGtal/base/Common.h"
47#include "DGtal/kernel/CSpace.h"
48#include "DGtal/kernel/SpaceND.h"
49#include "DGtal/kernel/BasicPointPredicates.h"
51
52namespace DGtal
53{
54
56 // template class MetricAdjacency
77 template <typename TSpace, Dimension maxNorm1,
78 Dimension dimension = TSpace::dimension >
80 {
82 // ----------------------- public types ------------------------------
83 public:
84 // Required by CAdjacency
85 typedef TSpace Space;
86 typedef typename Space::Point Point;
88
89 // Others
90 typedef typename Space::Vector Vector;
91
92 // Required by CUndirectedSimpleLocalGraph
93 typedef Point Vertex;
94 typedef typename Space::Size Size;
95 typedef std::set<Vertex> VertexSet; // DigitalSet doesn't fit since MetricAdjacency has no domain
96 template <typename Value> struct VertexMap {
97 typedef typename std::map<Vertex, Value> Type;
98 };
99
100 // ----------------------- Standard services ------------------------------
101 public:
102
108
113
114 // ----------------------- Adjacency services -----------------------------
115 public:
116
124 static
125 bool isAdjacentTo( const Point & p1, const Point & p2 );
126
134 static
135 bool isProperlyAdjacentTo( const Point & p1, const Point & p2 );
136
137
138 // ----------------------- Local graph services --------------------------
139
143 static
145
151 static
152 Size degree( const Vertex & v );
153
165 template <typename OutputIterator>
166 static
167 void
168 writeNeighbors( OutputIterator &it ,
169 const Vertex & v );
170
187 template <typename OutputIterator, typename VertexPredicate>
188 static
189 void
190 writeNeighbors( OutputIterator &it ,
191 const Vertex & v,
192 const VertexPredicate & pred);
193
194 // ----------------------- Interface --------------------------------------
195 public:
196
201 static
202 void selfDisplay ( std::ostream & out );
203
208 static
209 bool isValid();
210
211 // ------------------------- Protected Datas ------------------------------
212 private:
213 // ------------------------- Private Datas --------------------------------
214 private:
215
216 // ------------------------- Hidden services ------------------------------
217 protected:
219
220 private:
221
228
236
237 // ------------------------- Internals ------------------------------------
238 private:
239
240 }; // end of class MetricAdjacency
241
248 template <typename TSpace, Dimension maxNorm1>
249 std::ostream&
250 operator<< ( std::ostream & out,
251 const MetricAdjacency< TSpace,maxNorm1,
252 TSpace::dimension > & object );
253
254} // namespace DGtal
255
256
258// Includes inline functions.
259#include "DGtal/topology/MetricAdjacency.ih"
260
261// //
263
264#endif // !defined MetricAdjacency_h
265
266#undef MetricAdjacency_RECURSES
267#endif // else defined(MetricAdjacency_RECURSES)
Aim: Describes digital adjacencies in digital spaces that are defined with the 1-norm and the infinit...
static void writeNeighbors(OutputIterator &it, const Vertex &v)
MetricAdjacency< Space, maxNorm1, dimension > Adjacency
static Size degree(const Vertex &v)
static bool isAdjacentTo(const Point &p1, const Point &p2)
BOOST_CONCEPT_ASSERT((concepts::CSpace< TSpace >))
static bool isProperlyAdjacentTo(const Point &p1, const Point &p2)
static void selfDisplay(std::ostream &out)
static Size computeCapacity()
static Size bestCapacity()
static void writeNeighbors(OutputIterator &it, const Vertex &v, const VertexPredicate &pred)
std::set< Vertex > VertexSet
static bool isValid()
MetricAdjacency(const MetricAdjacency &other)
MetricAdjacency & operator=(const MetricAdjacency &other)
size_t Size
Type used to represent sizes in the digital space.
Definition SpaceND.h:107
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
DGtal::uint32_t Dimension
Definition Common.h:136
std::map< Vertex, Value > Type
Aim: Defines the concept describing a digital space, ie a cartesian product of integer lines.
Definition CSpace.h:106