NearestNeighbor.h
Go to the documentation of this file.
1#ifndef GfxTL__NEARESTNEIGHBOR_HEADER__
2#define GfxTL__NEARESTNEIGHBOR_HEADER__
3
4namespace GfxTL
5{
6
7 template <class ScalarT, class IndexT = size_t>
8 struct NN
9 {
10 typedef ScalarT ScalarType;
11 typedef IndexT IndexType;
14
16 {
17 }
18
20 {
21 }
22
23 bool
24 operator<(const NN& nn) const
25 {
26 return sqrDist < nn.sqrDist;
27 }
28
29 bool
30 operator>(const NN& nn) const
31 {
32 return sqrDist > nn.sqrDist;
33 }
34
35 bool
36 operator<=(const NN& nn) const
37 {
38 return sqrDist <= nn.sqrDist;
39 }
40
41 bool
42 operator>=(const NN& nn) const
43 {
44 return sqrDist >= nn.sqrDist;
45 }
46
47 bool
48 operator==(const NN& nn) const
49 {
50 return sqrDist == nn.sqrDist && index == nn.index;
51 }
52
53 bool
54 operator!=(const NN& nn) const
55 {
56 return sqrDist != nn.sqrDist || index != nn.index;
57 }
58
59 operator IndexType() const
60 {
61 return index;
62 }
63
64 operator IndexType&()
65 {
66 return index;
67 }
68
69 operator ScalarType() const
70 {
71 return sqrDist;
72 }
73 };
74
75}; // namespace GfxTL
76
77#endif
Definition AABox.h:10
NN(ScalarType d, IndexType i)
bool operator<(const NN &nn) const
bool operator!=(const NN &nn) const
bool operator>(const NN &nn) const
typename BaseType::template DistanceType< typename ScalarTypeDeferer< PointT >::ScalarType, ScalarType >::Type ScalarType
bool operator>=(const NN &nn) const
bool operator<=(const NN &nn) const
bool operator==(const NN &nn) const