Main MRPT website > C++ reference for MRPT 1.5.9
CBinaryRelation.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 #ifndef CBINARYRELATION_H_
10 #define CBINARYRELATION_H_
11 
14 
15 #include <set>
16 #include <iterator>
17 #include <algorithm>
18 #include <utility>
19 
20 namespace mrpt { namespace math {
21  using std::vector;
22 
23  /**
24  * This class models a binary relation through the elements of any given set. I.e. for each pair of elements (A,B) it assigns two values, f(A,B) and f(B,A).
25  * This class is useful when calling the base function is costly, since it acts like a proxy. It's also useful if the relationship values do not correspond
26  * with the return value of a function. Although it theoretically supports objects with non-trivial constructors or destructors (indicated by specifying
27  * "true" as the thrid parameter of the template instantiation), certain operations will cause memory leaks and may even cause undefined behaviour, so it's
28  * reccomended to use only basic types for the parameter U. The parameter T may be any complex object, however, like a smart pointer.
29  * \ingroup mrpt_base_grp
30  */
31  template<typename T,typename U,bool UIsObject=false> class CBinaryRelation {
32  private:
33  //TODO: VIRTUALIZE INSERTROWSANDCOLS!!! AND REIMPLEMENT IN CMATRIXTEMPLATEOBJECTS.
34 
35  typedef typename detail::MatrixWrapper<U,UIsObject>::MatrixType MatrixType; //!<Matrix type used to store the actual relation.
36  public:
37  typedef U (*SimpleFunctionByReturnValue)(T,T); //!< Simple function type, used to initialize chunks of the matrix.
38  typedef U (*FunctionByReturnValue)(const T &,const T &); //!<Function type which obtains the relation value by a return value.
39  typedef void (*FunctionByReferencePass)(const T &,const T &,U &); //!<Function type which obtains the relation value by reference pass.
40  typedef typename std::set<T>::const_iterator const_iterator; //!<Constant iterator through the set elements.
41  typedef typename std::set<T>::const_reverse_iterator const_reverse_iterator; //!<Constant reverse iterator through the set elements.
42  typedef CMatrixRowAccessor<U> AccessorForFirstElement; //!<Accessor type to every value related to any element A, i.e., f(A,x).
43  typedef CMatrixColumnAccessor<U> AccessorForSecondElement; //!<Accessor type to every value related to any element B, i.e., f(x,B).
44  typedef CConstMatrixRowAccessor<U> ConstAccessorForFirstElement; //!<Const accessor type to every value related to any element A, i.e., f(A,x).
45  typedef CConstMatrixColumnAccessor<U> ConstAccessorForSecondElement; //!<Const accessor type to every value related to any element B, i.e., f(x,B).
46  private:
47  std::set<T> elements; //!<Actual set of elements.
48  MatrixType relation; //!<Matrix storing the relation.
49 
50  /**
51  * Template used to make the function interface independent from the function type.
52  * (wrapper for the global method - needed to make this compile under GCC).
53  */
54  template<typename FunctionType> inline void applyFunction(FunctionType fun,size_t e1,size_t e2,const T &T1,const T &T2) {
55  detail::applyFunction<T,U,UIsObject,FunctionType>(*this,fun,e1,e2,T1,T2);
56  }
57 
58  public:
59  /**
60  * Default constructor, doesn't initialize the relation.
61  */
62  explicit inline CBinaryRelation(const std::set<T> &els):elements(els),relation(els.size(),els.size()) {}
63  /**
64  * Constructor which initializes the relation using a given function.
65  */
66  template<typename FunctionType> inline CBinaryRelation(const std::set<T> &els,FunctionType fun):elements(els),relation(els.size(),els.size()) {
67  initializeWith(fun);
68  }
69  /**
70  * Initialize the whole relation with a given function.
71  */
72  template<typename FunctionType> void initializeWith(FunctionType fun) {
73  typename std::set<T>::const_iterator it=elements.begin();
74  for (size_t i=0;i<elements.size();++i,++it) {
75  typename std::set<T>::const_iterator jt=elements.begin();
76  for (size_t j=0;j<elements.size();++j,++jt) applyFunction(fun,i,j,*it,*jt);
77  }
78  }
79  /**
80  * Initialize the whole relation with a given function, assuming that the relation is symmetrical.
81  */
82  template<typename FunctionType> void initializeSymmetricallyWith(FunctionType fun) {
83  typename std::set<T>::const_iterator it=elements.begin();
84  for (size_t i=0;i<elements.size();++i,++it) {
85  applyFunction(fun,i,i,*it,*it);
86  typename std::set<T>::const_iterator jt=it;
87  jt++;
88  for (size_t j=i+1;j<elements.size();++j,++jt) {
89  applyFunction(fun,i,j,*it,*jt);
90  relation(j,i)=relation(i,j);
91  }
92  }
93  }
94  /**
95  * Manually set a relationship value, given the indices.
96  */
97  inline void setRelationValue(size_t e1,size_t e2,const U &newVal) {
98  relation.get_unsafe(e1,e2)=newVal;
99  }
100  /**
101  * Get a relation value, given the indices.
102  */
103  inline const U &getRelationValue(size_t e1,size_t e2) const {
104  return relation.get_unsafe(e1,e2);
105  }
106  inline const U &operator()(size_t e1,size_t e2) const {
107  return getRelationValue(e1,e2);
108  }
109  /**
110  * Get a reference to a relation value given its indices, which allows both querying and setting the value.
111  */
112  inline U &getRelationValue(size_t e1,size_t e2) {
113  return relation.get_unsafe(e1,e2);
114  }
115  inline U &operator()(size_t e1,size_t e2) {
116  return getRelationValue(e1,e2);
117  }
118  /**
119  * Manually set a relationship value, given the elements. Returns false if any of the elements is not present.
120  */
121  inline bool setRelationValue(const T &t1,const T &t2,const U &newVal) {
122  typename std::set<T>::const_iterator b=elements.begin(),e=elements.end();
123  typename std::set<T>::const_iterator it1=std::find(b,e,t1),it2=std::find(b,e,t2);
124  if (it1==e||it2==e) return false;
125  setRelationValue(static_cast<size_t>(std::distance(b,it1)),static_cast<size_t>(std::distance(b,it2)),newVal);
126  return true;
127  }
128  /**
129  * Get a relation value, given the elements. Throws domain_error if any of the elements is not present.
130  */
131  inline U getRelationValue(const T &t1,const T &t2) const {
132  typename std::set<T>::const_iterator b=elements.begin(),e=elements.end();
133  typename std::set<T>::const_iterator it1=std::find(b,e,t1),it2=std::find(b,e,t2);
134  if (it1==e||it2==e) throw std::domain_error("Element not found");
135  return getRelationValue(static_cast<size_t>(std::distance(b,it1)),static_cast<size_t>(std::distance(b,it2)));
136  }
137  /**
138  * Get a reference to a relation value given the elements, which allows both querying and setting. Throws domain_error if any of the elements is not
139  * present.
140  */
141  inline U &getRelationValue(const T &t1,const T &t2) {
142  typename std::set<T>::const_iterator b=elements.begin(),e=elements.end();
143  typename std::set<T>::const_iterator it1=std::find(b,e,t1),it2=std::find(b,e,t2);
144  if (it1==e||it2==e) throw std::domain_error("Element not found");
145  return getRelationValue(static_cast<size_t>(std::distance(b,it1)),static_cast<size_t>(distance(b,it2)));
146  }
147  /**
148  * Gets an iterator to the starting point of the elements set.
149  */
150  inline const_iterator begin() const {
151  return elements.begin();
152  }
153  /**
154  * Gets an iterator to the ending point of the elements set.
155  */
156  inline const_iterator end() const {
157  return elements.end();
158  }
159  /**
160  * Gets a reverse iterator to the ending point of the elements set.
161  */
163  return elements.rbegin();
164  }
165  /**
166  * Gets a reverse iterator to the starting point of the elements set.
167  */
168  inline const_reverse_iterator rend() const {
169  return elements.rend();
170  }
171  /**
172  * Operator for direct access to a element given its index.
173  */
174  T operator[](size_t i) const {
175  ASSERT_BELOW_(i,elements.size())
176  typename std::set<T>::const_iterator it=elements.begin();
177  std::advance(it,i);
178  return *it;
179  }
180  /**
181  * Gets an accessor for every value related to an element A given its index, i.e., every f(A,x). This accessor is iterable.
182  */
185  }
186  /**
187  * Gets a constant accessor for every value related to an element A given its index, i.e., every f(A,x). This accessor is iterable.
188  */
191  }
192  /**
193  * Gets an accessor for every value related to an element B given its index, i.e., every f(x,B). This accessor is iterable.
194  */
197  }
198  /**
199  * Gets a constant accessor for every value related to an element B given its index, i.e., every f(x,B). This accessor is fully iterable.
200  */
203  }
204  /**
205  * Gets an iterable accessor for every value related to an element A, i.e., every f(A,x). A domain_error will be thrown if the element is not present.
206  */
208  typename std::set<T>::const_iterator b=elements.begin(),e=elements.end();
209  typename std::set<T>::const_iterator it=std::find(b,e,t);
210  if (it==e) throw std::domain_error("Element not found");
211  return getRelationFrom(static_cast<size_t>(std::distance(b,it)));
212  }
213  /**
214  * Gets an iterable constant accessor for every value related to an element A, i.e., every f(A,x). A domain_error will be thrown if the element is not
215  * present.
216  */
218  typename std::set<T>::const_iterator b=elements.begin(),e=elements.end();
219  typename std::set<T>::const_iterator it=std::find(b,e,t);
220  if (it==e) throw std::domain_error("Element not found");
221  return getRelationFrom(static_cast<size_t>(std::distance(b,it)));
222  }
223  inline void getRelationFrom(size_t i,vector<U> &vec) {
224  size_t N=elements.size();
225  ASSERT_(i<N);
226  vec.resize(N);
228  std::copy(access.begin(),access.end(),vec.begin());
229  }
230  inline void getRelationFrom(const T &t,vector<U> &vec) {
231  typename std::set<T>::const_iterator b=elements.begin(),e=elements.end();
232  typename std::set<T>::const_iterator it=std::find(b,e,t);
233  if (it==e) throw std::domain_error("Element not found");
234  getRelationFrom(static_cast<size_t>(std::distance(b,it)),vec);
235  }
236  /**
237  * Gets an iterable accessor for every value related to an element B, i.e., every f(x,B). A domain_error will be thrown if the element is not present.
238  */
240  typename std::set<T>::const_iterator b=elements.begin(),e=elements.end();
241  typename std::set<T>::const_iterator it=std::find(b,e,t);
242  if (it==e) throw std::domain_error("Element not found");
243  return getRelationTo(static_cast<size_t>(std::distance(b,it)));
244  }
245  /**
246  * Gets an iterable constant accessor for every value related to an alement B, i.e., every f(x,B). A domain_error will be thrown if the element is not
247  * present.
248  */
250  typename std::set<T>::const_iterator b=elements.begin(),e=elements.end();
251  typename std::set<T>::const_iterator it=std::find(b,e,t);
252  if (it==e) throw std::domain_error("Element not found");
253  return getRelationTo(static_cast<size_t>(std::distance(b,it)));
254  }
255  inline void getRelationTo(size_t i,vector<U> &vec) {
256  size_t N=elements.size();
257  ASSERT_(i<N);
258  vec.resize(N);
260  std::copy(access.begin(),access.end(),vec.begin());
261  }
262  inline void getRelationTo(const T &t,vector<U> &vec) {
263  typename std::set<T>::const_iterator b=elements.begin(),e=elements.end();
264  typename std::set<T>::const_iterator it=std::find(b,e,t);
265  if (it==e) throw std::domain_error("Element not found");
266  getRelationTo(static_cast<size_t>(std::distance(b,it)),vec);
267  }
268  /**
269  * Removes an element at a concrete position.
270  */
271  void removeElementAt(size_t i) {
272  ASSERT_(i<elements.size());
273  typename std::set<T>::const_iterator it=elements.begin();
274  std::advance(it,i);
275  elements.erase(i);
276  std::set<size_t> ii;
277  ii.insert(i);
278  relation.removeRowsAndCols(ii,ii);
279  }
280  /**
281  * Removes an element. Returns false if the element was not present and thus could'nt be eliminated.
282  */
283  bool removeElement(const T &el) {
284  typename std::set<T>::const_iterator b=elements.begin(),e=elements.end();
285  typename std::set<T>::const_iterator it=std::find(e,b,el);
286  if (it==e) return false;
288  return true;
289  }
290  /**
291  * Removes a set of elements. Returns the number of elements which were actually erased.
292  */
293  size_t removeElements(const std::set<T> &vals) {
294  std::set<size_t> positions;
295  for (typename std::set<T>::const_iterator it=vals.begin();it!=vals.end();++it) {
296  typename std::set<T>::iterator elsIt=std::find(elements.begin(),elements.end(),*it);
297  if (elsIt!=elements.end()) positions.insert(std::distance(elements.begin(),elsIt));
298  }
299  removeElementsAt(positions);
300  return positions.size();
301  }
302  void removeElementsAt(const std::set<size_t> &poss) {
303  relation.removeRowsAndCols(poss,poss);
304  for (std::set<size_t>::const_reverse_iterator it=poss.rbegin();it!=poss.rend();++it) {
305  typename std::set<T>::const_iterator it2=elements.begin();
306  std::advance(it2,*it);
307  elements.erase(it2);
308  }
309  }
310  /**
311  * Inserts an element. If the element was present, returns false and its current position. If it wasn't, returns true and the position in which it was
312  * inserted.
313  */
314  std::pair<bool,size_t> insertElement(const T &el) {
316  size_t dist=std::distance(elements.begin(),ins.first);
317  if (ins.second) {
318  std::multiset<size_t> newEls;
319  newEls.insert(dist);
320  relation.insertRowsAndCols(newEls,newEls);
321  return std::make_pair(true,dist);
322  } else return std::make_pair(false,dist);
323  }
324  /**
325  * Inserts an element and initializes its relationship values, even if it was already present.
326  */
327  template<typename FunctionType> std::pair<bool,size_t> insertElement(const T &el,FunctionType fun) {
328  std::pair<bool,size_t> ins=insertElement(el);
329  size_t pos=ins.second;
330  for (size_t i=0;i<elements.size();++i) {
331  const T &newEl=operator[](i);
332  applyFunction(fun,pos,i,el,newEl);
333  applyFunction(fun,i,pos,newEl,el);
334  }
335  return ins;
336  }
337  /**
338  * Inserts a set of elements into the relation. Does not initialize the actual relation.
339  */
340  size_t insertElements(const std::set<T> &els) {
341  if (els.empty()) return 0;
342  //This code is much more complex than it should! Trying, for efficiency, to avoid multiple calls to insertElement makes things a lot harder.
343  //It raises the complexity level to N^2, but alleviates it greatly by making a single memory allocation. Multiple calls to insertElement will be
344  //faster only if the number of elements in the set is really large.
345  std::vector<size_t> added;
346  //std::vector<size_t> exist;
347  added.reserve(els.size());
348  for (typename std::set<T>::const_iterator it=els.begin();it!=els.end();++it) {
350  size_t dist=std::distance(elements.begin(),ins.first);
351  if (ins.second) {
352  added.push_back(dist);
353  for (std::vector<size_t>::iterator it2=added.begin();it2!=added.end();++it2) if (*it2>=dist) ++(*it2);
354  //for (std::vector<size_t>::iterator it2=exist.begin();it2!=exist.end();++it2) if (*it2>=dist) ++(*it2);
355  }// else exist.push_back(dist);
356  }
357  std::sort(added.begin(),added.end());
358  for (size_t j=1;j<added.size();++j) added[j]-=j;
359  std::multiset<size_t> poss(added.begin(),added.end());
360  relation.insertRowsAndCols(poss,poss);
361  return added.size();
362  }
363  /**
364  * Inserts a set of elements into the relation, initializing the actual relation with a given function.
365  */
366  template<typename FunctionType> size_t insertElements(const std::set<T> &els,FunctionType fun) {
367  if (els.empty()) return 0;
368  size_t howMany=insertElements(els);
369  std::set<size_t> poss;
370  {
371  //Little scope for "begin" and "end"...
372  typename std::set<T>::const_iterator begin=elements.begin(),end=elements.end();
373  for (typename std::set<T>::const_iterator it=els.begin();it!=els.end();++it) poss.insert(std::distance(begin,find(begin,end,*it)));
374  }
375  std::set<size_t> nPoss;
376  std::set<size_t>::const_iterator begin=poss.begin(),end=poss.end();
377  for (size_t i=0;i<elements.size();++i) if (std::find(begin,end,i)==end) nPoss.insert(i);
378  vector<const T *> proxy;
379  proxy.reserve(poss.size());
380  for (std::set<size_t>::const_iterator it=begin;it!=end;++it) {
381  const T &e1=operator[](*it);
382  proxy.push_back(&e1);
383  size_t i=0;
384  for (typename std::set<T>::const_iterator it2=elements.begin();it2!=elements.end();++it2,++i) applyFunction(fun,*it,i,e1,*it2);
385  }
386  for (std::set<size_t>::const_iterator it=nPoss.begin();it!=nPoss.end();++it) {
387  const T &e1=operator[](*it);
388  typename std::vector<const T *>::const_iterator itV=proxy.begin();
389  for (std::set<size_t>::const_iterator it2=poss.begin();it2!=poss.end();++it2,++itV) applyFunction(fun,*it,*it2,e1,**itV);
390  }
391  return howMany;
392  }
393  /**
394  * Completely resets the relation, using a new set of elements. Does not initialize the relation.
395  */
396  void setElements(const std::set<T> &newEls) {
397  relation.setSize(0,0);
398  elements=newEls;
399  relation.setSize(newEls.size(),newEls.size());
400  }
401  /**
402  * Returns the amount of elements present in the relation.
403  */
404  inline size_t size() const {
405  return elements.size();
406  }
407  };
408 
409  namespace detail {
410  // generic version (specialization is after definition of CBinaryRelation):
411  template<typename T,typename U,bool UIsObject,typename FunctionType> inline void applyFunction(CBinaryRelation<T,U,UIsObject> &o, FunctionType fun,size_t e1,size_t e2,const T &T1,const T &T2) {
412  o.getRelationValue(e1,e2)=fun(T1,T2);
413  }
414 
415  /** Template specialization by reference type.
416  */
417  template<typename T,typename U,bool UIsObject> inline void applyFunction(CBinaryRelation<T,U,UIsObject> &o,typename CBinaryRelation<T,U,UIsObject>::FunctionByReferencePass fun,size_t e1,size_t e2,const T &T1,const T &T2) {
418  fun(T1,T2,o.getRelationValue(e1,e2));
419  }
420  }
421 
422 
423 }} //End of namespaces
424 #endif
A vector-like wrapper for a const Matrix for accessing the elements of a given column with a [] opera...
void applyFunction(CBinaryRelation< T, U, UIsObject > &o, FunctionType fun, size_t e1, size_t e2, const T &T1, const T &T2)
U & getRelationValue(size_t e1, size_t e2)
Get a reference to a relation value given its indices, which allows both querying and setting the val...
const_iterator end() const
Gets an iterator to the ending point of the elements set.
This template is a trick to switch the type of a variable using a boolean variable in the template...
GLdouble GLdouble t
Definition: glext.h:3610
void setRelationValue(size_t e1, size_t e2, const U &newVal)
Manually set a relationship value, given the indices.
ConstAccessorForFirstElement getRelationFrom(size_t i) const
Gets a constant accessor for every value related to an element A given its index, i...
CConstMatrixColumnAccessor< U > ConstAccessorForSecondElement
Const accessor type to every value related to any element B, i.e., f(x,B).
CMatrixRowAccessor< U > AccessorForFirstElement
Accessor type to every value related to any element A, i.e., f(A,x).
void removeElementsAt(const std::set< size_t > &poss)
std::pair< bool, size_t > insertElement(const T &el)
Inserts an element.
size_t insertElements(const std::set< T > &els)
Inserts a set of elements into the relation.
#define ASSERT_BELOW_(__A, __B)
Scalar * iterator
Definition: eigen_plugins.h:23
This class models a binary relation through the elements of any given set.
const Scalar * const_iterator
Definition: eigen_plugins.h:24
const_iterator find(const KEY &key) const
Definition: ts_hash_map.h:139
AccessorForFirstElement getRelationFrom(size_t i)
Gets an accessor for every value related to an element A given its index, i.e., every f(A...
void applyFunction(FunctionType fun, size_t e1, size_t e2, const T &T1, const T &T2)
Template used to make the function interface independent from the function type.
const_iterator begin() const
Gets an iterator to the starting point of the elements set.
void getRelationTo(size_t i, vector< U > &vec)
void getRelationFrom(size_t i, vector< U > &vec)
size_t removeElements(const std::set< T > &vals)
Removes a set of elements.
A vector-like wrapper for a const Matrix for accessing the elements of a given row with a [] operator...
size_t insertElements(const std::set< T > &els, FunctionType fun)
Inserts a set of elements into the relation, initializing the actual relation with a given function...
std::set< T > elements
Actual set of elements.
ConstAccessorForSecondElement getRelationTo(size_t i) const
Gets a constant accessor for every value related to an element B given its index, i...
U & getRelationValue(const T &t1, const T &t2)
Get a reference to a relation value given the elements, which allows both querying and setting...
MatrixType relation
Matrix storing the relation.
ConstAccessorForSecondElement getRelationTo(const T &t) const
Gets an iterable constant accessor for every value related to an alement B, i.e., every f(x...
GLuint GLuint end
Definition: glext.h:3512
detail::MatrixWrapper< U, UIsObject >::MatrixType MatrixType
Matrix type used to store the actual relation.
void initializeWith(FunctionType fun)
Initialize the whole relation with a given function.
const_reverse_iterator rend() const
Gets a reverse iterator to the starting point of the elements set.
GLubyte GLubyte b
Definition: glext.h:5575
A vector-like wrapper for a Matrix for accessing the elements of a given row with a [] operator...
void setElements(const std::set< T > &newEls)
Completely resets the relation, using a new set of elements.
void getRelationFrom(const T &t, vector< U > &vec)
void getRelationTo(const T &t, vector< U > &vec)
U(* SimpleFunctionByReturnValue)(T, T)
Simple function type, used to initialize chunks of the matrix.
CBinaryRelation(const std::set< T > &els, FunctionType fun)
Constructor which initializes the relation using a given function.
std::set< T >::const_reverse_iterator const_reverse_iterator
Constant reverse iterator through the set elements.
CConstMatrixRowAccessor< U > ConstAccessorForFirstElement
Const accessor type to every value related to any element A, i.e., f(A,x).
void removeElementAt(size_t i)
Removes an element at a concrete position.
bool removeElement(const T &el)
Removes an element.
AccessorForSecondElement getRelationTo(size_t i)
Gets an accessor for every value related to an element B given its index, i.e., every f(x...
U(* FunctionByReturnValue)(const T &, const T &)
Function type which obtains the relation value by a return value.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
CBinaryRelation(const std::set< T > &els)
Default constructor, doesn&#39;t initialize the relation.
const U & getRelationValue(size_t e1, size_t e2) const
Get a relation value, given the indices.
void initializeSymmetricallyWith(FunctionType fun)
Initialize the whole relation with a given function, assuming that the relation is symmetrical...
CMatrixColumnAccessor< U > AccessorForSecondElement
Accessor type to every value related to any element B, i.e., f(x,B).
void(* FunctionByReferencePass)(const T &, const T &, U &)
Function type which obtains the relation value by reference pass.
size_t size() const
Returns the amount of elements present in the relation.
#define ASSERT_(f)
ConstAccessorForFirstElement getRelationFrom(const T &t) const
Gets an iterable constant accessor for every value related to an element A, i.e., every f(A...
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
GLsizeiptr size
Definition: glext.h:3779
bool setRelationValue(const T &t1, const T &t2, const U &newVal)
Manually set a relationship value, given the elements.
AccessorForSecondElement getRelationTo(const T &t)
Gets an iterable accessor for every value related to an element B, i.e., every f(x,B).
T operator[](size_t i) const
Operator for direct access to a element given its index.
std::pair< bool, size_t > insertElement(const T &el, FunctionType fun)
Inserts an element and initializes its relationship values, even if it was already present...
A vector-like wrapper for a Matrix for accessing the elements of a given column with a [] operator...
U & operator()(size_t e1, size_t e2)
std::set< T >::const_iterator const_iterator
Constant iterator through the set elements.
const U & operator()(size_t e1, size_t e2) const
const_reverse_iterator rbegin() const
Gets a reverse iterator to the ending point of the elements set.
AccessorForFirstElement getRelationFrom(const T &t)
Gets an iterable accessor for every value related to an element A, i.e., every f(A,x).
U getRelationValue(const T &t1, const T &t2) const
Get a relation value, given the elements.
double BASE_IMPEXP distance(const TPoint2D &p1, const TPoint2D &p2)
Gets the distance between two points in a 2D space.
Definition: geometry.cpp:1504



Page generated by Doxygen 1.8.14 for MRPT 1.5.9 Git: 690a4699f Wed Apr 15 19:29:53 2020 +0200 at miƩ abr 15 19:30:12 CEST 2020