// quick and dirty static bool is_between_( const great_circle::arc& a, const Eigen::Vector3d& p ) // quick and dirty, faster than great_circle::arc::has() { if( equal_( a.begin(), p ) || equal_( a.end(), p ) ) { return true; } // if( comma::math::equal( a.begin(), p, epsilon ) || comma::math::equal( a.end(), p, epsilon ) ) { return true; } double begin_angle = great_circle::arc::angle_axis(a.begin(), p ).angle(); double end_angle = great_circle::arc::angle_axis(p, a.end() ).angle(); return comma::math::equal( a.angle(), begin_angle + end_angle, coordinates::epsilon ); }
bool great_circle::arc::has( const Eigen::Vector3d& p ) const { //if( begin_coordinates_ == p || end_coordinates_ == p ) { return true; } if( equal_(begin_, p) || equal_(end_, p )) { return true; } //great_circle::arc a( begin_coordinates_, p ); Eigen::AngleAxis< double > a = arc::angle_axis(begin_, p); return equal_( axis(), a.axis() ) && comma::math::less( a.angle(), angle() ); }
bool great_circle::arc::overlaps( const great_circle::arc& rhs ) const // quick and dirty, potentially slow { return ( equal_( axis(), rhs.axis() ) || equal_( axis(), -rhs.axis() ) ) && ( has( rhs.begin_ ) || has( rhs.end_ ) || rhs.has( begin_ ) || rhs.has( end_ ) ); // return ( equal_( axis(), rhs.axis() ) || equal_( axis(), -rhs.axis() ) ) // && ( has( rhs.begin_coordinates() ) // || has( rhs.end_coordinates() ) // || rhs.has( begin_coordinates_ ) // || rhs.has( end_coordinates_ ) ); }
boost::optional< coordinates > great_circle::arc::intersection_with( const arc& rhs ) const { if (!may_intersect(rhs)) { return boost::optional< coordinates >(); } if( equal_( axis(), rhs.axis() ) || equal_( axis(), -rhs.axis() ) ) { return boost::optional< coordinates >(); } Eigen::Vector3d cross = axis().cross( rhs.axis() ); if( is_between_( *this, cross ) && is_between_( rhs, cross ) ) { snark::range_bearing_elevation a( cross ); // quick and dirty, quite excessive return coordinates( a.e(), a.b() ); } if( is_between_( *this, -cross ) && is_between_( rhs, -cross ) ) { snark::range_bearing_elevation a( -cross ); // quick and dirty, quite excessive return coordinates( a.e(), a.b() ); } return boost::optional< coordinates >(); }
virtual bool isEqual(void* object1, void* object2) { return equal_(object1, object2) != 0; }
bool equal(const darc::distributed_container::shared_map<std::string, uint32_t>& set1, const darc::distributed_container::shared_map<std::string, uint32_t>& set2) { return equal_(set1, set2) && equal_(set2, set1); }
virtual bool isEqual(const void* object1, const void* object2) { return equal_(object1, object2) != 0; }