static inline void analyze(Ratio const& r, int& in_segment_count, int& on_end_count, int& outside_segment_count) { if (r.on_end()) { on_end_count++; } else if (r.in_segment()) { in_segment_count++; } else { outside_segment_count++; } }
static inline int arrival_value(Ratio const& r_from, Ratio const& r_to) { // a1--------->a2 // b1----->b2 // a departs: -1 // a1--------->a2 // b1----->b2 // a arrives: 1 // a1--------->a2 // b1----->b2 // both arrive there -> r-to = 1/1, or 0/1 (on_segment) // First check the TO (for arrival), then FROM (for departure) return r_to.in_segment() ? 1 : r_to.on_segment() ? 0 : r_from.on_segment() ? -1 : -1 ; }