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