public static Blockade hasIntersectionWithBlockades(Pair<Integer, Integer> point, Area a) { double size = ReachablityConstants.AGENT_WIDTH * 1 * 6; if (!(a instanceof Road)) return null; Road road = (Road) a; if (!road.isBlockadesDefined()) return null; if (road.getBlockades().size() == 0) return null; Ellipse2D.Double expandHuman = new Ellipse2D.Double(a.getX() - size / 2, a.getY() - size / 2, size, size); java.awt.geom.Area area = new java.awt.geom.Area(expandHuman); for (Blockade b : road.getBlockades()) { area.intersect(new java.awt.geom.Area(b.getShape())); if (!area.isEmpty()) return b; } return null; }
public boolean isReachableTo(StandardEntity se) { if (se instanceof Human) { Human hum = (Human) se; if (agent.getVisibleEntities(Human.class).contains(hum) && hum.isPositionDefined() && hum.getAreaPosition().isBlockadesDefined()) { for (Blockade blockade : hum.getAreaPosition().getBlockades()) { if (blockade.getShape().contains(hum.getPositionPoint().toGeomPoint())) return false; } } if (!hum.getImReachableToEdges().isEmpty()) return agent .move .getMoveType(PoliceReachablityMove.class) .isReallyReachableTo(hum.getImReachableToEdges()); } return isReachableTo(se.getPositionPair()); }