[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

**To**:**tech-kern%netbsd.org@localhost****Subject**:**Re: atan2 and sqrt --> in driver****From**:**Joerg Sonnenberger <joerg%britannica.bec.de@localhost>**- Date: Tue, 9 Dec 2008 20:23:03 +0100

On Tue, Dec 09, 2008 at 06:01:52PM +0100, Robert Fritzsche wrote: > The driver is for the wii-remote, so get 1 byte for x-, y- and z-axis. > Based on this values I will calculate the pitch = atan2(y, > sqrt(x^2+z^2)) and yaw = atan2(z, sqrt(x^2+y^2)) Two approaches: use integer math (e.g. fixed point) to approximate atan2 and sqrt. Alternatively, just provide a data table, indexed by 0..255 x 0..255, with the second operand shifted and the sqrt computed in integer math. Search wikipedia for easy algorithms to compute isqrt. Joerg

**Follow-Ups**:**Re: atan2 and sqrt --> in driver***From:*der Mouse

**References**:**atan2 and sqrt --> in driver***From:*Robert Fritzsche

**Re: atan2 and sqrt --> in driver***From:*Ignatios Souvatzis

**Re: atan2 and sqrt --> in driver***From:*Robert Fritzsche

- Prev by Date:
**Re: atan2 and sqrt --> in driver** - Next by Date:
**Re: Proposal: B_ARRIER (addresses wapbl performance?)** - Previous by Thread:
**Re: atan2 and sqrt --> in driver** - Next by Thread:
**Re: atan2 and sqrt --> in driver** - Indexes: