Beispiel #1
0
  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;
  }
Beispiel #2
0
 public long getWeightTo(Area target, Class<? extends MoveType> type) {
   long weightTo = moves.get(type.hashCode()).getWeightTo(target, target.getX(), target.getY());
   if (weightTo < 0) log().error(new Error("why it become negetive here???"));
   return weightTo;
 }