front_processing/src/Interaction_examples/Hands_2D/TuioFunctions.pde
author bastiena
Wed, 30 May 2012 10:21:36 +0200
changeset 35 4267d6d27a7d
parent 27 6c08d4d7219e
permissions -rw-r--r--
Front IDILL : Config file added dor the Front Random play at the beginning (when no user is detected) Pointers added Curves added (search and filter modes) Mosaic completion added (depletion to come later) State of the Front : just before the communication module creation

/*
* 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
* file that was distributed with this source code.
*/

/*FONCTION DE RECEPTION DES MESSAGES OSC
Entrée :
Sortie : Appel aux différentes fonctions de dessin si un message est reçu*/
void tuioInput()
{
    noFill();
    Vector tuioCursorList = tuioClient.getTuioCursors();
    	
    if(tuioCursorList.size() == 1)
    {
        handleOneHand((TuioCursor)tuioCursorList.elementAt(0));
    }
    else if(tuioCursorList.size() == 2)
    {
        handleBothHands(tuioCursorList);
    }
}

/*FONCTION DE GESTION DES COURBES POUR UNE MAIN DETECTEE
Entrée : Un curseur TUIO
Sortie : Envoie les coordonnées du point au fichier principal*/
void handleOneHand(TuioCursor handCursor)
{
    TuioPoint pt = handCursor.getPosition();
    fill(0);
    update((int)pt.getX(), (int)pt.getY());
}

/*FONCTION DE GESTION DES COURBES POUR DEUX MAINS DETECTEES
Entrée : La liste des curseurs TUIO
Sortie : Envoie les coordonnées du point le plus proche au fichier principal*/
void handleBothHands(Vector tuioCursorList)
{
    TuioCursor handLeftCursor = (TuioCursor)tuioCursorList.elementAt(0);
    TuioCursor handRightCursor = (TuioCursor)tuioCursorList.elementAt(1);
    TuioPoint ptLeft = handLeftCursor.getPosition(), ptRight = handRightCursor.getPosition(), ptNearest;

    ptNearest = (ptLeft.getZ() < ptRight.getZ()) ? ptLeft : ptRight;
    update((int)ptNearest.getX(), (int)ptNearest.getY());
}