arbor/morph/morphology.cpp
// Merge overlapping cables so that none of the cables in the output overlap.
// Used by the mextent constructor.
Merge overlapping cables so that none of the cables in the output overlap.
Used by the mextent constructor.
Merge overlapping cables so that none of the cables in the output overlap . Used by the mextent constructor .
mcable_list build_mextent_cables(const mcable_list& cables) {
    arb_assert(arb::test_invariants(cables));
    mcable_list cs;
    for (auto& c: cables) {
        mcable* prev = cs.empty()? nullptr: &cs.back();
        if (prev && prev->branch==c.branch && prev->dist_pos>=c.prox_pos) {
            prev->dist_pos = std::max(prev->dist_pos, c.dist_pos);
        }
        else {
            cs.push_back(c);
        }
    }
    return cs;
}
mcable_list build_mextent_cables ( const mcable_list & cables ) { arb_assert ( arb :: test_invariants ( cables ) ) ; mcable_list cs ; for ( auto & c : cables ) { mcable * prev = cs . empty ( ) ? nullptr : & cs . back ( ) ; if ( prev && prev -> branch == c . branch && prev -> dist_pos >= c . prox_pos ) { prev -> dist_pos = std :: max ( prev -> dist_pos , c . dist_pos ) ; } else { cs . push_back ( c ) ; } } return cs ; }
Merge overlapping cables so that none of the cables in the output overlap.
Merge overlapping cables so that none of the cables in the output overlap .