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.

/*
	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