Skip to content

Commit 908b8d4

Browse files
Camille-KCamille Krewcun
andauthored
[InterventionalRadiologyController] Revert sampling change of behaviour (sofa-framework#88)
* [InterventionalRadiologyController] Revert sampling change of behaviour * [RadiologyInterventionalController] Remove unused line With the precedent correction, the end point of each interval is added in the sampling as the begin point of the next interval. The last end point is treated separately --------- Co-authored-by: Camille Krewcun <[email protected]>
1 parent 49064eb commit 908b8d4

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/BeamAdapter/component/controller/InterventionalRadiologyController.inl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,10 @@ void InterventionalRadiologyController<DataTypes>::interventionalRadiologyComput
536536
//compute the corresponding abs curv of this "noticeable point" on the combined intrument
537537
const Real curvAbs_xP = xBegin[i] + xP;
538538
const Real curvAbs_nxP = xBegin[i] + nxP;
539+
540+
// In any case, the key points are added as soon as they are deployed
541+
if (curvAbs_xP > 0)
542+
newCurvAbs.push_back(curvAbs_xP);
539543

540544
// compute interval between next point and previous one (0 for the first iter)
541545
const Real curvAbs_interval = (curvAbs_nxP - xSampling);
@@ -553,11 +557,16 @@ void InterventionalRadiologyController<DataTypes>::interventionalRadiologyComput
553557
newCurvAbs.push_back(value);
554558
}
555559

556-
// Add j+1 bound point
557-
newCurvAbs.push_back(curvAbs_nxP);
558560
xSampling = curvAbs_nxP;
559561
}
560562
}
563+
564+
// After the end of the for loop above, we just have to process the
565+
// instrument last key point
566+
const Real lastxP = xP_noticeable_I[xP_noticeable_I.size()-1];
567+
const Real curvAbs_lastxP = xBegin[i] + lastxP;
568+
if (curvAbs_lastxP > 0)
569+
newCurvAbs.push_back(curvAbs_lastxP);
561570
}
562571

563572

0 commit comments

Comments
 (0)