PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Stylus Accuracy?

Is it my imagination, or is the stylus on Pocket PC only accurate to within 2 pixels?

That's all the resolution I seem to get. And, looking closely at the screen, I can see little dots about twice as spaced out as the pixels, I assume these are the touch screen sensors.

This lack of accuracy makes it a bit difficult to develop games that rely on the stylus. Already, the screen area is rather small, so if I am concerned about stylus movements within a small screen area of say 32x32 pixels, I really have only 16x16 resolution to work with.

And if I am tracking stylus movement between frames, where it might only move a couple of pixels between frames, its movement will be clamped to either delta-0 or delta-2. That doesn't allow for very fine-grained stylus control, not even at the pixel level.
Are you telling me the average user can pick out each of the 240 horizontal pixels and the 320 veritcal pixels? And can then apply that in a game where the screen is most likely in a state of constant change?

Not likely. If the variance is only 2 pixels, that's pretty darn good in my book.

Out of curiosity, why would you need it to be more precise (1), can you honestly pick out each of the 76,800 pixels on the screen (2) and hit the pixel you want with the stylus in a game where speed matters (3)?

I'm not trying to flame, but it seems to me like you're being outrageously critical of something that works incredibly well.

-John
mlepage · 04 Aug 2003, 03:33 UTC — Consider movement
You're right and you're wrong.

It's precise enough for picking. For example, if I tap the stylus on an object, I can easily figure out which object is intended to be picked.

But it's not very precise if you consider movement. Let me explain.

Let's say I want to move the object I picked under the stylus. As I move the stylus, each frame, I relocate the object under the stylus. Dragging. OK, so 2 pixels is precise enough.

Now let's say that I want to let go of the object, but have it KEEP MOVING in the last direction and speed I was moving it in. At this point, you see the problem. Relative to the last frame, there's only a few velocities the object could be travelling:

(0, 0) stationary
(0, 2) moving down
(-2, 0) moving left
(2, 2) moving diagonal a bit faster
(4, 0) moving right even faster
(4, 2) moving ESE even faster
(4, 4) moving SE even faster

See what I mean? In theory, the object should continue to move in the direction you were dragging it. In practice, I find it "snaps" to the horizontal/vertical or diagonal, because of this imprecision.
Guest · 04 Aug 2003, 03:35 UTC — Weighted Average
BTW, I thought of doing a weighted average of the velocity over the last single frame, the last two frames, the last three frames, etc. Maybe this would alleviate my precision problems, but I haven't tried it yet.
mlepage: You are correct - the resolution of the Pocket PC touch display is only 120x160. If you override StylusDown and then simply call SetPixel on each coordinate you will see the grid clearly.

Filtering the input based on velocity as you suggested should work for some cases.. But not all... Sorry for not being able to help out more - but the Pocket PC hardware and HAL is really outdated IMHO...
Yep, the stylus is really not good for getting a velocity. We use the stylus for stroking a cue stick (Virtual Pool) and it is rather difficult to get a good velocity from the users movements. When you couple the 120x160 active area with the fact WinCE doesn't time stamp the stylus positions (or buffer all of them all the time), it becomes difficult, at best, to get a good velocity.

Of course, it can be done, and does work rather well in the end. It also is a *great* interface for some types of games. In Virtual Pool, you grab the cue stick with the stylus, pull back and stroke through to hit the ball. It couldn't be more natural and is great fun.

So yeah, it sucks, but it beats the crap out of most interfaces.

Cheers,

rcp
mlepage · 04 Aug 2003, 14:39 UTC — Secret?
So what's the secret to getting a good velocity, then?

(Anonymous above was me, suggesting a weighted average. Is that the trick?)
uh yeah.. hehe, sorry, i didn't see your reply.

In our situation we are looking at the user dragging the cue stick back and then forward to hit the ball. In real life, only the velocity at contact matters thus you would really only wish to look at the last two frames. Thus you have two positions at two different times. The velocity is just the delta distance over the delta time. Of course, as you've found, this doesn't always work. What we found was that the position reports tend to come in spurts, thus our time-stamping was not reality. ie; P0, P1, P2... delay... P3, P4, P5. If you stamp them as you get them, it would appear that the user was more than a little shaky with the stylus. Obviously, if you pick two positions that WinCE decided to send you back to back, the delta time is going to be way too small. What seems to work better is to look at all frames from the point in which the stylus switched directions (ie; started moving forward) to the contact point. Take the start time and the end time for a delta, which you then use to restamp all of the positions. ie; you got 10 readings in .5 seconds, thus the readings get re-stamped 0, .05, .1, .15 etc. Then you can do a weighted average of the last few readings before impact. Actually, I've found that just the last two readings work fine once you "normalize" the time stampings.

So, I guess what I am saying is that the stylus *position* is not so much the problem as the lack of an accurate time-stamp.

This seems to work pretty good, however, I must warn you that I am no master in real-time data sampling and analysis. There is probably a better way of doing this.

Cheers,

rcp
mlepage · 06 Aug 2003, 03:30 UTC — Groovy
This is good info, thanks. Like I said, I was going to try something more weighted-average in the future. Right now I'm working on other aspects of my game, but I'll be coming back to stylus input later.