code: public static final Point2DArray getCardinals(final BoundingBox box, final Direction[] requestedCardinals)
      {
          final Set<Direction> set = new HashSet<>(Arrays.asList(requestedCardinals));
  
          final Point2DArray points = new Point2DArray();
  
          final Point2D c = findCenter(box);
          final Point2D n = new Point2D(c.getX(), box.getY());
          final Point2D e = new Point2D(box.getX() + box.getWidth(), c.getY());
          final Point2D s = new Point2D(c.getX(), box.getY() + box.getHeight());
          final Point2D w = new Point2D(box.getX(), c.getY());
          final Point2D sw = new Point2D(w.getX(), s.getY());
          final Point2D se = new Point2D(e.getX(), s.getY());
          final Point2D ne = new Point2D(e.getX(), n.getY());
          final Point2D nw = new Point2D(w.getX(), n.getY());
  
          points.push(c);
  
          if (set.contains(Direction.NORTH))
          {
              points.push(n);
          }
          if (set.contains(Direction.NORTH_EAST))
          {
              points.push(ne);
          }
          if (set.contains(Direction.EAST))
          {
              points.push(e);
          }
          if (set.contains(Direction.SOUTH_EAST))
          {
              points.push(se);
          }
          if (set.contains(Direction.SOUTH))
          {
              points.push(s);
          }
          if (set.contains(Direction.SOUTH_WEST))
          {
              points.push(sw);
          }
          if (set.contains(Direction.WEST))
          {
              points.push(w);
          }
          if (set.contains(Direction.NORTH_WEST))
          {
              points.push(nw);
          }
          return points;
      }
docs: Returns cardinal points for a given bounding box
  
  @param box the bounding box
  @return [C, N, NE, E, SE, S, SW, W, NW]