front_processing/src/Fluid_manipulation/vbuffer.pde
author bastiena
Fri, 06 Apr 2012 11:48:00 +0200
changeset 24 2bdf5d51d434
parent 10 925b7ee746e3
child 27 6c08d4d7219e
permissions -rw-r--r--
Front IDILL : TuioPoint class header modified in order to manage 3D points TuioContainer class header modified in order to manage 3D points TuioCursor class header modified in order to manage 3D points TuioClient class header modified in order to manage 3D points TuioClient class modified in order to manage 3D points client class header modified in order to manage 3D points client class modified in order to manage 3D points

/*
* This file is part of the TraKERS\Front Processing package.
*
* (c) IRI <http://www.iri.centrepompidou.fr/>
*
* For the full copyright and license information, please view the LICENSE_FRONT
* file that was distributed with this source code.
*/

class vbuffer
{
    int x;
    int y;
    float xvel;
    float yvel;
    float pressurex = 0;
    float pressurey = 0;
    float pressure = 0;

    vbuffer(int xIn,int yIn)
    {
        x = xIn;
        y = yIn;
        pressurex = 0;
        pressurey = 0;
    }

    void updatebuf(int i, int u)
    {
        if(i>0 && i<lwidth && u>0 && u<lheight)
        {
            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);
            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);
            pressure = (pressurex + pressurey)*0.25;
        }
    }
}