src/events/SDL_gesture.c
changeset 4688 494f71f57a80
parent 4686 463cd74304b9
child 4689 f9ab8df6d45a
     1.1 --- a/src/events/SDL_gesture.c	Fri Aug 13 17:05:06 2010 -0700
     1.2 +++ b/src/events/SDL_gesture.c	Fri Aug 13 23:08:32 2010 -0400
     1.3 @@ -27,11 +27,12 @@
     1.4  #include "SDL_gesture_c.h"
     1.5  
     1.6  //TODO: Replace with malloc
     1.7 -#define MAXFINGERS 5
     1.8 -#define MAXTOUCHES 2
     1.9 -#define MAXTEMPLATES 4
    1.10 +
    1.11  #define MAXPATHSIZE 1024
    1.12  
    1.13 + 
    1.14 +
    1.15 +
    1.16  #define DOLLARNPOINTS 64
    1.17  #define DOLLARSIZE 256
    1.18  
    1.19 @@ -42,55 +43,38 @@
    1.20  
    1.21  typedef struct {
    1.22    float x,y;
    1.23 -} Point;
    1.24 -
    1.25 -
    1.26 -typedef struct {
    1.27 -  Point p;
    1.28 -  float pressure;
    1.29 -  SDL_FingerID id;
    1.30 -} Finger;
    1.31 -
    1.32 +} SDL_FloatPoint;
    1.33  
    1.34  typedef struct {
    1.35    float length;
    1.36    
    1.37    int numPoints;
    1.38 -  Point p[MAXPATHSIZE];
    1.39 -} DollarPath;
    1.40 +  SDL_FloatPoint p[MAXPATHSIZE];
    1.41 +} SDL_DollarPath;
    1.42  
    1.43 -/*
    1.44  typedef struct {
    1.45 -  Finger f;
    1.46 -  Point cv;
    1.47 -  float dtheta,dDist;
    1.48 -  DollarPath dollarPath;
    1.49 -} TouchPoint;
    1.50 -*/
    1.51 -typedef struct {
    1.52 -  Point path[DOLLARNPOINTS];
    1.53 +  SDL_FloatPoint path[DOLLARNPOINTS];
    1.54    unsigned long hash;
    1.55 -} DollarTemplate;
    1.56 +} SDL_DollarTemplate;
    1.57  
    1.58  typedef struct {
    1.59    SDL_GestureID id;
    1.60 -  Point res;
    1.61 -  Point centroid;
    1.62 -  //TouchPoint gestureLast[MAXFINGERS];
    1.63 -  DollarPath dollarPath;
    1.64 +  SDL_FloatPoint res;
    1.65 +  SDL_FloatPoint centroid;
    1.66 +  SDL_DollarPath dollarPath;
    1.67    Uint16 numDownFingers;
    1.68  
    1.69    int numDollarTemplates;
    1.70 -  DollarTemplate dollarTemplate[MAXTEMPLATES];
    1.71 +  SDL_DollarTemplate *dollarTemplate;
    1.72  
    1.73    SDL_bool recording;
    1.74 -} GestureTouch;
    1.75 +} SDL_GestureTouch;
    1.76  
    1.77 -GestureTouch gestureTouch[MAXTOUCHES];
    1.78 -int numGestureTouches = 0;
    1.79 +SDL_GestureTouch *SDL_gestureTouch;
    1.80 +int SDL_numGestureTouches = 0;
    1.81  SDL_bool recordAll;
    1.82  
    1.83 -void SDL_PrintPath(Point *path) {
    1.84 +void SDL_PrintPath(SDL_FloatPoint *path) {
    1.85    int i;
    1.86    printf("Path:");
    1.87    for(i=0;i<DOLLARNPOINTS;i++) {
    1.88 @@ -102,9 +86,9 @@
    1.89  int SDL_RecordGesture(SDL_TouchID touchId) {
    1.90    int i;
    1.91    if(touchId < 0) recordAll = SDL_TRUE;
    1.92 -  for(i = 0;i < numGestureTouches; i++) {
    1.93 -    if((touchId < 0) || (gestureTouch[i].id == touchId)) {
    1.94 -      gestureTouch[i].recording = SDL_TRUE;
    1.95 +  for(i = 0;i < SDL_numGestureTouches; i++) {
    1.96 +    if((touchId < 0) || (SDL_gestureTouch[i].id == touchId)) {
    1.97 +      SDL_gestureTouch[i].recording = SDL_TRUE;
    1.98        if(touchId >= 0)
    1.99  	return 1;
   1.100      }      
   1.101 @@ -112,7 +96,7 @@
   1.102    return (touchId < 0);
   1.103  }
   1.104  
   1.105 -unsigned long SDL_HashDollar(Point* points) {
   1.106 +unsigned long SDL_HashDollar(SDL_FloatPoint* points) {
   1.107    unsigned long hash = 5381;
   1.108    int i;
   1.109    for(i = 0;i < DOLLARNPOINTS; i++) { 
   1.110 @@ -123,14 +107,14 @@
   1.111  }
   1.112  
   1.113  
   1.114 -static int SaveTemplate(DollarTemplate *templ, SDL_RWops * src) {
   1.115 +static int SaveTemplate(SDL_DollarTemplate *templ, SDL_RWops * src) {
   1.116    if(src == NULL) return 0;
   1.117  
   1.118    int i;
   1.119    
   1.120    //No Longer storing the Hash, rehash on load
   1.121    //if(SDL_RWops.write(src,&(templ->hash),sizeof(templ->hash),1) != 1) return 0;
   1.122 -
   1.123 +  
   1.124    if(SDL_RWwrite(src,templ->path,
   1.125  		 sizeof(templ->path[0]),DOLLARNPOINTS) != DOLLARNPOINTS) 
   1.126      return 0;
   1.127 @@ -141,8 +125,8 @@
   1.128  
   1.129  int SDL_SaveAllDollarTemplates(SDL_RWops *src) {  
   1.130    int i,j,rtrn = 0;
   1.131 -  for(i = 0; i < numGestureTouches; i++) {
   1.132 -    GestureTouch* touch = &gestureTouch[i];
   1.133 +  for(i = 0; i < SDL_numGestureTouches; i++) {
   1.134 +    SDL_GestureTouch* touch = &SDL_gestureTouch[i];
   1.135      for(j = 0;j < touch->numDollarTemplates; j++) {
   1.136  	rtrn += SaveTemplate(&touch->dollarTemplate[i],src);
   1.137      }
   1.138 @@ -152,8 +136,8 @@
   1.139  
   1.140  int SDL_SaveDollarTemplate(SDL_GestureID gestureId, SDL_RWops *src) {
   1.141    int i,j;
   1.142 -  for(i = 0; i < numGestureTouches; i++) {
   1.143 -    GestureTouch* touch = &gestureTouch[i];
   1.144 +  for(i = 0; i < SDL_numGestureTouches; i++) {
   1.145 +    SDL_GestureTouch* touch = &SDL_gestureTouch[i];
   1.146      for(j = 0;j < touch->numDollarTemplates; j++) {
   1.147        if(touch->dollarTemplate[i].hash == gestureId) {
   1.148  	return SaveTemplate(&touch->dollarTemplate[i],src);
   1.149 @@ -166,25 +150,46 @@
   1.150  
   1.151  //path is an already sampled set of points
   1.152  //Returns the index of the gesture on success, or -1
   1.153 -static int SDL_AddDollarGesture(GestureTouch* inTouch,Point* path) {
   1.154 +static int SDL_AddDollarGesture(SDL_GestureTouch* inTouch,SDL_FloatPoint* path) {
   1.155    if(inTouch == NULL) {
   1.156 -    if(numGestureTouches == 0) return -1;
   1.157 +    if(SDL_numGestureTouches == 0) return -1;
   1.158      int i = 0;
   1.159 -    for(i = 0;i < numGestureTouches; i++) {
   1.160 -      inTouch = &gestureTouch[i];
   1.161 -      if(inTouch->numDollarTemplates < MAXTEMPLATES) {
   1.162 -	DollarTemplate *templ = 
   1.163 -	  &inTouch->dollarTemplate[inTouch->numDollarTemplates];
   1.164 -	memcpy(templ->path,path,DOLLARNPOINTS*sizeof(Point));
   1.165 -	templ->hash = SDL_HashDollar(templ->path);
   1.166 -	inTouch->numDollarTemplates++;
   1.167 +    for(i = 0;i < SDL_numGestureTouches; i++) {
   1.168 +      inTouch = &SDL_gestureTouch[i];
   1.169 +
   1.170 +      SDL_DollarTemplate* dollarTemplate = 
   1.171 +	SDL_realloc(inTouch->dollarTemplate,
   1.172 +		    (inTouch->numDollarTemplates + 1) * 
   1.173 +		    sizeof(SDL_DollarTemplate));
   1.174 +      if(!dollarTemplate) {
   1.175 +	SDL_OutOfMemory();
   1.176 +	return -1;
   1.177        }
   1.178 +	
   1.179 +      inTouch->dollarTemplate = dollarTemplate;
   1.180 +
   1.181 +      SDL_DollarTemplate *templ = 
   1.182 +	&inTouch->dollarTemplate[inTouch->numDollarTemplates];
   1.183 +      memcpy(templ->path,path,DOLLARNPOINTS*sizeof(SDL_FloatPoint));
   1.184 +      templ->hash = SDL_HashDollar(templ->path);
   1.185 +      inTouch->numDollarTemplates++;    
   1.186      }
   1.187      return inTouch->numDollarTemplates - 1;
   1.188 -  }else if(inTouch->numDollarTemplates < MAXTEMPLATES) {
   1.189 -    DollarTemplate *templ = 
   1.190 +  } else {
   1.191 +    SDL_DollarTemplate* dollarTemplate = 
   1.192 +      SDL_realloc(inTouch->dollarTemplate,
   1.193 +		  (inTouch->numDollarTemplates + 1) * 
   1.194 +		  sizeof(SDL_DollarTemplate));
   1.195 +    if(!dollarTemplate) {
   1.196 +      SDL_OutOfMemory();
   1.197 +      return -1;
   1.198 +    }
   1.199 +    
   1.200 +    inTouch->dollarTemplate = dollarTemplate;
   1.201 +
   1.202 +    SDL_DollarTemplate *templ = 
   1.203        &inTouch->dollarTemplate[inTouch->numDollarTemplates];
   1.204 -    memcpy(templ->path,path,DOLLARNPOINTS*sizeof(Point));
   1.205 +    memcpy(templ->path,path,DOLLARNPOINTS*sizeof(SDL_FloatPoint));
   1.206      templ->hash = SDL_HashDollar(templ->path);
   1.207      inTouch->numDollarTemplates++;
   1.208      return inTouch->numDollarTemplates - 1;
   1.209 @@ -195,36 +200,28 @@
   1.210  int SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src) {
   1.211    if(src == NULL) return 0;
   1.212    int i,loaded = 0;
   1.213 -  GestureTouch *touch = NULL;
   1.214 +  SDL_GestureTouch *touch = NULL;
   1.215    if(touchId >= 0) {
   1.216 -    for(i = 0;i < numGestureTouches; i++)
   1.217 -      if(gestureTouch[i].id == touchId)
   1.218 -	touch = &gestureTouch[i];
   1.219 +    for(i = 0;i < SDL_numGestureTouches; i++)
   1.220 +      if(SDL_gestureTouch[i].id == touchId)
   1.221 +	touch = &SDL_gestureTouch[i];
   1.222      if(touch == NULL) return -1;
   1.223    }
   1.224  
   1.225    while(1) {
   1.226 -    DollarTemplate templ;
   1.227 -    //fscanf(fp,"%lu ",&templ.hash);
   1.228 -    /*
   1.229 -    for(i = 0;i < DOLLARNPOINTS; i++) {		
   1.230 -      int x,y;
   1.231 -      if(fscanf(fp,"%i %i ",&x,&y) != 2) break;
   1.232 -      templ.path[i].x = x;
   1.233 -      templ.path[i].y = y;
   1.234 -    }
   1.235 -    fscanf(fp,"\n");
   1.236 -    */
   1.237 -    if(SDL_RWread(src,templ.path,sizeof(templ.path[0]),DOLLARNPOINTS) < DOLLARNPOINTS) break;
   1.238 +    SDL_DollarTemplate templ;
   1.239 +
   1.240 +    if(SDL_RWread(src,templ.path,sizeof(templ.path[0]),DOLLARNPOINTS) < 
   1.241 +       DOLLARNPOINTS) break;
   1.242  
   1.243      if(touchId >= 0) {
   1.244        printf("Adding loaded gesture to 1 touch\n");
   1.245        if(SDL_AddDollarGesture(touch,templ.path)) loaded++;
   1.246      }
   1.247      else {
   1.248 -      printf("Adding to: %i touches\n",numGestureTouches);
   1.249 -      for(i = 0;i < numGestureTouches; i++) {
   1.250 -	touch = &gestureTouch[i];
   1.251 +      printf("Adding to: %i touches\n",SDL_numGestureTouches);
   1.252 +      for(i = 0;i < SDL_numGestureTouches; i++) {
   1.253 +	touch = &SDL_gestureTouch[i];
   1.254  	printf("Adding loaded gesture to + touches\n");
   1.255  	//TODO: What if this fails?
   1.256  	SDL_AddDollarGesture(touch,templ.path);	
   1.257 @@ -237,10 +234,10 @@
   1.258  }
   1.259  
   1.260  
   1.261 -float dollarDifference(Point* points,Point* templ,float ang) {
   1.262 -  //  Point p[DOLLARNPOINTS];
   1.263 +float dollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ,float ang) {
   1.264 +  //  SDL_FloatPoint p[DOLLARNPOINTS];
   1.265    float dist = 0;
   1.266 -  Point p;
   1.267 +  SDL_FloatPoint p;
   1.268    int i;
   1.269    for(i = 0; i < DOLLARNPOINTS; i++) {
   1.270      p.x = points[i].x * cos(ang) - points[i].y * sin(ang);
   1.271 @@ -252,7 +249,7 @@
   1.272    
   1.273  }
   1.274  
   1.275 -float bestDollarDifference(Point* points,Point* templ) {
   1.276 +float bestDollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ) {
   1.277    //------------BEGIN DOLLAR BLACKBOX----------------//
   1.278    //-TRANSLATED DIRECTLY FROM PSUDEO-CODE AVAILABLE AT-//
   1.279    //-"http://depts.washington.edu/aimgroup/proj/dollar/"-//
   1.280 @@ -289,10 +286,9 @@
   1.281  }
   1.282  
   1.283  //DollarPath contains raw points, plus (possibly) the calculated length
   1.284 -int dollarNormalize(DollarPath path,Point *points) {
   1.285 +int dollarNormalize(SDL_DollarPath path,SDL_FloatPoint *points) {
   1.286    int i;
   1.287    //Calculate length if it hasn't already been done
   1.288 -  printf("length: %f\n",path.length);
   1.289    if(path.length <= 0) {
   1.290      for(i=1;i<path.numPoints;i++) {
   1.291        float dx = path.p[i  ].x - 
   1.292 @@ -302,14 +298,13 @@
   1.293        path.length += sqrt(dx*dx+dy*dy);
   1.294      }
   1.295    }
   1.296 -  printf("New length: %f\n",path.length);
   1.297  
   1.298    //Resample
   1.299    float interval = path.length/(DOLLARNPOINTS - 1);
   1.300    float dist = interval;
   1.301  
   1.302    int numPoints = 0;
   1.303 -  Point centroid; 
   1.304 +  SDL_FloatPoint centroid; 
   1.305    centroid.x = 0;centroid.y = 0;
   1.306    
   1.307    //printf("(%f,%f)\n",path.p[path.numPoints-1].x,path.p[path.numPoints-1].y);
   1.308 @@ -378,9 +373,9 @@
   1.309    return numPoints;
   1.310  }
   1.311  
   1.312 -float dollarRecognize(DollarPath path,int *bestTempl,GestureTouch* touch) {
   1.313 +float dollarRecognize(SDL_DollarPath path,int *bestTempl,SDL_GestureTouch* touch) {
   1.314  	
   1.315 -	Point points[DOLLARNPOINTS];
   1.316 +	SDL_FloatPoint points[DOLLARNPOINTS];
   1.317  	int numPoints = dollarNormalize(path,points);
   1.318  	//SDL_PrintPath(points);
   1.319  	int i;
   1.320 @@ -394,34 +389,56 @@
   1.321  	return bestDiff;
   1.322  }
   1.323  
   1.324 -int SDL_GestureAddTouch(SDL_Touch* touch) { 
   1.325 -  if(numGestureTouches >= MAXTOUCHES) return -1;
   1.326 -  
   1.327 -  gestureTouch[numGestureTouches].res.x = touch->xres;
   1.328 -  gestureTouch[numGestureTouches].res.y = touch->yres;
   1.329 -  gestureTouch[numGestureTouches].numDownFingers = 0;
   1.330 +int SDL_GestureAddTouch(SDL_Touch* touch) {  
   1.331 +  SDL_GestureTouch *gestureTouch = SDL_realloc(SDL_gestureTouch,
   1.332 +					       (SDL_numGestureTouches + 1) *
   1.333 +					       sizeof(SDL_GestureTouch));
   1.334  
   1.335 -  gestureTouch[numGestureTouches].res.x = touch->xres;
   1.336 -  gestureTouch[numGestureTouches].id = touch->id;
   1.337 +  if(!gestureTouch) {
   1.338 +    SDL_OutOfMemory();
   1.339 +    return -1;
   1.340 +  }
   1.341  
   1.342 -  gestureTouch[numGestureTouches].numDollarTemplates = 0;
   1.343 +  SDL_gestureTouch = gestureTouch;
   1.344  
   1.345 -  gestureTouch[numGestureTouches].recording = SDL_FALSE;
   1.346 +  SDL_gestureTouch[SDL_numGestureTouches].res.x = touch->xres;
   1.347 +  SDL_gestureTouch[SDL_numGestureTouches].res.y = touch->yres;
   1.348 +  SDL_gestureTouch[SDL_numGestureTouches].numDownFingers = 0;
   1.349  
   1.350 -  numGestureTouches++;
   1.351 +  SDL_gestureTouch[SDL_numGestureTouches].res.x = touch->xres;
   1.352 +  SDL_gestureTouch[SDL_numGestureTouches].id = touch->id;
   1.353 +
   1.354 +  SDL_gestureTouch[SDL_numGestureTouches].numDollarTemplates = 0;
   1.355 +
   1.356 +  SDL_gestureTouch[SDL_numGestureTouches].recording = SDL_FALSE;
   1.357 +
   1.358 +  SDL_numGestureTouches++;
   1.359    return 0;
   1.360  }
   1.361  
   1.362 -GestureTouch * SDL_GetGestureTouch(SDL_TouchID id) {
   1.363 +int SDL_GestureRemoveTouch(SDL_TouchID id) {
   1.364    int i;
   1.365 -  for(i = 0;i < numGestureTouches; i++) {
   1.366 -    //printf("%i ?= %i\n",gestureTouch[i].id,id);
   1.367 -    if(gestureTouch[i].id == id) return &gestureTouch[i];
   1.368 +  for(i = 0;i < SDL_numGestureTouches; i++) {
   1.369 +    if(SDL_gestureTouch[i].id == id) {
   1.370 +      SDL_numGestureTouches--;
   1.371 +      SDL_gestureTouch[i] = SDL_gestureTouch[SDL_numGestureTouches];
   1.372 +      return 1;
   1.373 +    }
   1.374 +  }
   1.375 +  return -1;
   1.376 +}
   1.377 +
   1.378 +
   1.379 +SDL_GestureTouch * SDL_GetGestureTouch(SDL_TouchID id) {
   1.380 +  int i;
   1.381 +  for(i = 0;i < SDL_numGestureTouches; i++) {
   1.382 +    //printf("%i ?= %i\n",SDL_gestureTouch[i].id,id);
   1.383 +    if(SDL_gestureTouch[i].id == id) return &SDL_gestureTouch[i];
   1.384    }
   1.385    return NULL;
   1.386  }
   1.387  
   1.388 -int SDL_SendGestureMulti(GestureTouch* touch,float dTheta,float dDist) {
   1.389 +int SDL_SendGestureMulti(SDL_GestureTouch* touch,float dTheta,float dDist) {
   1.390    SDL_Event event;
   1.391    event.mgesture.type = SDL_MULTIGESTURE;
   1.392    event.mgesture.touchId = touch->id;
   1.393 @@ -433,7 +450,7 @@
   1.394    return SDL_PushEvent(&event) > 0;
   1.395  }
   1.396  
   1.397 -int SDL_SendGestureDollar(GestureTouch* touch,
   1.398 +int SDL_SendGestureDollar(SDL_GestureTouch* touch,
   1.399  			  SDL_GestureID gestureId,float error) {
   1.400    SDL_Event event;
   1.401    event.dgesture.type = SDL_DOLLARGESTURE;
   1.402 @@ -449,7 +466,7 @@
   1.403  }
   1.404  
   1.405  
   1.406 -int SDL_SendDollarRecord(GestureTouch* touch,SDL_GestureID gestureId) {
   1.407 +int SDL_SendDollarRecord(SDL_GestureTouch* touch,SDL_GestureID gestureId) {
   1.408    SDL_Event event;
   1.409    event.dgesture.type = SDL_DOLLARRECORD;
   1.410    event.dgesture.touchId = touch->id;
   1.411 @@ -464,7 +481,7 @@
   1.412    if(event->type == SDL_FINGERMOTION || 
   1.413       event->type == SDL_FINGERDOWN ||
   1.414       event->type == SDL_FINGERUP) {
   1.415 -    GestureTouch* inTouch = SDL_GetGestureTouch(event->tfinger.touchId);
   1.416 +    SDL_GestureTouch* inTouch = SDL_GetGestureTouch(event->tfinger.touchId);
   1.417      
   1.418      //Shouldn't be possible
   1.419      if(inTouch == NULL) return;
   1.420 @@ -485,15 +502,15 @@
   1.421  #ifdef ENABLE_DOLLAR
   1.422        if(inTouch->recording) {
   1.423  	inTouch->recording = SDL_FALSE;
   1.424 -	Point path[DOLLARNPOINTS];
   1.425 +	SDL_FloatPoint path[DOLLARNPOINTS];
   1.426  	dollarNormalize(inTouch->dollarPath,path);
   1.427  	//SDL_PrintPath(path);
   1.428  	int index;
   1.429  	if(recordAll) {
   1.430  	  index = SDL_AddDollarGesture(NULL,path);
   1.431  	  int i;
   1.432 -	  for(i = 0;i < numGestureTouches; i++)
   1.433 -	    gestureTouch[i].recording = SDL_FALSE;
   1.434 +	  for(i = 0;i < SDL_numGestureTouches; i++)
   1.435 +	    SDL_gestureTouch[i].recording = SDL_FALSE;
   1.436  	}
   1.437  	else {
   1.438  	  index = SDL_AddDollarGesture(inTouch,path);
   1.439 @@ -532,7 +549,7 @@
   1.440        float dy = ((float)event->tfinger.dy)/(float)inTouch->res.y;
   1.441        //printf("dx,dy: (%f,%f)\n",dx,dy); 
   1.442  #ifdef ENABLE_DOLLAR
   1.443 -      DollarPath* path = &inTouch->dollarPath;
   1.444 +      SDL_DollarPath* path = &inTouch->dollarPath;
   1.445        if(path->numPoints < MAXPATHSIZE) {
   1.446  	path->p[path->numPoints].x = inTouch->centroid.x;
   1.447  	path->p[path->numPoints].y = inTouch->centroid.y;
   1.448 @@ -544,18 +561,18 @@
   1.449  	path->numPoints++;
   1.450        }
   1.451  #endif
   1.452 -      Point lastP;
   1.453 +      SDL_FloatPoint lastP;
   1.454        lastP.x = x - dx;
   1.455        lastP.y = y - dy;
   1.456 -      Point lastCentroid;
   1.457 +      SDL_FloatPoint lastCentroid;
   1.458        lastCentroid = inTouch->centroid;
   1.459        
   1.460        inTouch->centroid.x += dx/inTouch->numDownFingers;
   1.461        inTouch->centroid.y += dy/inTouch->numDownFingers;
   1.462        //printf("Centrid : (%f,%f)\n",inTouch->centroid.x,inTouch->centroid.y);
   1.463        if(inTouch->numDownFingers > 1) {
   1.464 -	Point lv; //Vector from centroid to last x,y position
   1.465 -	Point v; //Vector from centroid to current x,y position
   1.466 +	SDL_FloatPoint lv; //Vector from centroid to last x,y position
   1.467 +	SDL_FloatPoint v; //Vector from centroid to current x,y position
   1.468  	//lv = inTouch->gestureLast[j].cv;
   1.469  	lv.x = lastP.x - lastCentroid.x;
   1.470  	lv.y = lastP.y - lastCentroid.y;
   1.471 @@ -608,15 +625,9 @@
   1.472  			     x)/inTouch->numDownFingers;
   1.473        inTouch->centroid.y = (inTouch->centroid.y*(inTouch->numDownFingers - 1)+
   1.474  			     y)/inTouch->numDownFingers;
   1.475 -      printf("Finger Down: (%f,%f). Centroid: (%f,%f\n",x,y,
   1.476 -	     inTouch->centroid.x,inTouch->centroid.y);
   1.477 -      /*
   1.478 -	inTouch->gestureLast[j].f.id = event->tfinger.fingerId;
   1.479 -	inTouch->gestureLast[j].f.p.x  = x;
   1.480 -	inTouch->gestureLast[j].f.p.y  = y;	
   1.481 -	inTouch->gestureLast[j].cv.x = 0;
   1.482 -	inTouch->gestureLast[j].cv.y = 0;
   1.483 -      */
   1.484 +      //printf("Finger Down: (%f,%f). Centroid: (%f,%f\n",x,y,
   1.485 +      //     inTouch->centroid.x,inTouch->centroid.y);
   1.486 +
   1.487  #ifdef ENABLE_DOLLAR
   1.488        inTouch->dollarPath.length = 0;
   1.489        inTouch->dollarPath.p[0].x = x;