diff --git a/src/BeamAdapter/component/controller/InterventionalRadiologyController.inl b/src/BeamAdapter/component/controller/InterventionalRadiologyController.inl index dc554ec4b..9076a0e16 100644 --- a/src/BeamAdapter/component/controller/InterventionalRadiologyController.inl +++ b/src/BeamAdapter/component/controller/InterventionalRadiologyController.inl @@ -472,28 +472,50 @@ void InterventionalRadiologyController::interventionalRadiologyComput const Real& xend) { - // Step 1 = put the noticeable Nodes + // Step 1 => put the noticeable Nodes + // Step 2 => add the beams given the sampling parameters double maxAbsLength=0.0; - for (unsigned int i=0; i xP_noticeable_I; type::vector< int > density_I; m_instrumentsList[i]->getSamplingParameters(xP_noticeable_I, density_I); - for (unsigned int j=0; j0) and use corresponding density to sample the interval. + for (unsigned int j=0; j0.0) // all the noticiable point that have a negative curv abs are not simulated => considered as outside of the patient... + const Real curvAbs_xP = xBegin[i] + xP; + const Real curvAbs_nxP = xBegin[i] + nxP; + + // compute interval between next point and previous one (0 for the first iter) + const Real curvAbs_interval = (curvAbs_nxP - xSampling); + + if (curvAbs_interval > 0) { - newCurvAbs.push_back(curvAbs_xP); + // compute the number of point of the emerged interval (if all the interval is emerged, i.e >0 , numNewNodes == density[j]) + Real ratio = Real(density_I[j]) / (nxP - xP); + int numNewNodes = int(floor(curvAbs_interval * ratio)); // if density == 0, no sampling (numNewNodes == 0) - if (curvAbs_xP > maxAbsLength) - maxAbsLength=curvAbs_xP; + // Add the new points in reverse order + for (int k = numNewNodes; k>0; k--) + { + auto value = curvAbs_nxP - (k / ratio); + newCurvAbs.push_back(value); + } + + // Add j+1 bound point + newCurvAbs.push_back(curvAbs_nxP); + xSampling = curvAbs_nxP; } } } + // Step 1(bis) = add Nodes the curv_abs of the rigid parts border // When there are rigid segments, # of dofs is different than # of edges and beams const type::vector< Real > *rigidCurvAbs = &d_rigidCurvAbs.getValue(); @@ -524,34 +546,6 @@ void InterventionalRadiologyController::interventionalRadiologyComput } } - // Step 2 => add the beams given the sampling parameters - Real xSampling = 0.0; - for (unsigned int i=0; i xPNoticeableI; - type::vector< int > density_I; - m_instrumentsList[i]->getSamplingParameters(xPNoticeableI, density_I); - - for (unsigned int j=0; j xSampling && density_I[j]>0) - { - Real ratio = (Real)density_I[j] / (xPNoticeableI[j+1] - xPNoticeableI[j]) ; - int numNewNodes = (int)floor( (curvAbsxP- xSampling) *ratio) ; - - for (int k=0; k& xP_noticeable, type::vector& nbP_density) const ;