From owner-freebsd-hackers@FreeBSD.ORG Sun Feb 11 10:32:48 2007 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BB22516A406 for ; Sun, 11 Feb 2007 10:32:48 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe11.swip.net [212.247.155.65]) by mx1.freebsd.org (Postfix) with ESMTP id 54C9F13C4A3 for ; Sun, 11 Feb 2007 10:32:48 +0000 (UTC) (envelope-from hselasky@c2i.net) X-Cloudmark-Score: 0.000000 [] Received: from [193.217.102.48] (account mc467741@c2i.net HELO [10.0.0.249]) by mailfe11.swip.net (CommuniGate Pro SMTP 5.0.12) with ESMTPA id 239886049; Sun, 11 Feb 2007 10:32:45 +0100 From: Hans Petter Selasky To: freebsd-hackers@freebsd.org Date: Sun, 11 Feb 2007 10:32:24 +0100 User-Agent: KMail/1.9.5 References: <45CED641.7020608@ab.ote.we.lv> In-Reply-To: <45CED641.7020608@ab.ote.we.lv> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200702111032.24080.hselasky@c2i.net> Cc: "Eugene M. Kim" Subject: Re: sin()/cos()/tan() for kernel code? '_ 'a X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Feb 2007 10:32:48 -0000 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