cheshirekow  v0.1.0
Nearest.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 Josh Bialkowski (jbialk@mit.edu)
3  *
4  * This file is part of mpblocks.
5  *
6  * mpblocks is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * mpblocks is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with mpblocks. If not, see <http://www.gnu.org/licenses/>.
18  */
27 #ifndef MPBLOCKS_DUBINS_KD_TREE_NEAREST_H_
28 #define MPBLOCKS_DUBINS_KD_TREE_NEAREST_H_
29 
30 
31 namespace mpblocks {
32 namespace dubins {
33 namespace kd_tree {
34 
35 
36 template <typename Scalar>
37 class Nearest :
38  public mpblocks::kd_tree::NearestSearchIface< Traits<Scalar> >
39 {
40  public:
41  typedef typename Traits<Scalar>::Node Node_t;
43 
45  typedef Eigen::Matrix<Scalar,3,1> Point;
46 
47  private:
49  Scalar m_d2Best;
51 
52  public:
53  virtual ~Nearest(){};
54 
55  // reset d2Best to be infinity
56  void reset( );
57 
58  // return the result
59  Node_t* result();
60 
63  virtual void evaluate(const Point& q, const Point& p, Node_t* n);
64 
68  virtual bool shouldRecurse(const Point& q, const HyperRect_t& r );
69 };
70 
71 
72 
73 
74 
75 
76 } // namespace kd_tree
77 } // namespace dubins
78 } // namespace mpblocks
79 
80 
81 
82 
83 
84 
85 
86 
87 #endif // NEARESTNEIGHBOR_H_
virtual bool shouldRecurse(const Point &q, const HyperRect_t &r)
evaluate the Euclidean distance from q to it's closest point in r and if that distance is less than t...
Definition: Nearest.hpp:71
virtual void evaluate(const Point &q, const Point &p, Node_t *n)
calculates Euclidean distance from q to p, and if its less than the current best replaces the current...
Definition: Nearest.hpp:57
Traits< Scalar >::Node Node_t
Definition: Nearest.h:41
Interface for nearest node type searches.
Definition: NearestSearch.h:38
Traits< Scalar >::HyperRect HyperRect_t
Definition: Nearest.h:42
Eigen::Matrix< Scalar, 3, 1 > Point
Definition: Nearest.h:45
Distance< Scalar > Distance_t
Definition: Nearest.h:44