hpp-core  6.0.0
Implement basic classes for canonical path planning for kinematic chains.
nearest-neighbor.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2014 CNRS
3 // Authors: Florent Lamiraux
4 //
5 
6 // Redistribution and use in source and binary forms, with or without
7 // modification, are permitted provided that the following conditions are
8 // met:
9 //
10 // 1. Redistributions of source code must retain the above copyright
11 // notice, this list of conditions and the following disclaimer.
12 //
13 // 2. Redistributions in binary form must reproduce the above copyright
14 // notice, this list of conditions and the following disclaimer in the
15 // documentation and/or other materials provided with the distribution.
16 //
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
28 // DAMAGE.
29 
30 #ifndef HPP_CORE_NEAREST_NEIGHBOR_HH
31 #define HPP_CORE_NEAREST_NEIGHBOR_HH
32 
33 #include <hpp/core/fwd.hh>
34 #include <hpp/util/serialization-fwd.hh>
35 
36 namespace hpp {
37 namespace core {
40  public:
41  virtual void clear() = 0;
42  virtual void addNode(const NodePtr_t& node) = 0;
43 
53  virtual NodePtr_t search(ConfigurationIn_t configuration,
54  const ConnectedComponentPtr_t& connectedComponent,
55  value_type& distance, bool reverse = false) = 0;
56 
57  virtual NodePtr_t search(const NodePtr_t& node,
58  const ConnectedComponentPtr_t& connectedComponent,
59  value_type& distance) = 0;
60 
64  ConfigurationIn_t configuration,
65  const ConnectedComponentPtr_t& connectedComponent, const std::size_t K,
66  value_type& distance) = 0;
67 
71  const NodePtr_t& node, const ConnectedComponentPtr_t& connectedComponent,
72  const std::size_t K, value_type& distance) = 0;
73 
79  virtual Nodes_t KnearestSearch(ConfigurationIn_t configuration,
80  const RoadmapPtr_t& roadmap,
81  const std::size_t K, value_type& distance) = 0;
82 
85  virtual NodeVector_t withinBall(ConfigurationIn_t configuration,
86  const ConnectedComponentPtr_t& cc,
87  value_type maxDistance) = 0;
88 
89  // merge two connected components in the whole tree
90  virtual void merge(ConnectedComponentPtr_t cc1,
91  ConnectedComponentPtr_t cc2) = 0;
92 
93  // Get distance function
94  virtual DistancePtr_t distance() const = 0;
95 
96  virtual ~NearestNeighbor() {};
97 
98  private:
99  HPP_SERIALIZABLE();
100 }; // class NearestNeighbor
101 } // namespace core
102 } // namespace hpp
103 
104 #endif // HPP_CORE_NEAREST_NEIGHBOR_HH
Optimization of the nearest neighbor search.
Definition: nearest-neighbor.hh:39
virtual NodePtr_t search(ConfigurationIn_t configuration, const ConnectedComponentPtr_t &connectedComponent, value_type &distance, bool reverse=false)=0
search Return the closest node of the given configuration
virtual NodePtr_t search(const NodePtr_t &node, const ConnectedComponentPtr_t &connectedComponent, value_type &distance)=0
virtual void merge(ConnectedComponentPtr_t cc1, ConnectedComponentPtr_t cc2)=0
virtual ~NearestNeighbor()
Definition: nearest-neighbor.hh:96
virtual void addNode(const NodePtr_t &node)=0
virtual Nodes_t KnearestSearch(ConfigurationIn_t configuration, const RoadmapPtr_t &roadmap, const std::size_t K, value_type &distance)=0
virtual DistancePtr_t distance() const =0
virtual void clear()=0
virtual Nodes_t KnearestSearch(ConfigurationIn_t configuration, const ConnectedComponentPtr_t &connectedComponent, const std::size_t K, value_type &distance)=0
virtual NodeVector_t withinBall(ConfigurationIn_t configuration, const ConnectedComponentPtr_t &cc, value_type maxDistance)=0
virtual Nodes_t KnearestSearch(const NodePtr_t &node, const ConnectedComponentPtr_t &connectedComponent, const std::size_t K, value_type &distance)=0
Definition: node.hh:46
pinocchio::value_type value_type
Definition: fwd.hh:174
shared_ptr< Distance > DistancePtr_t
Definition: fwd.hh:141
std::vector< NodePtr_t > NodeVector_t
Definition: fwd.hh:182
shared_ptr< Roadmap > RoadmapPtr_t
Definition: fwd.hh:199
pinocchio::ConfigurationIn_t ConfigurationIn_t
Definition: fwd.hh:108
std::list< NodePtr_t > Nodes_t
Definition: fwd.hh:181
shared_ptr< ConnectedComponent > ConnectedComponentPtr_t
Definition: fwd.hh:117
Definition: bi-rrt-planner.hh:35