front_idill/extern/fajran-npTuioClient/TuioClient/TuioObject.h
changeset 21 e4e5f02787a1
child 28 9ccef81f02ab
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/front_idill/extern/fajran-npTuioClient/TuioClient/TuioObject.h	Fri Apr 06 10:44:54 2012 +0200
@@ -0,0 +1,84 @@
+/*
+	TUIO C++ Library - part of the reacTIVision project
+	http://reactivision.sourceforge.net/
+
+	Copyright (c) 2005-2008 Martin Kaltenbrunner <mkalten@iua.upf.edu>
+	
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#ifndef INCLUDED_TUIOOBJECT_H
+#define INCLUDED_TUIOOBJECT_H
+
+#ifndef M_PI
+#define M_PI	3.14159265358979323846
+#endif
+
+#include <list>
+#include <math.h>
+#include "TuioContainer.h"
+
+class TuioObject: public TuioContainer {
+	
+	protected:
+		long session_id;
+		int fiducial_id;
+		float xpos, ypos, angle;
+		float x_speed, y_speed, motion_speed, motion_accel;
+		float rotation_speed, rotation_accel;
+		std::list<TuioPoint> path;
+
+	public:
+	TuioObject (long s_id, int f_id, float xpos, float ypos, float angle):TuioContainer(s_id, xpos, ypos) {
+		this->fiducial_id = f_id;
+		this->angle = angle;
+		this->rotation_speed = 0.0f;
+		this->rotation_accel = 0.0f;
+	};
+
+	TuioObject (TuioObject *tuioObject):TuioContainer(tuioObject) {
+		this->fiducial_id = tuioObject->getFiducialID();
+		this->angle = angle;
+		this->rotation_speed = 0.0f;
+		this->rotation_accel = 0.0f;
+	};
+	
+	~TuioObject() {};
+	
+	void update (float xpos, float ypos, float angle, float xspeed, float yspeed, float rspeed, float maccel, float raccel) {
+		TuioContainer::update(xpos,ypos,xspeed,yspeed,maccel);
+		this->angle = angle;
+		this->rotation_speed = rspeed;
+		this->rotation_accel = raccel;
+	};
+
+	void update (TuioObject *tuioObject) {
+		TuioContainer::update(tuioObject);
+		this->angle = tuioObject->getAngle();
+		this->rotation_speed = tuioObject->getRotationSpeed();
+		this->rotation_accel = tuioObject->getRotationAccel();
+	};
+	
+	int getFiducialID() { return fiducial_id; };
+
+	float getAngle() { return angle; }
+	float getAngleDegrees() { return (float)(angle/M_PI*180); }
+
+	float getRotationSpeed() { return rotation_speed; };
+	float getRotationAccel() { return rotation_accel; };
+	
+};
+
+#endif