+ if ( !ignoreCorners && !branchesToCheckEnd.empty() )
+ {
+ // split branches having branch-point inside
+ // (a branch-point was not detected since another branch is joined at the opposite side)
+ for ( size_t i = 0; i < branchesToCheckEnd.size(); ++i )
+ {
+ vector<const TVDEdge*> & branch = branchEdges[ branchesToCheckEnd[i].first ];
+ const TVDVertex* branchPoint = branchesToCheckEnd[i].second;
+ if ( branch.front()->vertex1() == branchPoint ||
+ branch.back ()->vertex0() == branchPoint )
+ continue; // OK - branchPoint is at a branch end
+
+ // find a MA edge where another branch begins
+ size_t iE;
+ for ( iE = 0; iE < branch.size(); ++iE )
+ if ( branch[iE]->vertex1() == branchPoint )
+ break;
+ if ( iE < branch.size() )
+ {
+ // split the branch
+ branchEdges.resize(( branchID = branchEdges.size()) + 1 );
+ vector<const TVDEdge*> & branch2 = branchEdges[ branchID ];
+ branch2.assign( branch.begin()+iE, branch.end() );
+ branch.resize( iE );
+ for ( iE = 0; iE < branch2.size(); ++iE )
+ if ( BndSeg* bs = BndSeg::getBndSegOfEdge( branch2[iE], bndSegsPerEdge ))
+ bs->setBranch( branchID, bndSegsPerEdge );
+ }
+ }
+ }
+