function change_cell_velocity(cell_data, mvelX, mvelY, pen_size) {
        //This gets the distance between the cell and the mouse cursor.
        var dx = cell_data.x - mouse.x;
        var dy = cell_data.y - mouse.y;
        var dist = Math.sqrt(dy * dy + dx * dx);
        
        //If the distance is less than the radius...
        if (dist < pen_size) {

            //If the distance is very small, set it to the pen_size.
            if (dist < 4) {
                dist = pen_size;
            }
            
            //Calculate the magnitude of the mouse's effect (closer is stronger)
            var power = pen_size / dist;

            /*
            Apply the velocity to the cell by multiplying the power by the mouse velocity and adding it to the cell velocity
            */
            cell_data.xv += mvelX * power;
            cell_data.yv += mvelY * power;
        }
    }
/*
    This function changes the cell velocity of an individual cell by first determining whether the cell is 
    close enough to the mouse cursor to be affected, and then if it is, by calculating the effect that mouse velocity
    has on the cell's velocity.
    */
This function changes the cell velocity of an individual cell by first determining whether the cell is
close enough to the mouse cursor to be affected, and then if it is, by calculating the effect that mouse velocity
has on the cell's velocity.
This function changes the cell velocity of an individual cell by first determining whether the cell is close enough to the mouse cursor to be affected and then if it is by calculating the effect that mouse velocity has on the cell ' s velocity .
function change_cell_velocity(cell_data, mvelX, mvelY, pen_size) {
        var dx = cell_data.x - mouse.x;
        var dy = cell_data.y - mouse.y;
        var dist = Math.sqrt(dy * dy + dx * dx);
        if (dist < pen_size) {
            if (dist < 4) {
                dist = pen_size;
            }
            var power = pen_size / dist;
            cell_data.xv += mvelX * power;
            cell_data.yv += mvelY * power;
        }
    }
function change_cell_velocity ( cell_data , mvelX , mvelY , pen_size ) { var dx = cell_data . x - mouse . x ; var dy = cell_data . y - mouse . y ; var dist = Math . sqrt ( dy * dy + dx * dx ) ; if ( dist < pen_size ) { if ( dist < 4 ) { dist = pen_size ; } var power = pen_size / dist ; cell_data . xv += mvelX * power ; cell_data . yv += mvelY * power ; } }
This function changes the cell velocity of an individual cell by first determining whether the cell is
close enough to the mouse cursor to be affected, and then if it is, by calculating the effect that mouse velocity
has on the cell's velocity.
This function changes the cell velocity of an individual cell by first determining whether the cell is close enough to the mouse cursor to be affected and then if it is by calculating the effect that mouse velocity has on the cell ' s velocity .
//This gets the distance between the cell and the mouse cursor. //If the distance is less than the radius... //If the distance is very small, set it to the pen_size. //Calculate the magnitude of the mouse's effect (closer is stronger) /*
            Apply the velocity to the cell by multiplying the power by the mouse velocity and adding it to the cell velocity
            */