cheshirekow  v0.1.0
Distance.hpp
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_DISTANCE_HPP_
28 #define MPBLOCKS_DUBINS_KD_TREE_DISTANCE_HPP_
29 
30 
31 
32 namespace mpblocks {
33 namespace dubins {
34 namespace kd_tree {
35 
36 
37 template <typename Format>
38 Format Distance<Format>::operator()( const State_t& q0, const State_t& q1 )
39 {
40  using namespace curves_eigen;
41  Path<Format> bestSoln = solve(q0,q1,m_radius);
42  return bestSoln.dist(m_radius);
43 }
44 
45 template <typename Format>
46 Format Distance<Format>::operator()( const State_t& q, const Hyper_t& h )
47 {
48  using namespace curves_eigen;
49  Path<Format> bestSoln = hyper::solve(q,h,m_radius);
50  return bestSoln.dist(m_radius);
51 }
52 
53 
54 } // namespace kd_tree
55 } // namespace dubins
56 } // namespace mpblocks
57 
58 
59 
60 #endif // DEFAULTDISTANCE_H_
Format operator()(const State_t &pa, const State_t &pb)
return the dubins shortest path distance from point a to point b
Definition: Distance.hpp:38
Encodes a dubins path primitive, which is three connected arc segments.
Definition: path.h:42
Path< Format_t > solve(const Eigen::Matrix< Format_t, 3, 1 > &q0, const HyperRect< Format_t > &h, const Format_t r)
Eigen::Matrix< Format, 3, 1 > State_t
Definition: Distance.h:42