//--------------------------------------------------------------
void ofApp::update(){

    for(int i = 0; i < myBirds.size(); i++){//loop through every bird
        
        
        //----------------------------------------------------------------
        // create temporary (ie this frame) acceleration (A), and 3 sub accelerations (A1, A2, A3) that will soon be calculated and added to our birds vel
        //----------------------------------------------------------------
        ofPoint A;  // A
        ofPoint A1 = accTowardsCenterOfMass(i); // A1 - the bird wanting to move towards the middle of all other birds
        ofPoint A2 = accAwayFromNearbyBirds(i); // A2 - the bird wanting to move away from fellow birds that are too close
        ofPoint A3 = accInDirectionOfNearbyBirdMovement(i); // A3 - the bird wanting to move the same speed as nearby friends
        
        //----------------------------------------------------------------
        // Give this bird some individuality
        //----------------------------------------------------------------
        float loneWolfliness = 1.0; // lW - find this bird's desire to explore alone
        float proximityComfort = 1.0; // pC - find this bird's apathy to being in close quarters with other birds
        float flowConsideration = 1.0; // fC - find this bird's consideration for other birds' desire to get home from work
        
        //----------------------------------------------------------------
        // A = (aF) * ( (lW)*A1 + (pC)*A2 + (fC)*A3 ) ... find my total influence of sub-intentions
        //----------------------------------------------------------------
        float aFactor = 0.02; // aF - a multiplier for scaling the tempAcc
        A = (aFactor) * ((loneWolfliness)*A1 + (proximityComfort)*A2 + (flowConsideration)*A3);
        myBirds[i].acc = A; //myBirds.acc = A
    }
    
    for(int i = 0; i < myBirds.size(); i++){
        myBirds[i].update();
    } //tempBird is no more
    
}
//--------------------------------------------------------------
void ofApp::update(){
    for(int i=0; i<myBirds.size(); i++){//loop through every bird
        ofPoint tempAcc; //create a temporary acceleration, and 3 sub accelerations that will soon be calculated and added to the
        ofPoint a1 = accTowardsCenterOfMass(i);
        ofPoint a2 = accAwayFromNearbyBirds(i);
        ofPoint a3 = accInDirectionOfNearbyBirdMovement(i);
        //A1 = the bird wanting to move towards the middle of all other birds
        //A2 = the bird wanting to move away from fellow birds that are too close
        //A3 = birds wanting to move the same speed as nearby friends
        tempAcc = a1 + a2 + a3;//A = A1+A2+A3 ...  find my total influence of sub-intentions
        myBirds[i].acc = tempAcc; //myBirds.acc = A
    }
    
    
    
        
    for(int i=0; i<myBirds.size(); i++){
        myBirds[i].update();
    } //tempBird is no more
}
//--------------------------------------------------------------
void ofApp::update(){

    for(int i = 0; i < myBirds.size(); i++){//loop through every bird
        
        
        //----------------------------------------------------------------
        // create temporary (ie this frame) acceleration (A), and 3 sub accelerations (A1, A2, A3) that will soon be calculated and added to our birds vel
        //----------------------------------------------------------------
        aFactor = 0.01; // aF - a multiplier for scaling the "temp acceleration" (A)
        A = ofPoint(0,0,0);  // A
        A1 = accTowardsCenterOfMass(i); // A1 - the bird wanting to move towards the middle of all other birds
        A2 = accAwayFromNearbyBirds(i); // A2 - the bird wanting to move away from fellow birds that are too close
        A3 = accInDirectionOfNearbyBirdMovement(i); // A3 - the bird wanting to move the same speed as nearby friends
        A4 = accTowardsCursor(i);
        
        //----------------------------------------------------------------
        // Give this bird some individuality
        //----------------------------------------------------------------
        herdDependency = myBirds[i].herdDependency; // lW - find this bird's desire to explore alone
        proximityDiscomfort = myBirds[i].proximityDiscomfort; // pD - find this bird's apathy to being in close quarters with other birds
        flowConsideration = myBirds[i].flowConsideration; // fC - find this bird's consideration for other birds' desire to get home from work
        if(isMousePressed){
            cursorCuriosity = myBirds[i].cursorCuriosity; // cC - find the bird's desire to move towards your cursor
        } else {
            cursorCuriosity = 0;
        }
        
        //----------------------------------------------------------------
        // A = (aF) * ( (lW)*A1 + (pD)*A2 + (fC)*A3 (cC)*A4 ) ... find my total influence of sub-intentions
        //----------------------------------------------------------------
        
        A = (aFactor) * ((herdDependency)*A1 + (proximityDiscomfort)*A2 + (flowConsideration)*A3 + (cursorAmp)*(cursorCuriosity)*A4);
        
        myBirds[i].acc = A; //myBirds.acc = A
    }
    
    if (frameCounter >= framesBetweenRecordedPosition) { //if it's been long enough to add the bird's position to its memory
        for(int i = 0; i < myBirds.size(); i++){
            myBirds[i].update(true); //add that position
        }
        frameCounter = 0;
    } else { //if it hasn't been long enough to store a memory
        for(int i = 0; i < myBirds.size(); i++){
            myBirds[i].update(false); //add that position
        }
    }
    frameCounter++; //update the frame counter that's being tracked to store previous positions
    
    //if isMousePressed
    if(isMousePressed){
        secSincePress = (ofGetElapsedTimeMillis()-timeOfPress)/1000;
        y = ((-10)/((.5)*secSincePress+1)+10) / (10);   // y = ((-10)/((0.5)x+1) + 10) / (10) ... to get an asymptote approaching 10
        cout << "cursorAmp: " << cursorAmp << endl;
        cursorAmp = y * ampAsymptote;
        
    } else {
        cursorAmp = 1.0;
    }
    //make radius of ball scale but approach an asymptote (maximum radius)
    //and increase the weight of the inward acceleration caused by mousePressed
    //upon mouse released ... reset values
}