private void doDrawing(Graphics g) {
        Graphics2D g2d = (Graphics2D) g;

        g2d.setColor(Color.black);

        Dimension size = getSize();
        Insets insets = getInsets();

        int w = size.width - insets.left - insets.right;
        int h = size.height - insets.top - insets.bottom;

        /* Фокусное расстояние и прочий бред */
        double Mw = 1, Mh = 1;
        double focus = 0.5;
        double alpha = Math.atan2(Mw, focus);
        double betta = Math.atan2(Mh, focus);
        double x_steep = alpha / w;
        double y_steep = betta / h;



        ArrayList<sphere> myList = new ArrayList<sphere>();

        myList.add(new sphere(new P(100, 100, 0), 50));
        myList.add(new sphere(new P(300, 300, 0), 50));
        myList.add(new sphere(new P(300, 300, 300), 50));

        figure f = new figure(10, 15, 20, 30);

        figure f2 = new figure(40, 50, 30, 94);



        Random r = new Random();

        BufferedImage img = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB );

        for ( int rc = 0; rc < h; rc++ ) {
            for ( int cc = 0; cc < w; cc++ ) {
                // Set the pixel colour of the image n.b. x = cc, y = rc
                img.setRGB(cc, rc, Color.BLACK.getRGB() );
            }//for cols
        }//for rows

        for (int x = 0; x < w; x++) {
            for (int y = 0; y < h; y++)
            {
                float x1 = (float)(Math.sin(x_steep * x) * Math.cos(y_steep * y));
                float z1 = (float)(Math.cos(x_steep * x) * Math.cos(y_steep * y));
                float y1 = (float)(Math.sin(y_steep * y));
                Ray ray = new Ray(new P(x, y, -10), new P(x1, y1, z1));
                for (sphere s : myList )
                {
                    if (s.Bound(ray))
                          img.setRGB(x, y, Color.WHITE.getRGB());
                }
            }
        }


        float[] scales = { 1f, 1f, 1f, 1f };
        float[] offsets = new float[4];
        RescaleOp rop = new RescaleOp(scales, offsets, null);
        g2d.drawImage(img, rop, 0, 0);
    }