public static double getDistance(StandardEntity se1, StandardEntity se2) { return Utils.distance( se1.getLocation().first(), se1.getLocation().second(), se2.getLocation().first(), se2.getLocation().second()); }
public void makeReachableTo(List<? extends StandardEntity> targets) throws SOSActionException { log.info("makeReachableTo " + targets); ArrayList<Pair<? extends Area, Point2D>> reachableAreas = new ArrayList<Pair<? extends Area, Point2D>>(); for (StandardEntity entity : targets) { if (entity == null) { log.error("A null entity passed to makeReachableTo!!! WHY?"); continue; } if (entity.getPositionPair() == null) { log.error("A null position entity(" + entity + ") passed to makeReachableTo!!! WHY?"); continue; } if (!isReachableTo(entity)) { reachableAreas.addAll(PoliceUtils.getReachableAreasPair(entity)); } } log.debug("reachableAreas = " + reachableAreas); if (!reachableAreas.isEmpty()) { moveToPoint(reachableAreas); } }
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()); }
static SOSLoggerSystem log(StandardEntity entity) { return entity.getAgent().sosLogger.reachablity_Merge; }