Skip to content

Commit

Permalink
[InterventionalRadiologyController] Small Fix to avoid adding 0 curvA…
Browse files Browse the repository at this point in the history
…bs per deployed device (sofa-framework#107)

* [IRCtrl] Small fix: avoid adding 0 curvAbs per device deployed

* [IRCtrl] Small fix: update warning message if number of edges is not enough

---------

Co-authored-by: Frederick Roy <[email protected]>
  • Loading branch information
epernod and fredroy authored Sep 7, 2023
1 parent c479162 commit dfb8c41
Showing 1 changed file with 10 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -804,16 +804,16 @@ void InterventionalRadiologyController<DataTypes>::applyInterventionalRadiologyC
totalLengthCombined = xend;
}

if( xend > 0.0)
{
// create the first node (on x=0)
newCurvAbs.push_back(0.0);
}

// clear the present interpolation of the beams
m_instrumentsList[i]->clear();
}

// create the first node (on x=0)
if (totalLengthCombined > 0.0)
{
newCurvAbs.push_back(0.0);
}

/// Some verif of step 1
// if the totalLength is 0, move the first instrument
if (totalLengthCombined < std::numeric_limits<float>::epsilon())
Expand Down Expand Up @@ -933,15 +933,11 @@ void InterventionalRadiologyController<DataTypes>::applyInterventionalRadiologyC
// ## STEP 4: Assign the beams
helper::AdvancedTimer::stepBegin("step4");
sofa::Size nbrBeam = newCurvAbs.size() - 1; // number of simulated beams
unsigned int numEdges= m_numControlledNodes-1;

// verify that there is a sufficient number of Edge in the topology : TODO if not, modify topo !
if (numEdges<nbrBeam)
const sofa::Size numEdges = m_numControlledNodes - 1;

if (numEdges < nbrBeam) // verify that there is a sufficient number of Edge in the topology : TODO if not, modify topo !
{
if (f_printLog.getValue())
{
msg_error()<<"Not enough edges in the topology.";
}
msg_error() << "Not enough edges in the topology. Only: " << numEdges << " while nbrBeam = " << nbrBeam << ". Will simulate only " << numEdges << " beams.";
nbrBeam = numEdges;
}

Expand Down

0 comments on commit dfb8c41

Please sign in to comment.