[PATCH v3 wayland-protocols] Add the tablet protocol
spitzak at gmail.com
Wed Feb 3 00:29:45 UTC 2016
On Tue, Feb 2, 2016 at 2:37 PM, Jason Gerecke <killertofu at gmail.com> wrote:
> > I think a lot of software treats the tilt information as actually the
> > position of a point some distance up the pen relative to the tip. I would
> That's certainly true for GIMP and Krita at least (see  and ).
> Its incorrect, but its "close enough" that nobody seems to complain
> (though I've been tempted to in the past ;))
> > guess the hardware produces this directly (by reusing the proximity
> > for a different point higher up in the pen). To get a projection of the
> > onto the tablet surface, these values can be fed to atan2.
> > If they were actual angles, they must be the angle of the projection of
> > pen onto the two vertical planes of the x and y axis. This is really
> > when the pen is near one of the axis, and I would think the
> > could not produce this except by calculating atan2 of a more linear
> > Therefore I would be very suspicious of any claim that the values being
> > produced are angles. The current api reporting them as normalized values
> > seems better.
> I've been down this road before a few years back. Does the hardware
> measure and report true angles or does it measure a projection? If its
> a projection, does it report them directly, or does it calculate
> sin^-1 to transform it into an angle?
> In the end, the specs from the firmware guys say to interpret the data
> as measured in degrees, so that's what we do.
Actually it certainly cannot be any angle of a plane the pen is in, as the
atan2 data would not work and get quite incorrect when the pen is tilted
close to a horizontal axis. Though if Gimp is producing very strange angles
when the pen is nearly horizontal along one axis this may indicate that it
really is an angle. For instance if tilting the pen parallel to the x axis
produces angles more like 45 degrees.
Say some point on the pen is at x,y,z relative to the tip.
Possible values for the y tilt are (in order from best to worst imho):
y/D (where D == |x,y,z|). This goes to 1.0 as the pen is tilted horizontal.
atan2(ytilt, xtilt) == atan2(y/D, x/D) == atan2(y, x) and produces the
y/z: This value goes to infinity as the pen is tilted horizontal.
atan2(ytilt, xtilt) == atan2(y/z, x/z) == atan2(y, x) and thus gets the xy
angle exactly right.
atan(y/z): This would be the actual angle of the plane containing the pen
and x axis projected onto the yz plane. The correct xy angle is then
atan2(sin(ytilt),sin(xtilt)) == atan2(y/z, x/z) == atan2(y, x).
atan2(ytilt,xtilt) would have significant errors if the magnitude of xtilt
and ytilt are different.
asin(y/D) could be produced by somebody thinking they know how to convert y
to an angle, but it does not correspond to any actual angle of the pen. The
correct xy angle is again produced by atan2(sin(ytilt),sin(xtilt)) ==
atan2(y/D, x/D) == atan2(y, x), and doing atan2(ytilt,xtilt) would have the
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the wayland-devel