front_idill/extern/fajran-npTuioClient/TuioClient/TuioObject.h
author bastiena
Thu, 12 Apr 2012 13:09:46 +0200
changeset 27 6c08d4d7219e
parent 21 e4e5f02787a1
child 28 9ccef81f02ab
permissions -rw-r--r--
Middleware : GPL License added. Front Processing : GPL License added. Front IDILL : extern altered to send TUIO cursors from Middleware to Front. implemented as a plugin.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
21
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     1
/*
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     2
	TUIO C++ Library - part of the reacTIVision project
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     3
	http://reactivision.sourceforge.net/
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     4
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     5
	Copyright (c) 2005-2008 Martin Kaltenbrunner <mkalten@iua.upf.edu>
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     6
	
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
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    26
#define M_PI	3.14159265358979323846
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 {
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    34
	
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    35
	protected:
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    36
		long session_id;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    37
		int fiducial_id;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    38
		float xpos, ypos, angle;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    39
		float x_speed, y_speed, motion_speed, motion_accel;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    40
		float rotation_speed, rotation_accel;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    41
		std::list<TuioPoint> path;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    42
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    43
	public:
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    44
	TuioObject (long s_id, int f_id, float xpos, float ypos, float angle):TuioContainer(s_id, xpos, ypos) {
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    45
		this->fiducial_id = f_id;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    46
		this->angle = angle;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    47
		this->rotation_speed = 0.0f;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    48
		this->rotation_accel = 0.0f;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    49
	};
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    50
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    51
	TuioObject (TuioObject *tuioObject):TuioContainer(tuioObject) {
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    52
		this->fiducial_id = tuioObject->getFiducialID();
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    53
		this->angle = angle;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    54
		this->rotation_speed = 0.0f;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    55
		this->rotation_accel = 0.0f;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    56
	};
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    57
	
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    58
	~TuioObject() {};
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    59
	
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    60
	void update (float xpos, float ypos, float angle, float xspeed, float yspeed, float rspeed, float maccel, float raccel) {
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    61
		TuioContainer::update(xpos,ypos,xspeed,yspeed,maccel);
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    62
		this->angle = angle;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    63
		this->rotation_speed = rspeed;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    64
		this->rotation_accel = raccel;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    65
	};
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    66
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    67
	void update (TuioObject *tuioObject) {
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    68
		TuioContainer::update(tuioObject);
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    69
		this->angle = tuioObject->getAngle();
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    70
		this->rotation_speed = tuioObject->getRotationSpeed();
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    71
		this->rotation_accel = tuioObject->getRotationAccel();
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    72
	};
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    73
	
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    74
	int getFiducialID() { return fiducial_id; };
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    75
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    76
	float getAngle() { return angle; }
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    77
	float getAngleDegrees() { return (float)(angle/M_PI*180); }
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    78
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    79
	float getRotationSpeed() { return rotation_speed; };
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    80
	float getRotationAccel() { return rotation_accel; };
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    81
	
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