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

Function findMaxDistanceSqOneWay

source/MRMesh/MRMeshMeshDistance.cpp:315–347  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

313}
314
315float findMaxDistanceSqOneWay( const MeshPart& a, const MeshPart& b, const AffineXf3f* rigidB2A, float maxDistanceSq )
316{
317 MR_TIMER;
318
319 const auto& bMeshVerts = b.mesh.points;
320 auto vertBitSet = getIncidentVerts( b.mesh.topology, b.mesh.topology.getFaceIds( b.region ) );
321 if ( !vertBitSet.any() )
322 return 0.0f;
323
324 return tbb::parallel_reduce
325 (
326 tbb::blocked_range( vertBitSet.find_first(), vertBitSet.find_last() + 1 ),
327 0.0f,
328 [&] ( const tbb::blocked_range<VertId>& range, float init )
329 {
330 for ( VertId i = range.begin(); i < range.end(); ++i )
331 {
332 if ( !vertBitSet.test( i ) )
333 continue;
334
335 auto distSq = findProjection( rigidB2A ? (*rigidB2A)( bMeshVerts[i] ) : bMeshVerts[i], a, maxDistanceSq ).distSq;
336 if ( distSq > init )
337 init = distSq;
338 }
339
340 return init;
341 },
342 [] ( float a, float b ) -> float
343 {
344 return a > b ? a : b;
345 }
346 );
347}
348
349float findMaxDistanceSq( const MeshPart& a, const MeshPart& b, const AffineXf3f* rigidB2A, float maxDistanceSq )
350{

Callers 1

findMaxDistanceSqFunction · 0.70

Calls 8

getIncidentVertsFunction · 0.85
findProjectionFunction · 0.85
anyMethod · 0.45
find_firstMethod · 0.45
find_lastMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
testMethod · 0.45

Tested by

no test coverage detected