private void generateCircle(int index) {
        //This method generates a new circle.
        //TODO: rewrite this more gracefully.
        outer:
        while (foci[index] == null) {
            //let's look for a new coordinate.
            double randx = r.nextDouble() * DWIDTH;
            double randy = r.nextDouble() * DHEIGHT;

            for (Circle c : others) {
                if (c.within(randx, randy)) {
                    continue outer;
                }
            }

            for (Circle c : foci) {
                if (c != null && c.within(randx, randy)) {
                    continue outer;
                }
            }

            foci[index] = new Circle(randx, randy, new Color((int) (r.nextDouble() * Integer.MAX_VALUE)));
        }
    }