private List<MapleFoothold> getAllRelevants(final List<MapleFoothold> list) {
   list.addAll(footholds);
   if (nw != null) {
     nw.getAllRelevants(list);
     ne.getAllRelevants(list);
     sw.getAllRelevants(list);
     se.getAllRelevants(list);
   }
   return list;
 }
 private List<MapleFoothold> getRelevants(final Point p, final List<MapleFoothold> list) {
   list.addAll(footholds);
   if (nw != null) {
     if (p.x <= center.x && p.y <= center.y) {
       nw.getRelevants(p, list);
     } else if (p.x > center.x && p.y <= center.y) {
       ne.getRelevants(p, list);
     } else if (p.x <= center.x && p.y > center.y) {
       sw.getRelevants(p, list);
     } else {
       se.getRelevants(p, list);
     }
   }
   return list;
 }
 private MapleFoothold findWallR(final Point p1, final Point p2) {
   MapleFoothold ret;
   for (final MapleFoothold f : footholds) {
     // if (f.isWall()) System.out.println(f.getX1() + " " + f.getX2());
     if (f.isWall()
         && f.getX1() >= p1.x
         && f.getX1() <= p2.x
         && f.getY1() >= p1.y
         && f.getY2() <= p1.y) {
       return f;
     }
   }
   if (nw != null) {
     if (p1.x <= center.x && p1.y <= center.y) {
       ret = nw.findWallR(p1, p2);
       if (ret != null) {
         return ret;
       }
     }
     if ((p1.x > center.x || p2.x > center.x) && p1.y <= center.y) {
       ret = ne.findWallR(p1, p2);
       if (ret != null) {
         return ret;
       }
     }
     if (p1.x <= center.x && p1.y > center.y) {
       ret = sw.findWallR(p1, p2);
       if (ret != null) {
         return ret;
       }
     }
     if ((p1.x > center.x || p2.x > center.x) && p1.y > center.y) {
       ret = se.findWallR(p1, p2);
       if (ret != null) {
         return ret;
       }
     }
   }
   return null;
 }
 public final void insert(final MapleFoothold f) {
   if (depth == 0) {
     if (f.getX1() > maxDropX) {
       maxDropX = f.getX1();
     }
     if (f.getX1() < minDropX) {
       minDropX = f.getX1();
     }
     if (f.getX2() > maxDropX) {
       maxDropX = f.getX2();
     }
     if (f.getX2() < minDropX) {
       minDropX = f.getX2();
     }
   }
   if (
   /*footholds.size() == 0 || */ depth == maxDepth
       || (f.getX1() >= p1.x && f.getX2() <= p2.x && f.getY1() >= p1.y && f.getY2() <= p2.y)) {
     footholds.add(f);
   } else {
     if (nw == null) {
       nw = new MapleFootholdTree(p1, center, depth + 1);
       ne = new MapleFootholdTree(new Point(center.x, p1.y), new Point(p2.x, center.y), depth + 1);
       sw = new MapleFootholdTree(new Point(p1.x, center.y), new Point(center.x, p2.y), depth + 1);
       se = new MapleFootholdTree(center, p2, depth + 1);
     }
     if (f.getX2() <= center.x && f.getY2() <= center.y) {
       nw.insert(f);
     } else if (f.getX1() > center.x && f.getY2() <= center.y) {
       ne.insert(f);
     } else if (f.getX2() <= center.x && f.getY1() > center.y) {
       sw.insert(f);
     } else {
       se.insert(f);
     }
   }
 }