
-----------------------------------
sarge
Sun Dec 15, 2013 8:13 pm

QuadTree Help
-----------------------------------
So I am confused on some of the code that follows:  
Also I am new to this website so yea.
I am confused on the drawSegmentation and the paintSquares portion

Plus this code has to be done by 12/17/13

public class QuadTree 
{
       
        /** Attributes **/
        MyPicture pic;
        QuadNode root;
        int maxLevel;
        double RedT;
        double GreenT;
        double BlueT;
        QuadNode northWest;
        QuadNode southWest;
        QuadNode northEast;
        QuadNode southEast;
       
       
        /**
         * Constructor for QuadTree
         * @param pic - the picture object
         * @param root - the root
         * @param maxLevel - the maximum level
         * @param RedT - the red T
         * @param GreenT - the green T
         * @param BlueT - the blue T
         */
        public QuadTree (MyPicture pic, QuadNode root, int maxLevel, double RedT, double GreenT, double BlueT){
                this.pic = pic;
                this.root = root;
                this.maxLevel = maxLevel;
                this.RedT = RedT;
                this.GreenT = GreenT;
                this.BlueT = BlueT;
                this.split(root);
        }
       
        /**
         * Split helper method that splits the segments represented by it into 4 QuadNode nodes
         * One for each of northEast, northWest, southEast, and southWest
         * @param QuadNode node
         */
        public void split(QuadNode node) {
            if (homogeneous(node) != true) {
                node.northWest = new QuadNode(pic, node.getX(), node.getY(), node.getSideLength()/2,node.getLevel()+1, pic.simpleStatistics(node.getX(),node.getY(), node.getSideLength()));
                split(northWest);
                node.northEast = new QuadNode(pic, node.getX()+node.getSideLength()/2, node.getY(), node.getSideLength()/2,node.getLevel()+1, pic.simpleStatistics(node.getX(),node.getY(), node.getSideLength()));
                split(northEast);
                node.southWest = new QuadNode(pic, node.getX(), node.getY()+node.getSideLength()/2, node.getSideLength()/2,node.getLevel()+1, pic.simpleStatistics(node.getX(),node.getY(), node.getSideLength()));
                split(southWest);
                node.southEast = new QuadNode(pic, node.getX()+node.getSideLength()/2, node.getY()+node.getSideLength()/2, node.getSideLength()/2,node.getLevel()+1, pic.simpleStatistics(node.getX(),node.getY(), node.getSideLength()));
                split(southEast);
               
            }
        }
       
       
        public boolean homogeneous(QuadNode node){
                        if ((node.sigmaRed 