From 5476e0ae071f29e5d041e2aec66146e28b7af548 Mon Sep 17 00:00:00 2001 From: Frederick Roy Date: Wed, 17 Sep 2025 15:44:49 +0900 Subject: [PATCH 1/2] fix collision model with multidaptivebeammapping and several tools --- .../mapping/MultiAdaptiveBeamMapping.inl | 55 ++++++++++--------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/src/BeamAdapter/component/mapping/MultiAdaptiveBeamMapping.inl b/src/BeamAdapter/component/mapping/MultiAdaptiveBeamMapping.inl index ffb4b1808..f0b18a697 100644 --- a/src/BeamAdapter/component/mapping/MultiAdaptiveBeamMapping.inl +++ b/src/BeamAdapter/component/mapping/MultiAdaptiveBeamMapping.inl @@ -307,45 +307,46 @@ void MultiAdaptiveBeamMapping< TIn, TOut>::init() // fill topology : _topology->clear(); _topology->cleanup(); - - unsigned int numSeg, numLinesInstrument; - numSeg=0; - InReal DX=0; - // we chose the collision parameters of the most discretized instrument + + // we build the topology according to the description(s) of the tool(s) + // this will ensure that we have enough DOFs/edges for the worst deployment cases + SReal previousXAbs = 0.0; + SReal previousNbEdges = 0.0; + _topology->addPoint( 0.0, 0, 0); for (unsigned int i=0; igetNumberOfCollisionSegment(dx, numLinesInstrument); - if( numSeg < numLinesInstrument ){ - numSeg = numLinesInstrument; - DX=dx; + + // add the DOFs and edges according to the number set in the tool + // DOFs + for (unsigned int i=1; iaddPoint( previousXAbs + px, 0, 0); } + // Edges + for (unsigned int i=0; iaddEdge(previousNbEdges + i, previousNbEdges + i+1); + } + + previousXAbs += (numLinesInstrument+1)*dx; + previousNbEdges += numLinesInstrument; } - - msg_info() << "numSeg found in MultiAdaptiveBeamMapping="<< numSeg; - - - // add points - for ( int i=0; i<(int)numSeg+1; i++) - { - Real px = i*DX; - _topology->addPoint( px, 0, 0); - } - // add segments - for (int i=0; i<(int)numSeg; i++) - { - _topology->addEdge(i,i+1); - } - + const auto totalNbDOFs = previousNbEdges + 1; + // create edge around vertex array _topology->init(); // resize Mstate - this->toModel->resize(numSeg+1); + this->toModel->resize(totalNbDOFs); // resize the internal list of the collision points ( for each point : [x_curv on the global wire , id of the corresponding instrument] - _xPointList.resize(numSeg+1); - _idm_instrumentList.resize(numSeg+1); + _xPointList.resize(totalNbDOFs); + _idm_instrumentList.resize(totalNbDOFs); } From 0b63b47d6f75e0401cb03227eb882ee69eb29853 Mon Sep 17 00:00:00 2001 From: Frederick Roy Date: Wed, 17 Sep 2025 15:15:18 +0900 Subject: [PATCH 2/2] use collision sampling for collision creation in IRC --- .../component/controller/InterventionalRadiologyController.inl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BeamAdapter/component/controller/InterventionalRadiologyController.inl b/src/BeamAdapter/component/controller/InterventionalRadiologyController.inl index 1165384a8..f50fc6e5f 100644 --- a/src/BeamAdapter/component/controller/InterventionalRadiologyController.inl +++ b/src/BeamAdapter/component/controller/InterventionalRadiologyController.inl @@ -672,7 +672,7 @@ void InterventionalRadiologyController::interventionalRadiologyCollis // 3. we look for the mechanical sampling of the current instrument in order to "place" the following point Real xIncr; - m_instrumentsList[firstInstruOnx]->getMechanicalSampling(xIncr, xPointList[i]); + m_instrumentsList[firstInstruOnx]->getCollisionSampling(xIncr, xPointList[i]); xAbsCurv -= xIncr; // the following point could not have x_abs_curv<0;