Commit 03b28bd9 authored by Marion Goedel's avatar Marion Goedel
Browse files

Update of PedestrianOverlapProcessor Test.

parent 50f9c592
......@@ -34,8 +34,8 @@ public class PedestrianOverlapProcessor extends DataProcessor<TimestepPedestrian
minDist = pedRadius * 2;
int timeStep = state.getStep();
for (Pedestrian ped : peds) {
// get all Pedestrians with at moust pedRadius*2.5 distance away
// this reduces the amount auf overlap test.
// get all Pedestrians with at most pedRadius*2.5 distance away
// this reduces the amount of overlap tests
VPoint pedPos = ped.getPosition();
List<DynamicElement> neighbours = getDynElementsAtPosition(state.getTopography(), ped.getPosition(), pedRadius *2.5);
// collect pedIds and distance of all overlaps for the current ped in the current timestep
......
......@@ -34,7 +34,6 @@ public class PedestrianOverlapProcessorTest extends ProcessorTest {
}
@Test
@Ignore
public void doUpdateWithTouching() throws Exception {
((PedestrianOverlapProcessorTestEnv)processorTestEnv).touching();
super.doUpdate();
......
......@@ -10,6 +10,8 @@ import org.vadere.state.scenario.Pedestrian;
import org.vadere.util.geometry.LinkedCellsGrid;
import org.vadere.util.geometry.shapes.VPoint;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
......@@ -137,17 +139,27 @@ public class PedestrianOverlapProcessorTestEnv extends ProcessorTestEnv<Timestep
void verySmallNotOverlapping() {
AttributesAgent a = new AttributesAgent();
double distAtAxis = a.getRadius()*2 + 0.001; // this should count as overlap
double vertDistAt45deg = 2*Math.sqrt(0.5)*a.getRadius() + 0.001;
double vertDistAt45deg = Math.sqrt(2)*a.getRadius() + 0.001;
addMockStates(a.getRadius(), distAtAxis, new VPoint(vertDistAt45deg, vertDistAt45deg));
}
void touching() {
AttributesAgent a = new AttributesAgent();
double distAtAxis = a.getRadius()*2; // this should count as overlap
double vertDistAt45deg = 2*Math.sqrt(0.5)*a.getRadius();
double vertDistAt45deg = round(Math.sqrt(2)*a.getRadius(), 16);
addMockStates(a.getRadius(), distAtAxis, new VPoint(vertDistAt45deg, vertDistAt45deg));
}
public static double round(double val, int places){
if(places < 0)
throw new IllegalArgumentException();
BigDecimal bigDecimal = new BigDecimal(val);
bigDecimal = bigDecimal.setScale(places, RoundingMode.HALF_UP);
return bigDecimal.doubleValue();
}
private void addMockStates(double radius, double distAtAxis, VPoint vertDistAt45deg) {
clearStates();
addSimState(new SimulationStateMock(1) {
......
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