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

Method refit

source/MRMesh/MRAABBTree.cpp:62–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62void AABBTree::refit( const Mesh & mesh, const VertBitSet & changedVerts )
63{
64 MR_TIMER;
65
66 const auto changedFaces = getIncidentFaces( mesh.topology, changedVerts );
67
68 // update leaf nodes
69 NodeBitSet changedNodes( nodes_.size() );
70 BitSetParallelForAll( changedNodes, [&]( NodeId nid )
71 {
72 auto & node = nodes_[nid];
73 if ( !node.leaf() )
74 return;
75 const auto f = node.leafId();
76 if ( !changedFaces.test( f ) )
77 return;
78 changedNodes.set( nid );
79 node.box = computeFaceBox( mesh, f );
80 } );
81
82 //update not-leaf nodes
83 for ( auto nid = nodes_.backId(); nid; --nid )
84 {
85 auto & node = nodes_[nid];
86 if ( node.leaf() )
87 continue;
88 if ( !changedNodes.test( node.l ) && !changedNodes.test( node.r ) )
89 continue;
90 changedNodes.set( nid );
91 node.box = nodes_[node.l].box;
92 node.box.include( nodes_[node.r].box );
93 }
94}
95
96template auto AABBTreeBase<FaceTreeTraits3>::getSubtrees( int minNum ) const -> std::vector<NodeId>;
97template auto AABBTreeBase<FaceTreeTraits3>::getSubtreeLeaves( NodeId subtreeRoot ) const -> LeafBitSet;

Callers 2

applyCompensationMethod · 0.45
updateCachesMethod · 0.45

Calls 10

getIncidentFacesFunction · 0.85
BitSetParallelForAllFunction · 0.85
computeFaceBoxFunction · 0.85
leafIdMethod · 0.80
sizeMethod · 0.45
leafMethod · 0.45
testMethod · 0.45
setMethod · 0.45
backIdMethod · 0.45
includeMethod · 0.45

Tested by

no test coverage detected