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

Method calcCost_

source/MRMesh/MRBoxNesting.cpp:307–330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

305}
306
307double BoxNester::calcCost_( const PlacedSocket& leafSocket ) const
308{
309 if ( !params_.options.priorityMetric )
310 {
311 assert( false );
312 return 0.0;
313 }
314
315 params_.options.priorityMetric->init( leafSocket.box );
316 const PlacedSocket* socket = &leafSocket;
317 while ( socket )
318 {
319 params_.options.priorityMetric->addNested( socket->box );
320 socket = socket->parentSocketId == -1 ? nullptr : &socketTree_[socket->parentSocketId];
321 }
322 if ( params_.options.preNestedVolumes )
323 {
324 for ( const auto& box : *params_.options.preNestedVolumes )
325 {
326 params_.options.priorityMetric->addNested( box );
327 }
328 }
329 return params_.options.priorityMetric->complete();
330}
331
332/*
333Vector3i BoxNester::calcPos_( const Vector3i& parentPos, uint8_t pc, uint8_t tc )

Callers

nothing calls this directly

Calls 3

initMethod · 0.45
addNestedMethod · 0.45
completeMethod · 0.45

Tested by

no test coverage detected