--- a/front_processing/extern/TUIO_JAVA/src/TUIO/TuioPoint.java Fri Mar 09 18:15:12 2012 +0100
+++ b/front_processing/extern/TUIO_JAVA/src/TUIO/TuioPoint.java Thu Mar 15 13:33:21 2012 +0100
@@ -30,6 +30,8 @@
*/
public class TuioPoint {
+ public String comm;
+
/**
* X coordinate, representated as a floating point value in a range of 0..1
*/
@@ -39,6 +41,10 @@
*/
protected float ypos;
/**
+ * Z coordinate, representated as a floating point value in a range of 0..1
+ */
+ protected float zpos;
+ /**
* The time stamp of the last update represented as TuioTime (time since session start)
*/
protected TuioTime currentTime;
@@ -54,6 +60,7 @@
public TuioPoint() {
xpos = 0.0f;
ypos = 0.0f;
+ zpos = 0.0f;
currentTime = TuioTime.getSessionTime();
startTime = new TuioTime(currentTime);
}
@@ -68,6 +75,23 @@
public TuioPoint(float xp, float yp) {
xpos = xp;
ypos = yp;
+ zpos = 0.0f;
+ currentTime = TuioTime.getSessionTime();
+ startTime = new TuioTime(currentTime);
+ }
+
+ /**
+ * This constructor takes three floating point coordinate arguments and sets
+ * its coordinate attributes to these values and its time stamp to the current session time.
+ *
+ * @param xp the X coordinate to assign
+ * @param yp the Y coordinate to assign
+ * @param zp the Z coordinate to assign
+ */
+ public TuioPoint(float xp, float yp, float zp) {
+ xpos = xp;
+ ypos = yp;
+ zpos = zp;
currentTime = TuioTime.getSessionTime();
startTime = new TuioTime(currentTime);
}
@@ -81,6 +105,7 @@
public TuioPoint(TuioPoint tpoint) {
xpos = tpoint.getX();
ypos = tpoint.getY();
+ zpos = tpoint.getZ();
currentTime = TuioTime.getSessionTime();
startTime = new TuioTime(currentTime);
}
@@ -96,6 +121,24 @@
public TuioPoint(TuioTime ttime, float xp, float yp) {
xpos = xp;
ypos = yp;
+ zpos = 0.0f;
+ currentTime = new TuioTime(ttime);
+ startTime = new TuioTime(currentTime);
+ }
+
+ /**
+ * This constructor takes a TuioTime object and three floating point coordinate arguments and sets
+ * its coordinate attributes to these values and its time stamp to the provided TUIO time object.
+ *
+ * @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 TuioPoint(TuioTime ttime, float xp, float yp, float zp) {
+ xpos = xp;
+ ypos = yp;
+ zpos = zp;
currentTime = new TuioTime(ttime);
startTime = new TuioTime(currentTime);
}
@@ -109,6 +152,7 @@
public void update(TuioPoint tpoint) {
xpos = tpoint.getX();
ypos = tpoint.getY();
+ zpos = tpoint.getZ();
}
/**
@@ -124,6 +168,20 @@
}
/**
+ * Takes three floating point coordinate arguments and updates its coordinate attributes
+ * to the coordinates of the provided TuioPoint and leaves its time stamp unchanged.
+ *
+ * @param xp the X coordinate to assign
+ * @param yp the Y coordinate to assign
+ * @param zp the Z coordinate to assign
+ */
+ public void update(float xp, float yp, float zp) {
+ xpos = xp;
+ ypos = yp;
+ zpos = zp;
+ }
+
+ /**
* Takes a TuioTime object and two floating point coordinate arguments and updates its coordinate attributes
* to the coordinates of the provided TuioPoint and its time stamp to the provided TUIO time object.
*
@@ -138,6 +196,22 @@
}
/**
+ * Takes a TuioTime object and three floating point coordinate arguments and updates its coordinate attributes
+ * to the coordinates of the provided TuioPoint and its time stamp to the provided TUIO time object.
+ *
+ * @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) {
+ xpos = xp;
+ ypos = yp;
+ zpos = zp;
+ currentTime = new TuioTime(ttime);
+ }
+
+ /**
* Returns the X coordinate of this TuioPoint.
* @return the X coordinate of this TuioPoint
*/
@@ -154,6 +228,14 @@
}
/**
+ * Returns the Z coordinate of this TuioPoint.
+ * @return the Z coordinate of this TuioPoint
+ */
+ public float getZ() {
+ return zpos;
+ }
+
+ /**
* Returns the distance to the provided coordinates
*
* @param xp the X coordinate of the distant point
@@ -165,6 +247,21 @@
float dy = ypos-yp;
return (float)Math.sqrt(dx*dx+dy*dy);
}
+
+ /**
+ * Returns the distance to the provided coordinates
+ *
+ * @param xp the X coordinate of the distant point
+ * @param yp the Y coordinate of the distant point
+ * @param zp the Y coordinate of the distant point
+ * @return the distance to the provided coordinates
+ */
+ public float getDistance(float xp, float yp, float zp) {
+ float dx = xpos-xp;
+ float dy = ypos-yp;
+ float dz = zpos-zp;
+ return (float)Math.sqrt(dx*dx+dy*dy+dz*dz);
+ }
/**
* Returns the distance to the provided TuioPoint
@@ -173,7 +270,7 @@
* @return the distance to the provided TuioPoint
*/
public float getDistance(TuioPoint tpoint) {
- return getDistance(tpoint.getX(),tpoint.getY());
+ return getDistance(tpoint.getX(),tpoint.getY(), tpoint.getZ());
}
/**