| 381 | } |
| 382 | |
| 383 | TerrainEmbedder::ConnectionEdges TerrainEmbedder::connect_( std::vector<EdgeLoop>&& hole, MappedMeshContours&& mmc ) |
| 384 | { |
| 385 | WholeEdgeMap emap; |
| 386 | auto faceNum = int( result_.topology.faceSize() ); |
| 387 | result_.addMesh( cutStructure_, nullptr, nullptr, &emap ); |
| 388 | if ( params_.outStructFaces ) |
| 389 | { |
| 390 | params_.outStructFaces->resize( result_.topology.faceSize() ); |
| 391 | params_.outStructFaces->set( FaceId( faceNum ), params_.outStructFaces->size() - faceNum, true ); |
| 392 | } |
| 393 | |
| 394 | int prevBaseInd = 0; |
| 395 | int* prevMptIndexPtr{ nullptr }; |
| 396 | for ( int i = 0; i < mmc.map.size(); ++i ) |
| 397 | { |
| 398 | for ( int j = 0; j < std::min( mmc.map[i].size(), mmc.filtBowTiesMap[i].size() ); ++j ) |
| 399 | { |
| 400 | auto cutEdgeIndex = mmc.map[i][j]; |
| 401 | auto initMtpIndex = mmc.filtBowTiesMap[i][j]; |
| 402 | if ( initMtpIndex == -1 || cutEdgeIndex == -1 ) |
| 403 | continue; |
| 404 | |
| 405 | auto baseEdgeIndex = findOffsetContourIndex_( initMtpIndex, mmc.offsetMap ); |
| 406 | if ( baseEdgeIndex + 1 >= mmc.offsetMap.size() ) |
| 407 | continue; |
| 408 | |
| 409 | if ( prevMptIndexPtr && baseEdgeIndex < prevBaseInd ) |
| 410 | { |
| 411 | *prevMptIndexPtr = -1; // disable doubtable mappings |
| 412 | // restart after filter |
| 413 | prevMptIndexPtr = nullptr; |
| 414 | i = 0; |
| 415 | j = 0; |
| 416 | } |
| 417 | |
| 418 | prevMptIndexPtr = &mmc.filtBowTiesMap[i][j]; |
| 419 | prevBaseInd = baseEdgeIndex; |
| 420 | } |
| 421 | } |
| 422 | |
| 423 | ConnectionEdges connectionInfo; |
| 424 | for ( int i = 0; i < mmc.map.size(); ++i ) |
| 425 | { |
| 426 | for ( int j = 0; j < std::min( mmc.map[i].size(), mmc.filtBowTiesMap[i].size() ); ++j ) |
| 427 | { |
| 428 | auto cutEdgeIndex = mmc.map[i][j]; |
| 429 | auto initMtpIndex = mmc.filtBowTiesMap[i][j]; |
| 430 | if ( initMtpIndex == -1 || cutEdgeIndex == -1 ) |
| 431 | continue; |
| 432 | |
| 433 | auto baseEdgeIndex = findOffsetContourIndex_( initMtpIndex, mmc.offsetMap ); |
| 434 | if ( baseEdgeIndex + 1 >= mmc.offsetMap.size() ) |
| 435 | continue; |
| 436 | |
| 437 | auto e = result_.topology.prev( hole[i][cutEdgeIndex] ); |
| 438 | auto be = mapEdge( emap, bounds_[0][baseEdgeIndex] ); |
| 439 | if ( mmc.intBitSet.test( VertId( baseEdgeIndex ) ) ) |
| 440 | { |
nothing calls this directly
no test coverage detected