# HG changeset patch # User Jim Grandpre # Date 1281195131 14400 # Node ID e0c3b09368a6425ddd653b4f01a51793010587b3 # Parent f47c2640c66713f1a8ac356ff046fe9b176eba89 Fixed Dollar Recognition. diff -r f47c2640c667 -r e0c3b09368a6 src/events/SDL_gesture.c --- a/src/events/SDL_gesture.c Fri Aug 06 01:55:38 2010 -0400 +++ b/src/events/SDL_gesture.c Sat Aug 07 11:32:11 2010 -0400 @@ -90,6 +90,15 @@ int numGestureTouches = 0; SDL_bool recordAll; +void SDL_PrintPath(Point *path) { + int i; + printf("Path:"); + for(i=0;irecording = SDL_FALSE; Point path[DOLLARNPOINTS]; dollarNormalize(inTouch->dollarPath,path); + SDL_PrintPath(path); int index; if(recordAll) { index = SDL_AddDollarGesture(NULL,path); @@ -515,7 +536,11 @@ if(path->numPoints < MAXPATHSIZE) { path->p[path->numPoints].x = inTouch->centroid.x; path->p[path->numPoints].y = inTouch->centroid.y; - path->length += sqrt(dx*dx + dy*dy); + float pathDx = + (path->p[path->numPoints].x-path->p[path->numPoints-1].x); + float pathDy = + (path->p[path->numPoints].y-path->p[path->numPoints-1].y); + path->length += sqrt(pathDx*pathDx + pathDy*pathDy); path->numPoints++; } #endif @@ -526,7 +551,8 @@ lastCentroid = inTouch->centroid; inTouch->centroid.x += dx/inTouch->numDownFingers; - inTouch->centroid.y += dy/inTouch->numDownFingers; + inTouch->centroid.y += dy/inTouch->numDownFingers; + //printf("Centrid : (%f,%f)\n",inTouch->centroid.x,inTouch->centroid.y); if(inTouch->numDownFingers > 1) { Point lv; //Vector from centroid to last x,y position Point v; //Vector from centroid to current x,y position