Convex polygon fitting in robot-based neurorehabilitation