sin()/cos()/tan() for kernel code? '_ 'a

Hans Petter Selasky hselasky at c2i.net
Sun Feb 11 10:32:48 UTC 2007


On Sunday 11 February 2007 09:39, Eugene M. Kim wrote:
> Hello all,
>
> I am writing a mouse device driver for my Wacom tablet (Intuos 2 9x12).
> The tablet comes with a mouse and I managed to get valid coordinate data
> from the device.  However, unlike usual mice, the coordinate system is
> tied not to the orientation of the mouse itself, but to the tablet,
> which acts much like a "mouse pad".  So, for example, if I rotate the
> mouse 30 degrees to the left and move it left and right, the mouse
> cursor would move not horizontally, but to 2- or 8-o'clock.
>
> Fortunately the mouse also provides orientation data along with
> coordinate data, so the correct cursor movement could be calculated from
> it.  The problem: The calculation needs trigonometry, but there seems to
> be no math library support in the kernel (I ran "grep -w cos" on the
> -CURRENT source tree, which turned nothing up).
>
> Does anyone have an idea on how to do this?
>

Is it possible to use a small integer table to do the conversion ?

--HPS


More information about the freebsd-hackers mailing list