src/Generator.java
/**
     * Recursively calculates and fills a list of fractal elements to be drawn.
     *
     * @param fractalElements The temporary given fractal elements list
     * @param radius          The radius of the parent circle
     * @param recursionDepth  The current depth of recursion for each child
     * @param xCenter         The temporary given x-position of the center of the parent circle
     * @param yCenter         The temporary given y-position of the center of the parent circle
     */
Recursively calculates and fills a list of fractal elements to be drawn.
Recursively calculates and fills a list of fractal elements to be drawn .
private void generateChildren(ArrayList<FractalElement> fractalElements, double radius, int recursionDepth, double xCenter, double yCenter) {
        if (radius >= MINIMUM_DRAW_RADIUS && recursionDepth >= 1) {
            Circle parent = new Circle(color, xCenter, yCenter, radius);
            fractalElements.add(parent);
            recursionDepth--;
            double angleOffset = Math.PI / 2;
            double parentRadius = radius;
            radius *= childParentRatio * .01;
            double xChildCenter, yChildCenter;
            double xTetherStart, yTetherStart;
            double xTetherEnd, yTetherEnd;
            /*
            The tether's distance between the intersection point on the parent circle to the center of the child
            circle is equal to the parent radius. The distance between the parent's center point and the child's center
            point is equal to the parent's diameter.
            */
            for (int currentChild = 1; currentChild <= this.childCount; currentChild++) {
                xChildCenter = xCenter + (Math.cos(angleOffset) * parentRadius * 2);
                yChildCenter = yCenter + (Math.sin(angleOffset) * parentRadius * 2);
                generateChildren(fractalElements, radius, recursionDepth, xChildCenter, yChildCenter);
                if (recursionDepth >= 1 && radius >= MINIMUM_DRAW_RADIUS) {
                    xTetherStart = xCenter + (Math.cos(angleOffset) * parentRadius);
                    yTetherStart = yCenter + (Math.sin(angleOffset) * parentRadius);
                    xTetherEnd = xChildCenter - (Math.cos(angleOffset) * radius);
                    yTetherEnd = yChildCenter - (Math.sin(angleOffset) * radius);
                    Line tether = new Line(color, xTetherStart, yTetherStart, xTetherEnd, yTetherEnd);
                    fractalElements.add(tether);
                }
                angleOffset += (2 * Math.PI / this.childCount);
            }
        }
    }
private void generateChildren ( ArrayList < FractalElement > fractalElements , double radius , int recursionDepth , double xCenter , double yCenter ) { if ( radius >= MINIMUM_DRAW_RADIUS && recursionDepth >= 1 ) { Circle parent = new Circle ( color , xCenter , yCenter , radius ) ; fractalElements . add ( parent ) ; recursionDepth -- ; double angleOffset = Math . PI / 2 ; double parentRadius = radius ; radius *= childParentRatio * .01 ; double xChildCenter , yChildCenter ; double xTetherStart , yTetherStart ; double xTetherEnd , yTetherEnd ; /*
            The tether's distance between the intersection point on the parent circle to the center of the child
            circle is equal to the parent radius. The distance between the parent's center point and the child's center
            point is equal to the parent's diameter.
            */ for ( int currentChild = 1 ; currentChild <= this . childCount ; currentChild ++ ) { xChildCenter = xCenter + ( Math . cos ( angleOffset ) * parentRadius * 2 ) ; yChildCenter = yCenter + ( Math . sin ( angleOffset ) * parentRadius * 2 ) ; generateChildren ( fractalElements , radius , recursionDepth , xChildCenter , yChildCenter ) ; if ( recursionDepth >= 1 && radius >= MINIMUM_DRAW_RADIUS ) { xTetherStart = xCenter + ( Math . cos ( angleOffset ) * parentRadius ) ; yTetherStart = yCenter + ( Math . sin ( angleOffset ) * parentRadius ) ; xTetherEnd = xChildCenter - ( Math . cos ( angleOffset ) * radius ) ; yTetherEnd = yChildCenter - ( Math . sin ( angleOffset ) * radius ) ; Line tether = new Line ( color , xTetherStart , yTetherStart , xTetherEnd , yTetherEnd ) ; fractalElements . add ( tether ) ; } angleOffset += ( 2 * Math . PI / this . childCount ) ; } } }
Recursively calculates and fills a list of fractal elements to be drawn.
Recursively calculates and fills a list of fractal elements to be drawn .
//base case //Generates spokes and calculates where children go