function update_pressure(cell_data) {

        //This calculates the collective pressure on the X axis by summing the surrounding velocities
        var pressure_x = (
            cell_data.up_left.xv * 0.5 //Divided in half because it's diagonal
            + cell_data.left.xv
            + cell_data.down_left.xv * 0.5 //Same
            - cell_data.up_right.xv * 0.5 //Same
            - cell_data.right.xv
            - cell_data.down_right.xv * 0.5 //Same
        );
        
        //This does the same for the Y axis.
        var pressure_y = (
            cell_data.up_left.yv * 0.5
            + cell_data.up.yv
            + cell_data.up_right.yv * 0.5
            - cell_data.down_left.yv * 0.5
            - cell_data.down.yv
            - cell_data.down_right.yv * 0.5
        );
        
        //This sets the cell pressure to one-fourth the sum of both axis pressure.
        cell_data.pressure = (pressure_x + pressure_y) * 0.25;
    }
/*
    This function updates the pressure value for an individual cell using the 
    pressures of neighboring cells.
    */
This function updates the pressure value for an individual cell using the
pressures of neighboring cells.
This function updates the pressure value for an individual cell using the pressures of neighboring cells .
function update_pressure(cell_data) {
        var pressure_x = (
            cell_data.up_left.xv * 0.5 
            + cell_data.left.xv
            + cell_data.down_left.xv * 0.5 
            - cell_data.up_right.xv * 0.5 
            - cell_data.right.xv
            - cell_data.down_right.xv * 0.5 
        );
        var pressure_y = (
            cell_data.up_left.yv * 0.5
            + cell_data.up.yv
            + cell_data.up_right.yv * 0.5
            - cell_data.down_left.yv * 0.5
            - cell_data.down.yv
            - cell_data.down_right.yv * 0.5
        );
        cell_data.pressure = (pressure_x + pressure_y) * 0.25;
    }
function update_pressure ( cell_data ) { var pressure_x = ( cell_data . up_left . xv * 0.5 + cell_data . left . xv + cell_data . down_left . xv * 0.5 - cell_data . up_right . xv * 0.5 - cell_data . right . xv - cell_data . down_right . xv * 0.5 ) ; var pressure_y = ( cell_data . up_left . yv * 0.5 + cell_data . up . yv + cell_data . up_right . yv * 0.5 - cell_data . down_left . yv * 0.5 - cell_data . down . yv - cell_data . down_right . yv * 0.5 ) ; cell_data . pressure = ( pressure_x + pressure_y ) * 0.25 ; }
This function updates the pressure value for an individual cell using the
pressures of neighboring cells.
This function updates the pressure value for an individual cell using the pressures of neighboring cells .
//This calculates the collective pressure on the X axis by summing the surrounding velocities //Divided in half because it's diagonal //Same //Same //Same //This does the same for the Y axis. //This sets the cell pressure to one-fourth the sum of both axis pressure.