front_idill/extern/fajran-npTuioClient/TuioClient/TuioObject.h
author bastiena
Thu, 12 Apr 2012 15:33:25 +0200
changeset 28 9ccef81f02ab
parent 21 e4e5f02787a1
permissions -rw-r--r--
Charset set to UTF-8 without bom tab replaced by 4 spaces \r\n replaced by \n in non cs files
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
21
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     1
/*
28
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
     2
    TUIO C++ Library - part of the reacTIVision project
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
     3
    http://reactivision.sourceforge.net/
21
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     4
28
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
     5
    Copyright (c) 2005-2008 Martin Kaltenbrunner <mkalten@iua.upf.edu>
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
     6
    
21
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     7
    This program is free software; you can redistribute it and/or modify
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     8
    it under the terms of the GNU General Public License as published by
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     9
    the Free Software Foundation; either version 2 of the License, or
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    10
    (at your option) any later version.
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    11
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    12
    This program is distributed in the hope that it will be useful,
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    13
    but WITHOUT ANY WARRANTY; without even the implied warranty of
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    14
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    15
    GNU General Public License for more details.
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    16
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    17
    You should have received a copy of the GNU General Public License
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    18
    along with this program; if not, write to the Free Software
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    19
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    20
*/
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    21
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    22
#ifndef INCLUDED_TUIOOBJECT_H
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    23
#define INCLUDED_TUIOOBJECT_H
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    24
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    25
#ifndef M_PI
28
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    26
#define M_PI    3.14159265358979323846
21
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    27
#endif
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    28
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    29
#include <list>
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    30
#include <math.h>
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    31
#include "TuioContainer.h"
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    32
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    33
class TuioObject: public TuioContainer {
28
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    34
    
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    35
    protected:
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    36
        long session_id;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    37
        int fiducial_id;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    38
        float xpos, ypos, angle;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    39
        float x_speed, y_speed, motion_speed, motion_accel;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    40
        float rotation_speed, rotation_accel;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    41
        std::list<TuioPoint> path;
21
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    42
28
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    43
    public:
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    44
    TuioObject (long s_id, int f_id, float xpos, float ypos, float angle):TuioContainer(s_id, xpos, ypos) {
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    45
        this->fiducial_id = f_id;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    46
        this->angle = angle;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    47
        this->rotation_speed = 0.0f;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    48
        this->rotation_accel = 0.0f;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    49
    };
21
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    50
28
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    51
    TuioObject (TuioObject *tuioObject):TuioContainer(tuioObject) {
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    52
        this->fiducial_id = tuioObject->getFiducialID();
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    53
        this->angle = angle;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    54
        this->rotation_speed = 0.0f;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    55
        this->rotation_accel = 0.0f;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    56
    };
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    57
    
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    58
    ~TuioObject() {};
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    59
    
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    60
    void update (float xpos, float ypos, float angle, float xspeed, float yspeed, float rspeed, float maccel, float raccel) {
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    61
        TuioContainer::update(xpos,ypos,xspeed,yspeed,maccel);
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    62
        this->angle = angle;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    63
        this->rotation_speed = rspeed;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    64
        this->rotation_accel = raccel;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    65
    };
21
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    66
28
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    67
    void update (TuioObject *tuioObject) {
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    68
        TuioContainer::update(tuioObject);
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    69
        this->angle = tuioObject->getAngle();
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    70
        this->rotation_speed = tuioObject->getRotationSpeed();
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    71
        this->rotation_accel = tuioObject->getRotationAccel();
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    72
    };
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    73
    
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    74
    int getFiducialID() { return fiducial_id; };
21
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    75
28
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    76
    float getAngle() { return angle; }
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    77
    float getAngleDegrees() { return (float)(angle/M_PI*180); }
21
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    78
28
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    79
    float getRotationSpeed() { return rotation_speed; };
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    80
    float getRotationAccel() { return rotation_accel; };
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    81
    
21
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    82
};
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    83
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    84
#endif