xc
KDTreePos.h
1 // -*-c++-*-
2 //----------------------------------------------------------------------------
3 // xc utils library; general purpose classes and functions.
4 //
5 // Copyright (C) Luis C. Pérez Tato
6 //
7 // XC utils is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // This software is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program.
19 // If not, see <http://www.gnu.org/licenses/>.
20 //----------------------------------------------------------------------------
21 //KDTreePos.h
22 #ifndef KDTreePos_h
23 #define KDTreePos_h
24 
25 #include <cstdlib>
26 
27 class Pos3d;
28 
31 class KDTreePos
32  {
33  public:
34  typedef double value_type;
35  private:
36  value_type d[3];
37  public:
38  explicit KDTreePos(const Pos3d &p);
39  double distance_to(const KDTreePos &other) const;
40  inline value_type operator[](const size_t &N) const { return d[N]; }
41  };
42 
43 #endif
KDTreePos(const Pos3d &p)
Constructor.
Definition: KDTreePos.cc:28
double distance_to(const KDTreePos &other) const
Distance between positions.
Definition: KDTreePos.cc:32
Posición en tres dimensiones.
Definition: Pos3d.h:44
Base class for KDTree positions.
Definition: KDTreePos.h:31