@@ -74,7 +74,6 @@ InterventionalRadiologyController<DataTypes>::InterventionalRadiologyController(
7474, d_indexFirstNode(initData(&d_indexFirstNode, (unsigned int ) 0 , " indexFirstNode" , " first node (should be fixed with restshape)" ))
7575{
7676 m_fixedConstraint = nullptr ;
77- m_dropCall = false ;
7877 m_sensored =false ;
7978}
8079
@@ -141,10 +140,6 @@ void InterventionalRadiologyController<DataTypes>::init()
141140 if (m_fixedConstraint==nullptr )
142141 msg_error ()<<" No fixedConstraint found." ;
143142
144- // / List of the instrument for which a "DROPPED" was proceeed TODO
145- m_droppedInstruments.clear ();
146-
147-
148143 // the controller must listen to the event (in particular BeginAnimationStep event)
149144 if (!f_listening.isSet ())
150145 {
@@ -446,82 +441,9 @@ void InterventionalRadiologyController<DataTypes>::applyAction(sofa::beamadapter
446441 }
447442 case BeamAdapterAction::DROP_TOOL:
448443 {
449- m_dropCall = true ;
450- }
451- }
452- }
453-
454-
455- template <class DataTypes >
456- void InterventionalRadiologyController<DataTypes>::processDrop(unsigned int &previousNumControlledNodes,
457- unsigned int &segRemove)
458- {
459- int ci = int (d_controlledInstrument.getValue ());
460- Real xMinOutLocal= 0.0 ;
461-
462- Real xBegin=0.0 ;
463-
464- // Quelque soit le resultat du process, le drop call est traite ici
465- m_dropCall = false ;
466-
467- // Step1 : quel est l'abscisse curviligne ou l'instrument controllé est seul ?
468- for (unsigned int i=0 ; i<m_nodeCurvAbs.size (); i++)
469- {
470- // on parcourt toutes abscisse curv jusqu'à trouver un endroit où il n'y a qu'un seul instrument
471- if (m_idInstrumentCurvAbsTable[i].size ()==1 )
472- {
473- // on vérifie qu'il s'agit de celui qui est controle
474- if ( ci ==m_idInstrumentCurvAbsTable[i][0 ])
475- {
476- xBegin = d_xTip.getValue ()[ci] - m_instrumentsList[ci]->getRestTotalLength ();
477- xMinOutLocal = m_nodeCurvAbs[i] - xBegin;
478- break ;
479- }
480- else
481- {
482- msg_error ()<<" The control instrument is not out, drop is impossible." ;
483- return ;
484- }
485- }
486- }
487-
488- if (xMinOutLocal<=0.0 )
489- {
490- msg_error ()<<" x_min_out_local <= 0.0 The control instrument is not out, drop is impossible." ;
491- return ;
444+ msg_warning () << " Releasing catheter or brokenIn2 mode is not anymore supported. Feature has been removed after release v23.06" ;
492445 }
493-
494- // Step2 : on verifie que cette abscisse curviligne est compatible avec celle de l'instrument
495- // (on ne peut pas casser un instrument s'il est à l'intérieur d'un autre instrument)
496- int numBeamsNotUnderControlled = 0 ;
497- Real xBreak;
498- if ( m_instrumentsList[ci]->breaksInTwo (xMinOutLocal, xBreak, numBeamsNotUnderControlled) )
499- {
500- msg_error ()<<" Breaks in two process activated." ;
501-
502- // for now, we simply suppress one more beam !
503- m_numControlledNodes -= (numBeamsNotUnderControlled + 1 );
504-
505- auto xEnds = sofa::helper::getWriteOnlyAccessor (d_xTip);
506- xEnds[ci] = xBegin + xBreak;
507- }
508- else
509- return ;
510-
511- // Step3 : on remet à jour les abscisse curviligne des noeuds en virant toutes celles qui correspondent à la partie
512- // cassée
513- Real eps=d_threshold.getValue ();
514- for (unsigned int i=0 ; i<m_nodeCurvAbs.size (); i++)
515- {
516- if ( m_nodeCurvAbs[i] > (xBegin + xBreak + eps) )
517- {
518- type::removeIndex (m_nodeCurvAbs,i);
519- type::removeIndex (m_idInstrumentCurvAbsTable, i);
520- i--;
521- }
522446 }
523- segRemove = 1 ;
524- previousNumControlledNodes =m_numControlledNodes;
525447}
526448
527449
@@ -784,18 +706,15 @@ void InterventionalRadiologyController<DataTypes>::applyInterventionalRadiologyC
784706{
785707 const Real& threshold = d_threshold.getValue ();
786708
787- // / Create vectors with the CurvAbs of the noticiable points and the id of the corresponding instrument
709+
710+ // Create vectors with the CurvAbs of the noticiable points and the id of the corresponding instrument
788711 type::vector<Real> newCurvAbs;
789-
790- // / In case of drop:
791- unsigned int previousNumControlledNodes = m_numControlledNodes;
792- unsigned int seg_remove = 0 ;
712+ type::vector<type::vector<int >> idInstrumentTable;
793713
794714 // ## STEP 1: Find the total length of the COMBINED INSTRUMENTS and the one for which xtip > 0 (so the one which are simulated)
795715 helper::AdvancedTimer::stepBegin (" step1" );
796716 Real totalLengthCombined=0.0 ;
797- type::vector<Real> tools_xBegin;
798- type::vector<Real> tools_xEnd;
717+ type::vector<Real> tools_xBegin, tools_xEnd;
799718 for (unsigned int i=0 ; i<m_instrumentsList.size (); i++)
800719 {
801720 const Real& xend= d_xTip.getValue ()[i];
@@ -836,11 +755,9 @@ void InterventionalRadiologyController<DataTypes>::applyInterventionalRadiologyC
836755 computeInstrumentsCurvAbs (newCurvAbs, tools_xBegin, totalLengthCombined);
837756
838757 // => id_instrument_table which provides for each simulated node, the id of all instruments which belong this node
839- type::vector<type::vector<int >> idInstrumentTable;
840758 fillInstrumentCurvAbsTable (newCurvAbs, tools_xBegin, tools_xEnd, idInstrumentTable);
841759 helper::AdvancedTimer::stepEnd (" step2" );
842760
843-
844761 // ## STEP 3: Re-interpolate the positions and the velocities
845762 helper::AdvancedTimer::stepBegin (" step3" );
846763
@@ -852,19 +769,19 @@ void InterventionalRadiologyController<DataTypes>::applyInterventionalRadiologyC
852769 const sofa::Size nbrCurvAbs = newCurvAbs.size (); // number of simulated nodes
853770 const sofa::Size prev_nbrCurvAbs = m_nodeCurvAbs.size (); // previous number of simulated nodes;
854771 const Real prev_maxCurvAbs = m_nodeCurvAbs.back ();
855-
772+
856773 // => Change curv if totalLength has changed: modifiedCurvAbs = newCurvAbs - current motion (Length between new and old tip curvAbs)
857774 type::vector<Real> modifiedCurvAbs;
858775 totalLengthIsChanging (newCurvAbs, modifiedCurvAbs, idInstrumentTable);
859776
860777 sofa::Size nbrUnactiveNode = m_numControlledNodes - nbrCurvAbs; // m_numControlledNodes == nbr Dof | nbr of CurvAbs > 0
861- sofa::Size prev_nbrUnactiveNode = previousNumControlledNodes - prev_nbrCurvAbs;
778+ sofa::Size prev_nbrUnactiveNode = m_numControlledNodes - prev_nbrCurvAbs;
862779
863780 for (sofa::Index xId = 0 ; xId < nbrCurvAbs; xId++)
864781 {
865- const sofa::Index globalNodeId = nbrUnactiveNode + xId; // fill the end of the dof buffer
782+ const sofa::Index globalNodeId = nbrUnactiveNode + xId; // position of the curvAbs in the dof buffer filled by the end
866783 const Real xCurvAbs = modifiedCurvAbs[xId];
867-
784+
868785 // 2 cases: TODO : remove first case
869786 // 1. the abs curv is further than the previous state of the instrument
870787 // 2. this is not the case and the node position can be interpolated using previous step positions
@@ -890,7 +807,7 @@ void InterventionalRadiologyController<DataTypes>::applyInterventionalRadiologyC
890807 prev_xId++;
891808 }
892809
893- sofa::Index prev_globalNodeId = prev_nbrUnactiveNode + seg_remove + prev_xId;
810+ sofa::Index prev_globalNodeId = prev_nbrUnactiveNode + prev_xId;
894811 const Real prev_xCurvAbs = m_nodeCurvAbs[prev_xId];
895812
896813 if (fabs (prev_xCurvAbs - xCurvAbs) < threshold)
@@ -1012,9 +929,7 @@ void InterventionalRadiologyController<DataTypes>::applyInterventionalRadiologyC
1012929 if (rigid)
1013930 m_fixedConstraint->addConstraint (firstSimulatedNode+i);
1014931 }
1015-
1016932 }
1017-
1018933 }
1019934 helper::AdvancedTimer::stepEnd (" step5" );
1020935
@@ -1026,6 +941,7 @@ void InterventionalRadiologyController<DataTypes>::applyInterventionalRadiologyC
1026941 m_idInstrumentCurvAbsTable = idInstrumentTable;
1027942}
1028943
944+
1029945template <class DataTypes >
1030946void InterventionalRadiologyController<DataTypes>::totalLengthIsChanging(const type::vector<Real>& newNodeCurvAbs,
1031947 type::vector<Real>& modifiedNodeCurvAbs,
0 commit comments