check_neighbor.cpp
Go to the documentation of this file.
00001 
00023 #include "micros_swarm/check_neighbor.h"
00024 
00025 namespace micros_swarm{
00026 
00027     CheckNeighbor::CheckNeighbor(const float& neighbor_distance):neighbor_distance_(neighbor_distance) {}
00028 
00029     float CheckNeighbor::getNeighborDistance()
00030     {
00031         return neighbor_distance_;
00032     }
00033 
00034     bool CheckNeighbor::isNeighbor(const Base& self, const Base& neighbor)
00035     {
00036         float distance = sqrt((self.x-neighbor.x)*(self.x-neighbor.x)+(self.y-neighbor.y)*(self.y-neighbor.y)+
00037                               (self.z-neighbor.z)*(self.z-neighbor.z));
00038 
00039         if(distance <= (neighbor_distance_))
00040             return true;
00041 
00042         return false;
00043     }
00044 };


micros_swarm
Author(s):
autogenerated on Thu Jun 6 2019 18:52:14