# HG changeset patch # User bastiena # Date 1333705680 -7200 # Node ID 2bdf5d51d434f8fb3d6d5e4917312209466a49b1 # Parent 7372c4f249c7476c31711e7987c429d4b815448e Front IDILL : TuioPoint class header modified in order to manage 3D points TuioContainer class header modified in order to manage 3D points TuioCursor class header modified in order to manage 3D points TuioClient class header modified in order to manage 3D points TuioClient class modified in order to manage 3D points client class header modified in order to manage 3D points client class modified in order to manage 3D points diff -r 7372c4f249c7 -r 2bdf5d51d434 .hgignore --- a/.hgignore Fri Apr 06 11:08:26 2012 +0200 +++ b/.hgignore Fri Apr 06 11:48:00 2012 +0200 @@ -43,6 +43,9 @@ front_idill/extern/fajran-npTuioClient/npTuioClient.sln.old front_idill/extern/fajran-npTuioClient/npTuioClient.vcxproj.user front_idill/extern/fajran-npTuioClient/UpgradeLog.XML +front_idill/extern/fajran-npTuioClient/Debug/ +front_idill/extern/fajran-npTuioClient/ipch/ +front_idill/extern/fajran-npTuioClient/Release/ syntax: regexp middleware/extern/.*/(bin|obj) middleware/src/bin/Debug/* diff -r 7372c4f249c7 -r 2bdf5d51d434 front_idill/extern/fajran-npTuioClient/TuioClient/TuioClient.cpp --- a/front_idill/extern/fajran-npTuioClient/TuioClient/TuioClient.cpp Fri Apr 06 11:08:26 2012 +0200 +++ b/front_idill/extern/fajran-npTuioClient/TuioClient/TuioClient.cpp Fri Apr 06 11:48:00 2012 +0200 @@ -83,7 +83,7 @@ int32 s_id, f_id; float xpos, ypos, angle, xspeed, yspeed, rspeed, maccel, raccel; - + args >> s_id >> f_id >> xpos >> ypos >> angle >> xspeed >> yspeed >> rspeed >> maccel >> raccel >> EndMessage; std::list::iterator tobj; @@ -98,7 +98,6 @@ for (std::list::iterator listener=listenerList.begin(); listener != listenerList.end(); listener++) (*listener)->addTuioObject(addObject); - } else if ( ((*tobj)->getX()!=xpos) || ((*tobj)->getY()!=ypos) || ((*tobj)->getAngle()!=angle) || ((*tobj)->getXSpeed()!=xspeed) || ((*tobj)->getYSpeed()!=yspeed) || ((*tobj)->getRotationSpeed()!=rspeed) || ((*tobj)->getMotionAccel()!=maccel) || ((*tobj)->getRotationAccel()!=raccel) ) { (*tobj)->update(xpos,ypos,angle,xspeed,yspeed,rspeed,maccel,raccel); @@ -159,7 +158,7 @@ (*listener)->refresh(currentTime); } } - } else if( strcmp( msg.AddressPattern(), "/tuio/2Dcur" ) == 0 ) { + } else if( strcmp( msg.AddressPattern(), "/tuio/3Dcur" ) == 0 ) { const char* cmd; args >> cmd; @@ -167,9 +166,9 @@ if ((currentFrame0)) return; int32 s_id; - float xpos, ypos, xspeed, yspeed, maccel; - - args >> s_id >> xpos >> ypos >> xspeed >> yspeed >> maccel >> EndMessage; + float xpos, ypos, zpos, xspeed, yspeed, maccel; + //Modifié par alexandre.bastien@iri.centrepompidou.fr + args >> s_id >> xpos >> ypos >> zpos >> xspeed >> yspeed >> maccel >> EndMessage; std::list::iterator tcur; for (tcur=cursorList.begin(); tcur != cursorList.end(); tcur++) @@ -180,24 +179,24 @@ int f_id = (int)cursorList.size(); if ((int)(cursorList.size())<=maxFingerID) { std::list::iterator closestCursor = freeCursorList.begin(); - + //Modifié par alexandre.bastien@iri.centrepompidou.fr for(std::list::iterator testCursor = freeCursorList.begin();testCursor!= freeCursorList.end(); testCursor++) { - if((*testCursor)->getDistance(xpos,ypos)<(*closestCursor)->getDistance(xpos,ypos)) closestCursor = testCursor; + if((*testCursor)->getDistance(xpos,ypos,zpos)<(*closestCursor)->getDistance(xpos,ypos,zpos)) closestCursor = testCursor; } f_id = (*closestCursor)->getFingerID(); freeCursorList.erase(closestCursor); delete *closestCursor; } else maxFingerID = f_id; - + //Modifié par alexandre.bastien@iri.centrepompidou.fr TuioCursor *addCursor = new TuioCursor((long)s_id,f_id,xpos,ypos); cursorList.push_back(addCursor); for (std::list::iterator listener=listenerList.begin(); listener != listenerList.end(); listener++) (*listener)->addTuioCursor(addCursor); - - } else if ( ((*tcur)->getX()!=xpos) || ((*tcur)->getY()!=ypos) || ((*tcur)->getXSpeed()!=xspeed) || ((*tcur)->getYSpeed()!=yspeed) || ((*tcur)->getMotionAccel()!=maccel) ) { + //Modifié par alexandre.bastien@iri.centrepompidou.fr + } else if ( ((*tcur)->getX()!=xpos) || ((*tcur)->getY()!=ypos) || ((*tcur)->getZ()!=zpos) || ((*tcur)->getXSpeed()!=xspeed) || ((*tcur)->getYSpeed()!=yspeed) || ((*tcur)->getMotionAccel()!=maccel) ) { (*tcur)->update(xpos,ypos,xspeed,yspeed,maccel); for (std::list::iterator listener=listenerList.begin(); listener != listenerList.end(); listener++) (*listener)->updateTuioCursor((*tcur)); diff -r 7372c4f249c7 -r 2bdf5d51d434 front_idill/extern/fajran-npTuioClient/TuioClient/TuioContainer.h --- a/front_idill/extern/fajran-npTuioClient/TuioClient/TuioContainer.h Fri Apr 06 11:08:26 2012 +0200 +++ b/front_idill/extern/fajran-npTuioClient/TuioClient/TuioContainer.h Fri Apr 06 11:48:00 2012 +0200 @@ -35,7 +35,7 @@ protected: long session_id; - float xpos, ypos; + float xpos, ypos, zpos; float x_speed, y_speed; float motion_speed, motion_accel; std::list path; @@ -55,13 +55,31 @@ state = TUIO_ADDED; }; + /* + * Surchargé par alexandre.bastien@iri.centrepompidou.fr + */ + TuioContainer (long s_id, float xpos, float ypos, float zpos):TuioPoint(xpos,ypos,zpos) { + this->session_id = s_id; + this->x_speed = 0.0f; + this->y_speed = 0.0f; + this->motion_speed = 0.0f; + this->motion_accel = 0.0f; + TuioPoint p(xpos,ypos,zpos); + path.push_back(p); + + state = TUIO_ADDED; + }; + + /* + * Modifié par alexandre.bastien@iri.centrepompidou.fr + */ TuioContainer (TuioContainer *tuioContainer):TuioPoint(tuioContainer) { this->session_id = tuioContainer->getSessionID(); this->x_speed = 0.0f; this->y_speed = 0.0f; this->motion_speed = 0.0f; this->motion_accel = 0.0f; - TuioPoint p(xpos,ypos); + TuioPoint p(xpos,ypos,zpos); path.push_back(p); state = TUIO_ADDED; @@ -81,22 +99,43 @@ state = TUIO_UPDATED; }; + /* + * Surchargé par alexandre.bastien@iri.centrepompidou.fr + */ + virtual void update (float xpos, float ypos, float zpos, float xspeed, float yspeed,float maccel) { + TuioPoint::update(xpos, ypos, zpos); + this->x_speed = xspeed; + this->y_speed = yspeed; + this->motion_speed = (float)sqrt(xspeed*xspeed+yspeed*yspeed); + this->motion_accel = maccel; + TuioPoint p(xpos,ypos,zpos); + path.push_back(p); + + state = TUIO_UPDATED; + }; + + /* + * Modifié par alexandre.bastien@iri.centrepompidou.fr + */ virtual void update (TuioContainer *tuioContainer) { TuioPoint::update(tuioContainer); this->x_speed = tuioContainer->getXSpeed(); this->y_speed = tuioContainer->getYSpeed(); this->motion_speed = tuioContainer->getMotionSpeed(); this->motion_accel = tuioContainer->getMotionAccel(); - TuioPoint p(xpos,ypos); + TuioPoint p(xpos,ypos,zpos); path.push_back(p); state = TUIO_UPDATED; }; virtual long getSessionID() { return session_id; }; - + + /* + * Modifié par alexandre.bastien@iri.centrepompidou.fr + */ virtual TuioPoint getPosition() { - TuioPoint p(xpos,ypos); + TuioPoint p(xpos,ypos,zpos); return p; }; diff -r 7372c4f249c7 -r 2bdf5d51d434 front_idill/extern/fajran-npTuioClient/TuioClient/TuioCursor.h --- a/front_idill/extern/fajran-npTuioClient/TuioClient/TuioCursor.h Fri Apr 06 11:08:26 2012 +0200 +++ b/front_idill/extern/fajran-npTuioClient/TuioClient/TuioCursor.h Fri Apr 06 11:48:00 2012 +0200 @@ -37,6 +37,13 @@ this->finger_id = f_id; }; + /* + * Surchargé par alexandre.bastien@iri.centrepompidou.fr + */ + TuioCursor (long s_id, int f_id, float xpos, float ypos, float zpos):TuioContainer(s_id,xpos,ypos,zpos) { + this->finger_id = f_id; + }; + TuioCursor (TuioCursor *tuioCursor):TuioContainer(tuioCursor) { this->finger_id = tuioCursor->getFingerID(); }; diff -r 7372c4f249c7 -r 2bdf5d51d434 front_idill/extern/fajran-npTuioClient/TuioClient/TuioPoint.h --- a/front_idill/extern/fajran-npTuioClient/TuioClient/TuioPoint.h Fri Apr 06 11:08:26 2012 +0200 +++ b/front_idill/extern/fajran-npTuioClient/TuioClient/TuioPoint.h Fri Apr 06 11:48:00 2012 +0200 @@ -27,7 +27,7 @@ class TuioPoint { protected: - float xpos, ypos; + float xpos, ypos, zpos; long timestamp; public: @@ -37,17 +37,35 @@ timestamp = TUIO_UNDEFINED; }; + /* + * Surchargé par alexandre.bastien@iri.centrepompidou.fr + */ + TuioPoint (float xpos, float ypos, float zpos) { + this->xpos = xpos; + this->ypos = ypos; + this->zpos = zpos; + timestamp = TUIO_UNDEFINED; + }; + + /* + * Modifié par alexandre.bastien@iri.centrepompidou.fr + */ TuioPoint (TuioPoint *tuioPoint) { this->xpos = tuioPoint->getX(); this->ypos = tuioPoint->getY(); + this->zpos = tuioPoint->getZ(); timestamp = TUIO_UNDEFINED; }; ~TuioPoint(){}; + /* + * Modifié par alexandre.bastien@iri.centrepompidou.fr + */ void update (TuioPoint *tuioPoint) { this->xpos = tuioPoint->getX(); this->ypos = tuioPoint->getY(); + this->zpos = tuioPoint->getZ(); timestamp = TUIO_UNDEFINED; }; @@ -56,9 +74,23 @@ this->ypos = ypos; timestamp = TUIO_UNDEFINED; }; + + /* + * Surchargé par alexandre.bastien@iri.centrepompidou.fr + */ + void update (float xpos, float ypos, float zpos) { + this->xpos = xpos; + this->ypos = ypos; + this->zpos = zpos; + timestamp = TUIO_UNDEFINED; + }; float getX() { return xpos; }; float getY() { return ypos; }; + /* + * Ajouté par alexandre.bastien@iri.centrepompidou.fr + */ + float getZ() { return zpos; }; float getDistance(float x, float y) { float dx = xpos-x; @@ -66,12 +98,32 @@ return sqrtf(dx*dx+dy*dy); } + /* + * Surchargé par alexandre.bastien@iri.centrepompidou.fr + */ + float getDistance(float x, float y, float z) { + float dx = xpos-x; + float dy = ypos-y; + float dz = zpos-z; + return sqrtf(dx*dx+dy*dy+dz*dz); + } + float getDistance(TuioPoint *tuioPoint) { float dx = xpos-tuioPoint->getX(); float dy = ypos-tuioPoint->getY(); return sqrtf(dx*dx+dy*dy); } + /* + * Ajouté par alexandre.bastien@iri.centrepompidou.fr + */ + float getDistance3D(TuioPoint *tuioPoint) { + float dx = xpos-tuioPoint->getX(); + float dy = ypos-tuioPoint->getY(); + float dz = zpos-tuioPoint->getZ(); + return sqrtf(dx*dx+dy*dy+dz*dz); + } + float getAngle(TuioPoint *tuioPoint) { float side = tuioPoint->getX()-xpos; diff -r 7372c4f249c7 -r 2bdf5d51d434 front_idill/extern/fajran-npTuioClient/npTuioClient.sdf Binary file front_idill/extern/fajran-npTuioClient/npTuioClient.sdf has changed diff -r 7372c4f249c7 -r 2bdf5d51d434 front_idill/extern/fajran-npTuioClient/src/client.cpp --- a/front_idill/extern/fajran-npTuioClient/src/client.cpp Fri Apr 06 11:08:26 2012 +0200 +++ b/front_idill/extern/fajran-npTuioClient/src/client.cpp Fri Apr 06 11:48:00 2012 +0200 @@ -34,6 +34,22 @@ tuio_callback(data); } +/* +* Surchargé par alexandre.bastien@iri.centrepompidou.fr +*/ +static inline void call(TuioEvent type, long sid, int fid, float x, float y, float z, float a) +{ + TuioEventData data; + data.type = type; + data.sid = sid; + data.fid = fid; + data.x = x; + data.y = y; + data.z = z; + data.a = a; + tuio_callback(data); +} + class Listener : public TuioListener { public: @@ -61,25 +77,34 @@ object->getX(), object->getY(), object->getAngle()); } + /* + * Modifié par alexandre.bastien@iri.centrepompidou.fr + */ void addTuioCursor(TuioCursor *cursor) { call(TE_CURSOR_ADD, cursor->getSessionID(), cursor->getFingerID(), - cursor->getX(), cursor->getY(), 0); + cursor->getX(), cursor->getY(), cursor->getZ(), 0); } + /* + * Modifié par alexandre.bastien@iri.centrepompidou.fr + */ void updateTuioCursor(TuioCursor *cursor) { call(TE_CURSOR_UPDATE, cursor->getSessionID(), cursor->getFingerID(), - cursor->getX(), cursor->getY(), 0); + cursor->getX(), cursor->getY(), cursor->getZ(), 0); } + /* + * Modifié par alexandre.bastien@iri.centrepompidou.fr + */ void removeTuioCursor(TuioCursor *cursor) { call(TE_CURSOR_REMOVE, cursor->getSessionID(), cursor->getFingerID(), - cursor->getX(), cursor->getY(), 0); + cursor->getX(), cursor->getY(), cursor->getZ(), 0); } void refresh(long timestamp) diff -r 7372c4f249c7 -r 2bdf5d51d434 front_idill/extern/fajran-npTuioClient/src/client.h --- a/front_idill/extern/fajran-npTuioClient/src/client.h Fri Apr 06 11:08:26 2012 +0200 +++ b/front_idill/extern/fajran-npTuioClient/src/client.h Fri Apr 06 11:48:00 2012 +0200 @@ -33,6 +33,7 @@ int sid; float x; float y; + float z; float a; } TuioEventData;