This project is read-only.

ScanPositions Method

Oct 27, 2011 at 6:02 PM

Hello, I am trying to understand how exactly you have implemented the toolbox, and how it can apply to my Kinect-based project. I am going through the code and remain stumped as to how exactly does the ScanPositions method works.

This is the method signature for ScanPositions:


bool ScanPositions(Func<Vector3, Vector3, bool> heightFunction, Func<Vector3, Vector3, bool> directionFunction, Func<Vector3, Vector3, bool> lengthFunction, int minTime, int maxTime)


From my understanding, the Func<Vector3, Vector3, bool> part says that this parameter will be a delegate function. It will be defined when there is someone calling ScanPositions. In fact, I can see that when ScanPositions is called from LookForGesture(), it is done as such:


ScanPositions((p1, p2) => Math.Abs(p2.Y - p1.Y) < SwipeMaximalHeight, (p1, p2) => p2.X - p1.X > -0.01f, (p1, p2) => Math.Abs(p2.X - p1.X) > SwipeMinimalLength, SwipeMinimalDuration, SwipeMaximalDuration)
What I don't understand is what you gain from abstracting the implementation away from the ScanPositions method, and what exactly is the logic inside of this method. Can you give me some pseudocode?


I apologize in advance if I'm not clear.