@Test public void isVisible() throws Exception { SightConePerceptionModel sightConePerceptionModelModel = new SightConePerceptionModel(); sightConePerceptionModelModel.setAngle(90); sightConePerceptionModelModel.setRadius(30); Vector2D curPedPos, curPedHead, otherPedPos, otherPedHead; curPedPos = GeometryFactory.createVector(0,0); curPedHead = GeometryFactory.createVector(1,0); otherPedPos = GeometryFactory.createVector(20,0); otherPedHead = GeometryFactory.createVector(1,0); currentPedestrian.setWalkingState(new WalkingState(curPedPos, curPedHead, curPedHead)); otherPedestrian.setWalkingState(new WalkingState(otherPedPos, otherPedHead, otherPedHead)); assertTrue(sightConePerceptionModelModel.isVisible(currentPedestrian, otherPedestrian)); otherPedPos.set(30.1, 0); assertFalse(sightConePerceptionModelModel.isVisible(currentPedestrian, otherPedestrian)); otherPedPos.set(20, 20); assertTrue(sightConePerceptionModelModel.isVisible(currentPedestrian, otherPedestrian)); otherPedPos.set(0, 20); assertFalse(sightConePerceptionModelModel.isVisible(currentPedestrian, otherPedestrian)); otherPedPos.set(Math.cos(Math.toRadians(-46)), Math.sin(Math.toRadians(-46))); assertFalse(sightConePerceptionModelModel.isVisible(currentPedestrian, otherPedestrian)); otherPedPos.set(Math.cos(Math.toRadians(-44)), Math.sin(Math.toRadians(-44))); assertTrue(sightConePerceptionModelModel.isVisible(currentPedestrian, otherPedestrian)); curPedPos.set(10,10); curPedHead.set(0,-1); otherPedPos.set(10, 11); assertFalse(sightConePerceptionModelModel.isVisible(currentPedestrian, otherPedestrian)); otherPedPos.set(10, 11); assertFalse(sightConePerceptionModelModel.isVisible(currentPedestrian, otherPedestrian)); otherPedPos.set(10, 9); assertTrue(sightConePerceptionModelModel.isVisible(currentPedestrian, otherPedestrian)); otherPedPos.set(10 + Math.cos(-46), 10 + Math.sin(-46)); assertTrue(sightConePerceptionModelModel.isVisible(currentPedestrian, otherPedestrian)); otherPedPos.set(10 + Math.cos(-44.5)*5, 10 + Math.sin(-44.5)*5); assertFalse(sightConePerceptionModelModel.isVisible(currentPedestrian, otherPedestrian)); }
@Override public boolean isVisible(IPedestrian currentPedestrian, IPedestrian otherPedestrian) { return isVisible(currentPedestrian, otherPedestrian.getPosition()); }
SightConePerceptionModel extends PerceptionalModel { @Override public boolean isVisible(IPedestrian currentPedestrian, IPedestrian otherPedestrian) { return isVisible(currentPedestrian, otherPedestrian.getPosition()); } }
SightConePerceptionModel extends PerceptionalModel { @Override public boolean isVisible(IPedestrian currentPedestrian, IPedestrian otherPedestrian) { return isVisible(currentPedestrian, otherPedestrian.getPosition()); }  }
SightConePerceptionModel extends PerceptionalModel { @Override public boolean isVisible(IPedestrian currentPedestrian, IPedestrian otherPedestrian) { return isVisible(currentPedestrian, otherPedestrian.getPosition()); }  void setRadius(double radius); void setAngle(double angle); @Override void callPreProcessing(SimulationState simulationState); @Override void callPostProcessing(SimulationState simulationState); @Override List<IPedestrian> getPerceptedPedestrians(IPedestrian currentPedestrian, SimulationState simulationState); @Override boolean isVisible(IPedestrian currentPedestrian, IPedestrian otherPedestrian); @Override boolean isVisible(IPedestrian pedestrian, Vector2D position); @Override boolean isVisible(IPedestrian pedestrian, Area area); @Override boolean isVisible(IPedestrian pedestrian, Vertex vertex); @Override boolean isVisible(IPedestrian pedestrian, Edge edge); @Override boolean isVisible(Vector2D viewPort,  Vector2D position); @Override double getPerceptionDistance(); @Override List<Vector2D> getPerceptedObstaclePositions(IPedestrian pedestrian, SimulationState simulationState); @Override List<IPedestrian> getPerceptedPedestrianPositions(IPedestrian pedestrian, SimulationState simulationState); @Override List<Vector2D> getPerceptedFreePositions(IPedestrian pedestrian, SimulationState simulationState); }
SightConePerceptionModel extends PerceptionalModel { @Override public boolean isVisible(IPedestrian currentPedestrian, IPedestrian otherPedestrian) { return isVisible(currentPedestrian, otherPedestrian.getPosition()); }  void setRadius(double radius); void setAngle(double angle); @Override void callPreProcessing(SimulationState simulationState); @Override void callPostProcessing(SimulationState simulationState); @Override List<IPedestrian> getPerceptedPedestrians(IPedestrian currentPedestrian, SimulationState simulationState); @Override boolean isVisible(IPedestrian currentPedestrian, IPedestrian otherPedestrian); @Override boolean isVisible(IPedestrian pedestrian, Vector2D position); @Override boolean isVisible(IPedestrian pedestrian, Area area); @Override boolean isVisible(IPedestrian pedestrian, Vertex vertex); @Override boolean isVisible(IPedestrian pedestrian, Edge edge); @Override boolean isVisible(Vector2D viewPort,  Vector2D position); @Override double getPerceptionDistance(); @Override List<Vector2D> getPerceptedObstaclePositions(IPedestrian pedestrian, SimulationState simulationState); @Override List<IPedestrian> getPerceptedPedestrianPositions(IPedestrian pedestrian, SimulationState simulationState); @Override List<Vector2D> getPerceptedFreePositions(IPedestrian pedestrian, SimulationState simulationState);  }