From owner-freebsd-hackers@FreeBSD.ORG Sun Feb 11 09:37:13 2007 Return-Path: X-Original-To: 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 46F8016A469 for ; Sun, 11 Feb 2007 09:37:13 +0000 (UTC) (envelope-from kip.macy@gmail.com) Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.188]) by mx1.freebsd.org (Postfix) with ESMTP id CB9D513C442 for ; Sun, 11 Feb 2007 09:37:12 +0000 (UTC) (envelope-from kip.macy@gmail.com) Received: by nf-out-0910.google.com with SMTP id m19so1609212nfc for ; Sun, 11 Feb 2007 01:37:11 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=pLaWZAz/rmJ6tFKQBe7v2Xla9jPC9XZ7Ciw2yh9Pb0JU/Y0lRDse/Afz0WFxpP2q0kUcW2gmeDhHDfMYfUsBN99F5A3zyVC2z19nQYKHdKRbhgfzGY3AyuQ0lDQoV+jAz1kmss+sqRkoXb9xvFoO+qpZKcOKRp3SuRuRfzbra0k= Received: by 10.82.134.12 with SMTP id h12mr4985098bud.1171184970861; Sun, 11 Feb 2007 01:09:30 -0800 (PST) Received: by 10.82.191.16 with HTTP; Sun, 11 Feb 2007 01:09:30 -0800 (PST) Message-ID: Date: Sun, 11 Feb 2007 01:09:30 -0800 From: "Kip Macy" To: "Eugene M. Kim" , hackers@freebsd.org In-Reply-To: <45CED641.7020608@ab.ote.we.lv> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <45CED641.7020608@ab.ote.we.lv> Cc: 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 09:37:13 -0000 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 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" >