front_processing/src/Fluid_manipulation/vbuffer.pde
changeset 8 e4e7db2435f8
child 9 0f44b7360c8d
equal deleted inserted replaced
7:8a21bec5d45f 8:e4e7db2435f8
       
     1 /*
       
     2 * This file is part of the TraKERS\Front Processing package.
       
     3 *
       
     4 * (c) IRI <http://www.iri.centrepompidou.fr/>
       
     5 *
       
     6 * For the full copyright and license information, please view the LICENSE_FRONT
       
     7 * file that was distributed with this source code.
       
     8 */
       
     9 
       
    10 class vbuffer
       
    11 {
       
    12     int x;
       
    13     int y;
       
    14     float xvel;
       
    15     float yvel;
       
    16     float pressurex = 0;
       
    17     float pressurey = 0;
       
    18     float pressure = 0;
       
    19 
       
    20     vbuffer(int xIn,int yIn)
       
    21     {
       
    22         x = xIn;
       
    23         y = yIn;
       
    24         pressurex = 0;
       
    25         pressurey = 0;
       
    26     }
       
    27 
       
    28     void updatebuf(int i, int u)
       
    29     {
       
    30         if(i>0 && i<lwidth && u>0 && u<lheight)
       
    31         {
       
    32             pressurex = (v[i-1][u-1].xvel*0.5 + v[i-1][u].xvel + v[i-1][u+1].xvel*0.5 - v[i+1][u-1].xvel*0.5 - v[i+1][u].xvel - v[i+1][u+1].xvel*0.5);
       
    33             pressurey = (v[i-1][u-1].yvel*0.5 + v[i][u-1].yvel + v[i+1][u-1].yvel*0.5 - v[i-1][u+1].yvel*0.5 - v[i][u+1].yvel - v[i+1][u+1].yvel*0.5);
       
    34             pressure = (pressurex + pressurey)*0.25;
       
    35         }
       
    36     }
       
    37 }