public void render(Interval interval)
        {
            // Screen variables
            int[] row = new int[interval.width * (interval.yto - interval.yfrom)];
            int pixCounter = 0; //iterator

            // Rendering variables
            int x, y, red, green, blue;
            double xlen, ylen;
            Vec viewVec;

            viewVec = Vec.sub(view.at, view.from);

            viewVec.normalize();

            Vec tmpVec = new Vec(viewVec);
            tmpVec.scale(Vec.dot(view.up, viewVec));

            Vec upVec = Vec.sub(view.up, tmpVec);
            upVec.normalize();

            Vec leftVec = Vec.cross(view.up, viewVec);
            leftVec.normalize();

            double frustrumwidth = view.dist * Math.Tan(view.angle);

            upVec.scale(-frustrumwidth);
            leftVec.scale(view.aspect * frustrumwidth);

            Ray r = new Ray(view.from, voidVec);
            Vec col = new Vec();

            // Header for .ppm file
            // System.out.println("P3");
            // System.out.println(width + " " + height);
            // System.out.println("255");

            // All loops are reversed for 'speedup' (cf. thinking in java p331)

            // For each line
            for (y = interval.yfrom; y < interval.yto; y++)
            {
                ylen = (double)(2.0 * y) / (double)interval.width - 1.0;
                // System.out.println("Doing line " + y);
                // For each pixel of the line
                for (x = 0; x < interval.width; x++)
                {
                    xlen = (double)(2.0 * x) / (double)interval.width - 1.0;
                    r.D = Vec.comb(xlen, leftVec, ylen, upVec);
                    r.D.add(viewVec);
                    r.D.normalize();
                    col = trace(0, 1.0, r);

                    // computes the color of the ray
                    red = (int)(col.x * 255.0);
                    if (red > 255)
                        red = 255;
                    green = (int)(col.y * 255.0);
                    if (green > 255)
                        green = 255;
                    blue = (int)(col.z * 255.0);
                    if (blue > 255)
                        blue = 255;

                    checksum += red;
                    checksum += green;
                    checksum += blue;

                    // RGB values for .ppm file
                    // System.out.println(red + " " + green + " " + blue);
                    // Sets the pixels
                    row[pixCounter++] = alpha | (red << 16) | (green << 8) | (blue);
                } // end for (x)
            } // end for (y)
        }
        public static void Main()
        {
            RayTracer rt = new RayTracer();

            // create the objects to be rendered
            rt.scene = rt.createScene();

            // get lights, objects etc. from scene.
            rt.setScene(rt.scene);

            // Set interval to be rendered to the whole picture
            // (overkill, but will be useful to retain this for parallel versions)
            Interval interval = new Interval(0, rt.width, rt.height, 0, rt.height, 1);

            // Do the business!
            rt.render(interval);
        }