This is the third posting on the subject of Touch Screens. When we last looked at Touch Screen Calibration, a workable approach had been found. However there was a serious problem; the approach was iterative in nature. The user had to repeat that calibration steps until the data was accurate enough and it was difficult to know when enough was enough. The reason was that Plan B processed an inset touch point and the current guess at the opposite limit. Since each calculation used approximate data, there was always an error. Over several iterations, the error can be reduced, but never truly eliminated. To resolve this issue, a new plan was needed. A plan called Plan C!

# Plan C

The new approach is based on the idea of processing input, two points at a time with no recursion! Lets take a fresh look at the data:

Unlike previous charts, we now see two inset points. One is set 15 pixels from the left and the other 15 pixels from the right.

OK, time to bust out the algebra again. As before we know that the slopes of lines (0,) to (319,) and (15,) to (304,) are the same. The slope is the rise over the run and can be expressed as:

At this point we must pause. Both and are unknowns. We need a way to express things in terms that lets us reduce the number of unknowns to one per equation. To do this we need more information about our system. Consider for a moment, the center point of the two lines. It’s added to the illustration below:

Now the point (160, ) is the center point for both the shorter line from 15 to 304 and the longer one from 0 to 319. This means that the value is midway between … and also … Since these midpoints are equal, we are able to state:

Now itself is of no interest, it’s the other parts of the equality that are useful.

Multiply both sides by 2:

Now let’s isolate in the above:

We now have in terms of ,, and . We can now return to our earlier equation:

Finally substitute for and solve for :

By the same token, the solution for is shown below. I shall leave the derivation of this as an exercise for the reader 😉 .

So what are the results of all this math? Plan C produces accurate, reliable calibration data without having to iterate through a refining process. The math, while a little more complex, is still quite manageable. And with that, I think we can call this one closed for now. As always, your thoughts, comments and suggestions are invited.

Peter Camilleri (aka Squidly Jones)