diff --git a/src/BeamAdapter/component/controller/InterventionalRadiologyController.inl b/src/BeamAdapter/component/controller/InterventionalRadiologyController.inl index 8e807fd8d..1a6026511 100644 --- a/src/BeamAdapter/component/controller/InterventionalRadiologyController.inl +++ b/src/BeamAdapter/component/controller/InterventionalRadiologyController.inl @@ -537,7 +537,7 @@ void InterventionalRadiologyController::interventionalRadiologyComput m_instrumentsList[i]->getSamplingParameters(xP_noticeable_I, density_I); // check each interval of noticeable point to see if they go out (>0) and use corresponding density to sample the interval. - for (unsigned int j=0; j::assignSubMappingFromControllerInfo() // 1. get the new controls m_ircontroller->interventionalRadiologyCollisionControls(_xPointList, _idm_instrumentList, removeEdgeAtPoint); - + if(!isBarycentricMapping) { + //Case if this is not a barycentric mapping // 2. assign each value of xPointList to the corresponding "sub Mapping" // i.e = each point from xPointList of the collision model is controlled by a given instrument wich id is provided in _id_m_instrumentList @@ -183,9 +184,7 @@ void MultiAdaptiveBeamMapping< TIn, TOut>::assignSubMappingFromControllerInfo() } // handle the possible topological change - sofa::type::vector edgeToRemove; - edgeToRemove.clear(); for (unsigned int i=0; i::assignSubMappingFromControllerInfo() } else { - msg_error() << " WARNING !! baseEdge = "<0) @@ -251,32 +250,37 @@ void MultiAdaptiveBeamMapping< TIn, TOut>::assignSubMappingFromControllerInfo() template void MultiAdaptiveBeamMapping< TIn, TOut>::init() { - if (m_ircontroller==nullptr) { - ///////// get the Adaptive Interpolation component /////// - core::objectmodel::BaseContext * c = this->getContext(); - - const type::vector& interpolName = m_controlerPath.getValue(); - if (interpolName.empty()) { - m_ircontroller = c->get(core::objectmodel::BaseContext::Local); - } else { - m_ircontroller = c->get(m_controlerPath.getValue()[0]); - } + if (m_ircontroller==nullptr) + { + ///////// get the Adaptive Interpolation component /////// + core::objectmodel::BaseContext * c = this->getContext(); + + const type::vector& interpolName = m_controlerPath.getValue(); + if (interpolName.empty()) { + m_ircontroller = c->get(core::objectmodel::BaseContext::Local); + } else { + m_ircontroller = c->get(m_controlerPath.getValue()[0]); + } - if(m_ircontroller==nullptr) - msg_error() << " no Beam Interpolation found !!! the component can not work"; - else - msg_info() << " interpolation named" << m_ircontroller->getName() << " found (for " << this->getName()<<")"; + if (m_ircontroller == nullptr) { + msg_error() << " no Beam Interpolation found !!! the component can not work"; + sofa::core::objectmodel::BaseObject::d_componentState.setValue(sofa::core::objectmodel::ComponentState::Invalid); + return; + } + else { + msg_info() << " interpolation named" << m_ircontroller->getName() << " found (for " << this->getName() << ")"; } + } - m_ircontroller->getInstrumentList(m_instrumentList); + m_ircontroller->getInstrumentList(m_instrumentList); - // create a mapping for each instrument - m_subMappingList.clear(); - for (unsigned int i=0; i::SPtr newMapping = sofa::core::objectmodel::New>(this->fromModel, this->toModel,m_instrumentList[i],true); - m_subMappingList.push_back(newMapping); - } + // create a mapping for each instrument + m_subMappingList.clear(); + for (unsigned int i=0; i::SPtr newMapping = sofa::core::objectmodel::New>(this->fromModel, this->toModel,m_instrumentList[i],true); + m_subMappingList.push_back(newMapping); + } this->f_listening.setValue(true); @@ -284,8 +288,9 @@ void MultiAdaptiveBeamMapping< TIn, TOut>::init() ///////// STEP 3 : get the edgeSet topology and fill it with segments this->getContext()->get(_topology); - if(_topology != nullptr && this->f_printLog.getValue() ) + if (_topology != nullptr && this->f_printLog.getValue()) { msg_info() << " FIND topology named " << _topology->getName(); + } this->getContext()->get(_edgeMod); @@ -324,13 +329,16 @@ void MultiAdaptiveBeamMapping< TIn, TOut>::init() { _topology->addEdge(i,i+1); } + + // create edge around vertex array + _topology->init(); + // resize Mstate this->toModel->resize(numSeg+1); // 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); - }