Tracing Squares to Detect
Hand Stability

Shreyas Rana
3 min readNov 26, 2021

15th August, 2021

Abstract
The goal of this study is to quantitatively determine the magnitude of uncontrollable hand vibrations or shake. Cases like these are usually very prominent in those with neurological disorders, as they are less able to draw straight lines and trace different figures. The problem I am trying to solve is that those with motor control issues must visit a physician in-person so the physician can make qualitative assessments, such as waking, reflexes, and similarly, drawing. Using a mobile phone, these kinds of tests become extremely accessible, so the bar to monitor such symptoms becomes very low and cost-effective. In this paper, I am discussing 2 different ways to detect motor stability — root-mean-square distance, and deviations in angle. This research is being done in joint with researchers in Malmö University, and the app is created in VueJs.

Techniques
Finding the average deviation from a square is the generally easier approach in implementing a method to detect deviation.

Fig1. Typical user trace of a square*

The approach I took was to consider the drawing canvas as a cartesian plane, and use vector mathematics to find the distance of every point panned on the screen to the closest line of the square. There are 4 linear equations that make up the square:

Fig2. 4 equations for each square side
Fig3. Over 700 points of data to construct a trace

Where the constants in Fig2 are the pixel values I have chosen as vertices. For each point calculate the distance to each of the 4 lines, and find the minimum of the 4 distances.

Fig4. Distance Equation

Results
After finding the RMS of the values, we end up with a final vale that correlates directly with the deviation from the square on all sides.

Drawing with an RMS of 11.247131550400754
Drawing with an RMS of 32.47487475604888

Thus, we can now quantify hand stability without qualitative tests. One drawback to this method is it becomes exceedingly difficult to calculate RMS distance for more complicated shapes such as circles. Similarly, if the user is actually very stable, but constantly draws a small offset from the drawing, the algorithm would consider the user as unstable.

*Disclaimer: While screen-recording, the input refresh rate significantly decreases. In normal situations without screen recording, there are no breaks in the line when tracing.

--

--

Shreyas Rana

High school junior in California who loves building intelligent mobile apps, doing robotics, drawing and playing tennis!