check_neighbor.cpp
Go to the documentation of this file.
1 
24 
25 namespace micros_swarm{
26 
27  CheckNeighbor::CheckNeighbor(const float& neighbor_distance):neighbor_distance_(neighbor_distance) {}
28 
30  {
31  return neighbor_distance_;
32  }
33 
34  bool CheckNeighbor::isNeighbor(const Base& self, const Base& neighbor)
35  {
36  float distance = sqrt((self.x-neighbor.x)*(self.x-neighbor.x)+(self.y-neighbor.y)*(self.y-neighbor.y)+
37  (self.z-neighbor.z)*(self.z-neighbor.z));
38 
39  if(distance <= (neighbor_distance_))
40  return true;
41 
42  return false;
43  }
44 };
CheckNeighbor(const float &neighbor_distance)
bool isNeighbor(const Base &self, const Base &neighbor)
const float & neighbor_distance_


micros_swarm
Author(s):
autogenerated on Mon Jun 10 2019 14:02:06