--- a/front_processing/extern/TUIO_JAVA/src/TUIO/TuioContainer.java Fri Mar 09 18:15:12 2012 +0100
+++ b/front_processing/extern/TUIO_JAVA/src/TUIO/TuioContainer.java Thu Mar 15 13:33:21 2012 +0100
@@ -103,6 +103,30 @@
}
/**
+ * This constructor takes a TuioTime argument and assigns it along with the provided
+ * Session ID, X, Y and Z coordinate to the newly created TuioContainer.
+ *
+ * @param ttime the TuioTime to assign
+ * @param si the Session ID to assign
+ * @param xp the X coordinate to assign
+ * @param yp the Y coordinate to assign
+ * @param zp the Z coordinate to assign
+ */
+ TuioContainer(TuioTime ttime, long si, float xp, float yp, float zp) {
+ super(ttime,xp,yp, zp);
+
+ session_id = si;
+ x_speed = 0.0f;
+ y_speed = 0.0f;
+ motion_speed = 0.0f;
+ motion_accel = 0.0f;
+
+ path = new Vector<TuioPoint>();
+ path.addElement(new TuioPoint(currentTime,xpos,ypos,zpos));
+ state = TUIO_ADDED;
+ }
+
+ /**
* This constructor takes the provided Session ID, X and Y coordinate
* and assigs these values to the newly created TuioContainer.
*
@@ -125,6 +149,29 @@
}
/**
+ * This constructor takes the provided Session ID, X, Y and Z coordinate
+ * and assigs these values to the newly created TuioContainer.
+ *
+ * @param si the Session ID to assign
+ * @param xp the X coordinate to assign
+ * @param yp the Y coordinate to assign
+ * @param zp the Z coordinate to assign
+ */
+ TuioContainer(long si, float xp, float yp, float zp) {
+ super(xp,yp,zp);
+
+ session_id = si;
+ x_speed = 0.0f;
+ y_speed = 0.0f;
+ motion_speed = 0.0f;
+ motion_accel = 0.0f;
+
+ path = new Vector<TuioPoint>();
+ path.addElement(new TuioPoint(currentTime,xpos,ypos,zpos));
+ state = TUIO_ADDED;
+ }
+
+ /**
* This constructor takes the atttibutes of the provided TuioContainer
* and assigs these values to the newly created TuioContainer.
*
@@ -140,7 +187,7 @@
motion_accel = 0.0f;
path = new Vector<TuioPoint>();
- path.addElement(new TuioPoint(currentTime,xpos,ypos));
+ path.addElement(new TuioPoint(currentTime,xpos,ypos,zpos));
state = TUIO_ADDED;
}
@@ -176,11 +223,44 @@
}
/**
+ * Takes a TuioTime argument and assigns it along with the provided
+ * X, Y and Z coordinate to the private TuioContainer attributes.
+ * The speed and accleration values are calculated accordingly.
+ *
+ * @param ttime the TuioTime to assign
+ * @param xp the X coordinate to assign
+ * @param yp the Y coordinate to assign
+ * @param zp the Z coordinate to assign
+ */
+ public void update(TuioTime ttime, float xp, float yp, float zp) {
+ TuioPoint lastPoint = path.lastElement();
+ super.update(ttime,xp,yp,zp);
+
+ TuioTime diffTime = currentTime.subtract(lastPoint.getTuioTime());
+ float dt = diffTime.getTotalMilliseconds()/1000.0f;
+ float dx = this.xpos - lastPoint.getX();
+ float dy = this.ypos - lastPoint.getY();
+ float dz = this.zpos - lastPoint.getZ();
+ float dist = (float)Math.sqrt(dx*dx+dy*dy+dz*dz);
+ float last_motion_speed = this.motion_speed;
+
+ this.x_speed = dx/dt;
+ this.y_speed = dy/dt;
+ this.motion_speed = dist/dt;
+ this.motion_accel = (motion_speed - last_motion_speed)/dt;
+
+ path.addElement(new TuioPoint(currentTime,xpos,ypos,zpos));
+ if (motion_accel>0) state = TUIO_ACCELERATING;
+ else if (motion_accel<0) state = TUIO_DECELERATING;
+ else state = TUIO_STOPPED;
+ }
+
+ /**
* This method is used to calculate the speed and acceleration values of
* TuioContainers with unchanged positions.
*/
public void stop(TuioTime ttime) {
- update(ttime,xpos,ypos);
+ update(ttime,xpos,ypos,zpos);
}
/**
@@ -208,6 +288,31 @@
}
/**
+ * Takes a TuioTime argument and assigns it along with the provided
+ * X, Y and Z coordinate, X and Y velocity and acceleration
+ * to the private TuioContainer attributes.
+ *
+ * @param ttime the TuioTime to assign
+ * @param xp the X coordinate to assign
+ * @param yp the Y coordinate to assign
+ * @param zp the Z coordinate to assign
+ * @param xs the X velocity to assign
+ * @param ys the Y velocity to assign
+ * @param ma the acceleration to assign
+ */
+ public void update(TuioTime ttime, float xp, float yp, float zp , float xs, float ys, float ma) {
+ super.update(ttime,xp,yp,zp);
+ x_speed = xs;
+ y_speed = ys;
+ motion_speed = (float)Math.sqrt(x_speed*x_speed+y_speed*y_speed);
+ motion_accel = ma;
+ path.addElement(new TuioPoint(currentTime,xpos,ypos,zpos));
+ if (motion_accel>0) state = TUIO_ACCELERATING;
+ else if (motion_accel<0) state = TUIO_DECELERATING;
+ else state = TUIO_STOPPED;
+ }
+
+ /**
* Assigns the provided X and Y coordinate, X and Y velocity and acceleration
* to the private TuioContainer attributes. The TuioTime time stamp remains unchanged.
*
@@ -230,6 +335,29 @@
}
/**
+ * Assigns the provided X, Y and Z coordinate, X and Y velocity and acceleration
+ * to the private TuioContainer attributes. The TuioTime time stamp remains unchanged.
+ *
+ * @param xp the X coordinate to assign
+ * @param yp the Y coordinate to assign
+ * @param zp the Z coordinate to assign
+ * @param xs the X velocity to assign
+ * @param ys the Y velocity to assign
+ * @param ma the acceleration to assign
+ */
+ public void update(float xp, float yp, float zp,float xs,float ys,float ma) {
+ super.update(xp,yp,zp);
+ x_speed = xs;
+ y_speed = ys;
+ motion_speed = (float)Math.sqrt(x_speed*x_speed+y_speed*y_speed);
+ motion_accel = ma;
+ path.addElement(new TuioPoint(currentTime,xpos,ypos,zpos));
+ if (motion_accel>0) state = TUIO_ACCELERATING;
+ else if (motion_accel<0) state = TUIO_DECELERATING;
+ else state = TUIO_STOPPED;
+ }
+
+ /**
* Takes the atttibutes of the provided TuioContainer
* and assigs these values to this TuioContainer.
* The TuioTime time stamp of this TuioContainer remains unchanged.
@@ -242,7 +370,7 @@
y_speed = tcon.getYSpeed();
motion_speed = tcon.getMotionSpeed();
motion_accel = tcon.getMotionAccel();
- path.addElement(new TuioPoint(currentTime,xpos,ypos));
+ path.addElement(new TuioPoint(currentTime,xpos,ypos,zpos));
if (motion_accel>0) state = TUIO_ACCELERATING;
else if (motion_accel<0) state = TUIO_DECELERATING;
else state = TUIO_STOPPED;
@@ -288,7 +416,7 @@
* @return the position of this TuioContainer
*/
public TuioPoint getPosition() {
- return new TuioPoint(xpos,ypos);
+ return new TuioPoint(xpos,ypos,zpos);
}
/**