Commit ea50b355 authored by Daniel Lehmberg's avatar Daniel Lehmberg
Browse files

Merge branch 'useFreeSpaceOnly' into 'master'

Reactive useFreeSpaceOnly=True again, closes #109

Closes #109

See merge request !35
parents f185711d dd4e7f91
Pipeline #77139 failed with stages
in 105 minutes and 28 seconds
...@@ -14,7 +14,7 @@ ScenarioChecker.source.targetIdNotFound=The following target ids where not found ...@@ -14,7 +14,7 @@ ScenarioChecker.source.targetIdNotFound=The following target ids where not found
ScenarioChecker.source.noTargetIdSet=No Target Ids set for Source. ScenarioChecker.source.noTargetIdSet=No Target Ids set for Source.
ScenarioChecker.source.noTargetIdAndNoSpawn=No Target Ids set for Source with SpawnNumber 0. This might be an error. ScenarioChecker.source.noTargetIdAndNoSpawn=No Target Ids set for Source with SpawnNumber 0. This might be an error.
ScenarioChecker.source.idNotUnique=Multiple Sources have the same ID. ScenarioChecker.source.idNotUnique=Multiple Sources have the same ID.
ScenarioChecker.source.spawnAtRandomButNotAtFreeSpace=Combination isSpawnAtRandomPositions=true and isUseFreeSpaceOnly=false not allowed. ScenarioChecker.source.spawnAtRandomButNotAtFreeSpace=Combination isSpawnAtRandomPositions=true and isUseFreeSpaceOnly=false can lead to illegal and undesired simulation states.
ScenarioChecker.source.toSmall=Source is to small ScenarioChecker.source.toSmall=Source is to small
ScenarioChecker.source.spawnUseNotAtFreeSpace=useFreeSpaceOnly=false is Deprecated. Will be removed in future relases. Not all models can handle overlapping pedestrians. ScenarioChecker.source.spawnUseNotAtFreeSpace=useFreeSpaceOnly=false is Deprecated. Will be removed in future relases. Not all models can handle overlapping pedestrians.
ScenarioChecker.stairs.wrongTreadDim=Stair treadDepth outside of allowed dimension. Change the thread numbers to compensate. ScenarioChecker.stairs.wrongTreadDim=Stair treadDepth outside of allowed dimension. Change the thread numbers to compensate.
......
...@@ -13,7 +13,7 @@ ScenarioChecker.type.processor.warning=Procesor Warnung ...@@ -13,7 +13,7 @@ ScenarioChecker.type.processor.warning=Procesor Warnung
ScenarioChecker.source.targetIdNotFound=Die folgenden Ziel-IDs wurden nicht im Szenario gefunden. ScenarioChecker.source.targetIdNotFound=Die folgenden Ziel-IDs wurden nicht im Szenario gefunden.
ScenarioChecker.source.noTargetIdSet=In der Quelle wurden keine Ziel Ids vergeben. ScenarioChecker.source.noTargetIdSet=In der Quelle wurden keine Ziel Ids vergeben.
ScenarioChecker.source.noTargetIdAndNoSpawn=In der Quelle wurden keine Ziel Ids vergeben, aber die Spawn Anzahl ist bei 0. ScenarioChecker.source.noTargetIdAndNoSpawn=In der Quelle wurden keine Ziel Ids vergeben, aber die Spawn Anzahl ist bei 0.
ScenarioChecker.source.spawnAtRandomButNotAtFreeSpace=Kombination aus isSpawnAtRandomPositions=true und isUseFreeSpaceOnly=false ist nicht erlaubt. ScenarioChecker.source.spawnAtRandomButNotAtFreeSpace=Kombination aus isSpawnAtRandomPositions=true und isUseFreeSpaceOnly=false kann zu illegalen und unerwünschten Zuständen führen.
ScenarioChecker.source.toSmall=Quelle ist zu klein ScenarioChecker.source.toSmall=Quelle ist zu klein
ScenarioChecker.source.spawnUseNotAtFreeSpace=useFreeSpaceOnly=false ist Deprecated. Dieses Attribut wird in zuk\u00fcnfigen version entfernt. Nicht alle Modell k\u00f6nnen mit \u00fcberlappungen umgehen. ScenarioChecker.source.spawnUseNotAtFreeSpace=useFreeSpaceOnly=false ist Deprecated. Dieses Attribut wird in zuk\u00fcnfigen version entfernt. Nicht alle Modell k\u00f6nnen mit \u00fcberlappungen umgehen.
ScenarioChecker.source.idNotUnique=Quellen haben keine eindeutige ID. ScenarioChecker.source.idNotUnique=Quellen haben keine eindeutige ID.
......
...@@ -48,7 +48,6 @@ public class SingleSourceController extends SourceController { ...@@ -48,7 +48,6 @@ public class SingleSourceController extends SourceController {
if (sourceAttributes.isSpawnAtRandomPositions()) { if (sourceAttributes.isSpawnAtRandomPositions()) {
if (sourceAttributes.isUseFreeSpaceOnly()) {
spawnPoints = getRealRandomPositions( spawnPoints = getRealRandomPositions(
numberToSpawn, numberToSpawn,
random, random,
...@@ -60,9 +59,7 @@ public class SingleSourceController extends SourceController { ...@@ -60,9 +59,7 @@ public class SingleSourceController extends SourceController {
numberToSpawn -= spawnPoints.size(); numberToSpawn -= spawnPoints.size();
assert (numberToSpawn >= 0); assert (numberToSpawn >= 0);
} else {
throw new IllegalArgumentException("use random position without free space only makes no sense.");
}
} else { } else {
...@@ -158,7 +155,8 @@ public class SingleSourceController extends SourceController { ...@@ -158,7 +155,8 @@ public class SingleSourceController extends SourceController {
} }
// no intersection with other free spaces (obstacles & other pedestrians) // no intersection with other free spaces (obstacles & other pedestrians)
if (testFreeSpace(freeSpaceRequired, blockPedestrianShapes)) {
if (!sourceAttributes.isUseFreeSpaceOnly() || testFreeSpace(freeSpaceRequired, blockPedestrianShapes)) {
return Optional.of(randomPoint); return Optional.of(randomPoint);
} }
} }
......
...@@ -21,7 +21,7 @@ public class SourceSpawnSettingCheck extends AbstractScenarioCheck implements To ...@@ -21,7 +21,7 @@ public class SourceSpawnSettingCheck extends AbstractScenarioCheck implements To
AttributesSource attr = source.getAttributes(); AttributesSource attr = source.getAttributes();
if (attr.isSpawnAtRandomPositions() && !attr.isUseFreeSpaceOnly()){ if (attr.isSpawnAtRandomPositions() && !attr.isUseFreeSpaceOnly()){
messages.add(msgBuilder.topographyError().target(source) messages.add(msgBuilder.topographyWarning().target(source)
.reason(ScenarioCheckerReason.SOURCE_SPAWN_RND_POS_NOT_FREE_SPACE).build()); .reason(ScenarioCheckerReason.SOURCE_SPAWN_RND_POS_NOT_FREE_SPACE).build());
} else if (!attr.isUseFreeSpaceOnly()){ } else if (!attr.isUseFreeSpaceOnly()){
messages.add(msgBuilder.topographyWarning().target(source) messages.add(msgBuilder.topographyWarning().target(source)
......
...@@ -73,11 +73,13 @@ public class Face { ...@@ -73,11 +73,13 @@ public class Face {
} }
} }
double maxArea = (limits.xHigh - limits.xLow) double maxArea = (limits.xHigh - limits.xLow) * (limits.yHigh - limits.yLow);
* (limits.yHigh - limits.yLow);
try { try {
if (result < 0 || (result > maxArea && Math.abs(result-maxArea) > 1E-15)) { if(result > maxArea && Math.abs(result-maxArea) > 1E-13){
// Values of -3.68594044175552e-14 were observed
result = maxArea; // set to max area and continue silently...
}else if (result < 0 || (result > maxArea && Math.abs(result-maxArea) >= 1E-13)) {
String message = "(Object " + id + ") Area of face is: " + result + ". This is an illegal area size " + String message = "(Object " + id + ") Area of face is: " + result + ". This is an illegal area size " +
"because result has to be positive and less than maxArea (= " + maxArea + ")"; "because result has to be positive and less than maxArea (= " + maxArea + ")";
throw new IllegalStateException(message); throw new IllegalStateException(message);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment