public static <V> Set<Rectangle> drawSector(Node<V> node, BufferedImage image, int w, int h, int s, int d)
    {
        Set<Rectangle> result = new HashSet<Rectangle>();
    
        Graphics2D graphics = image.createGraphics();
        
        Rectangle rect = node.nodeRect;
        if (node.color) {
            graphics.setColor(new Color(0xFF-d*20,0xFF-d*20,0x00));
        } else {
            graphics.setColor(new Color(0xFF-d*20,0xFF-d*20,0xFF-d*20));
        }
        graphics.fillRect(w/2 + s*rect.x1, h/2 - s*rect.y1,
            s*(int)rect.getWidth(), s*(int)rect.getHeight());
        
        graphics.setColor(new Color(d*20,d*20,d*20));
        graphics.drawRect(w/2 + s*rect.x1, h/2 - s*rect.y1,
            s*(int)rect.getWidth(), s*(int)rect.getHeight());
            
        Rectangle valueRect = node.valueRect;
        if (valueRect != null) {  
            result.add(valueRect);
        }
        
        graphics.dispose();
        
        if (node.split) {
            result.addAll(drawSector(node.tl, image, w, h, s, d+1));
            result.addAll(drawSector(node.tr, image, w, h, s, d+1));
            result.addAll(drawSector(node.bl, image, w, h, s, d+1));
            result.addAll(drawSector(node.br, image, w, h, s, d+1));
        }
        
        return result;
    }