00001 00011 #ifndef SPHERECONNECTIONPREDICATE_H 00012 #define SPHERECONNECTIONPREDICATE_H 00013 00014 #include <ConnectionDecisionPredicateSpecialization.h> 00015 00017 00021 class SphereConnectionPredicate : public SpatialConnectionDecisionPredicate { 00022 00023 public: 00024 00026 SphereConnectionPredicate( double radius ) 00027 : radius(radius) { /* NOOP */ 00028 }; 00029 00031 virtual bool decide( size_t src, size_t dst, RandomEngine *rnd ) { 00032 return ( sqr_distance( m_sourcePopulation->getLocation(src), m_destinationPopulation->getLocation(dst) ) < radius 00033 && ( m_sourcePopulation->getID(src) != m_destinationPopulation->getID(dst) ) ); 00034 }; 00035 00036 private: 00037 double radius; 00038 00039 }; 00040 00041 #endif