MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / connect_

Method connect_

source/MRMesh/MREmbedTerrainStructure.cpp:383–459  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

381}
382
383TerrainEmbedder::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 {

Callers

nothing calls this directly

Calls 14

minFunction · 0.85
mapEdgeFunction · 0.85
makeBridgeEdgeFunction · 0.85
faceSizeMethod · 0.80
addMeshMethod · 0.80
push_backMethod · 0.80
resizeMethod · 0.45
setMethod · 0.45
sizeMethod · 0.45
prevMethod · 0.45
testMethod · 0.45
orgMethod · 0.45

Tested by

no test coverage detected