| 130 | int secondRot{ 0 }; |
| 131 | }; |
| 132 | std::vector<JoinedSelfLoops> findSelfContoursMapping( const ContinuousContours& contours ) |
| 133 | { |
| 134 | assert( contours.size() % 2 == 0 ); |
| 135 | std::vector<JoinedSelfLoops> holePairs( contours.size() / 2 ); |
| 136 | BitSet visitedConts( contours.size(), true ); |
| 137 | int i = 0; |
| 138 | while ( visitedConts.any() ) |
| 139 | { |
| 140 | size_t first = visitedConts.find_first(); |
| 141 | visitedConts.reset( first ); |
| 142 | auto fInter = contours[first][0]; |
| 143 | tbb::task_group_context ctx; |
| 144 | ParallelFor( visitedConts.beginId(), visitedConts.endId(), [&] ( size_t next ) |
| 145 | { |
| 146 | if ( ctx.is_group_execution_cancelled() || !visitedConts.test( next ) ) |
| 147 | return; |
| 148 | int rot = 0; |
| 149 | for ( const auto& nInter : contours[next] ) |
| 150 | { |
| 151 | if ( ctx.is_group_execution_cancelled() ) |
| 152 | return; |
| 153 | ++rot; |
| 154 | if ( fInter.isEdgeATriB() == nInter.isEdgeATriB() ) |
| 155 | continue; |
| 156 | if ( fInter.tri() != nInter.tri() ) |
| 157 | continue; |
| 158 | if ( fInter.edge != nInter.edge.sym() ) |
| 159 | continue; |
| 160 | if ( ctx.cancel_group_execution() ) |
| 161 | { |
| 162 | visitedConts.reset( next ); |
| 163 | holePairs[i++] = { int( first ),int( next ),rot - 1 }; |
| 164 | } |
| 165 | return; |
| 166 | } |
| 167 | } ); |
| 168 | } |
| 169 | return holePairs; |
| 170 | } |
| 171 | |
| 172 | enum LoneProccessingState |
| 173 | { |
no test coverage detected