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

Fixed a singular matrix occurrence problem.

When the same inverse location problem was performed several times in
raw, the same result was added several times in the cache. This lead to
singular matrices being created as sample points were not independent.
parent 7229454c
No related branches found
No related tags found
No related merge requests found
...@@ -419,12 +419,22 @@ public class SensorMeanPlaneCrossing { ...@@ -419,12 +419,22 @@ public class SensorMeanPlaneCrossing {
} }
if (FastMath.abs(deltaL) <= accuracy) { if (FastMath.abs(deltaL) <= accuracy) {
// return immediately, without doing any additional evaluation! // return immediately, without doing any additional evaluation!
if (cachedResults.size() >= CACHED_RESULTS) { final CrossingResult crossingResult =
cachedResults.remove(cachedResults.size() - 1); new CrossingResult(sensor.getDate(crossingLine), crossingLine, target,
targetDirection[0], targetDirection[1]);
boolean isNew = true;
for (final CrossingResult existing : cachedResults) {
isNew = isNew && FastMath.abs(crossingLine - existing.crossingLine) > accuracy;
} }
cachedResults.add(0, new CrossingResult(sensor.getDate(crossingLine), crossingLine, target, if (isNew) {
targetDirection[0], targetDirection[1])); // this result is different from the existing ones,
return cachedResults.get(0); // it brings new sampling data to the cache
if (cachedResults.size() >= CACHED_RESULTS) {
cachedResults.remove(cachedResults.size() - 1);
}
cachedResults.add(0, crossingResult);
}
return crossingResult;
} }
for (int j = 0; j < i; ++j) { for (int j = 0; j < i; ++j) {
if (FastMath.abs(crossingLine - crossingLineHistory[j]) <= 1.0) { if (FastMath.abs(crossingLine - crossingLineHistory[j]) <= 1.0) {
......
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