Skip to content
Snippets Groups Projects
Commit a97a824e authored by Luc Maisonobe's avatar Luc Maisonobe
Browse files

Added a protection against out of bound initial guesses.

parent 875b088c
No related branches found
No related tags found
No related merge requests found
......@@ -483,6 +483,14 @@ public class SensorMeanPlaneCrossing {
throws RuggedException {
try {
// safety check
final double startValue;
if (initialGuess < minLine || initialGuess > maxLine) {
startValue = midLine;
} else {
startValue = initialGuess;
}
final UnivariateSolver solver = new BracketingNthOrderBrentSolver(accuracy, 5);
double crossingLine = solver.solve(maxEval, new UnivariateFunction() {
/** {@inheritDoc} */
......@@ -498,7 +506,7 @@ public class SensorMeanPlaneCrossing {
throw new RuggedExceptionWrapper(re);
}
}
}, minLine, maxLine, initialGuess);
}, minLine, maxLine, startValue);
final AbsoluteDate date = sensor.getDate(crossingLine);
final FieldVector3D<DerivativeStructure> targetDirection =
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment