Date: Sun, 11 Feb 2007 01:09:30 -0800 From: "Kip Macy" <kip.macy@gmail.com> To: "Eugene M. Kim" <freebsd.org@ab.ote.we.lv>, hackers@freebsd.org Subject: Re: sin()/cos()/tan() for kernel code? '_ 'a Message-ID: <b1fa29170702110109o2d1b165aj1896c0c2574950b8@mail.gmail.com> In-Reply-To: <45CED641.7020608@ab.ote.we.lv> References: <45CED641.7020608@ab.ote.we.lv>
next in thread | previous in thread | raw e-mail | index | archive | help
Trigonometry is seldom done with fixed point, which is the only way to do it in the kernel (using the FPU is a no-no). I would write a perl script to generate a lookup table for those functions - paste it into a header and use that. HTH. -Kip On 2/11/07, Eugene M. Kim <freebsd.org@ab.ote.we.lv> 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? > > Cheers, > Eugene > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?b1fa29170702110109o2d1b165aj1896c0c2574950b8>