| 222 | } |
| 223 | |
| 224 | static size_t addTrianglesSeqCore( MeshTopology& res, const Triangulation & t, const BuildSettings & settings = {} ) |
| 225 | { |
| 226 | MR_TIMER; |
| 227 | |
| 228 | FaceAdder fa; |
| 229 | // we will try to add these triangles in the current pass |
| 230 | FaceBitSet active = getLocalRegion( settings.region, t.size() ); |
| 231 | // these are triangles that cannot be added even after other triangles |
| 232 | FaceBitSet bad; |
| 233 | size_t triAddedTotal = 0; |
| 234 | for (;;) |
| 235 | { |
| 236 | size_t triAddedOnThisPass = 0; |
| 237 | for ( FaceId f : active ) |
| 238 | { |
| 239 | auto x = fa.add( res, f + settings.shiftFaceId, t[f].data(), t[f].data() + 3, settings.allowNonManifoldEdge ); |
| 240 | if ( x == AddFaceResult::UnsafeTryLater ) |
| 241 | continue; |
| 242 | active.reset( f ); |
| 243 | if ( x != AddFaceResult::Success ) |
| 244 | bad.autoResizeSet( f ); |
| 245 | else |
| 246 | ++triAddedOnThisPass; |
| 247 | } |
| 248 | |
| 249 | if ( triAddedOnThisPass == 0 ) |
| 250 | break; // no single triangle added during the pass |
| 251 | triAddedTotal += triAddedOnThisPass; |
| 252 | } |
| 253 | if ( settings.region || settings.skippedFaceCount ) |
| 254 | { |
| 255 | active |= bad; |
| 256 | if ( settings.skippedFaceCount ) |
| 257 | *settings.skippedFaceCount = (int)active.count(); |
| 258 | if ( settings.region ) |
| 259 | *settings.region = std::move( active ); |
| 260 | } |
| 261 | return triAddedTotal; |
| 262 | } |
| 263 | |
| 264 | MeshTopology fromFaceSoup( const std::vector<VertId> & verts, const Vector<VertSpan, FaceId> & faces, |
| 265 | const BuildSettings & settings, ProgressCallback progressCb ) |
no test coverage detected