; ; fixedPt.sh ; ; Provides fixed point operations such as trignometry ; ; © 1994-1998 Straylight ; ;----- Licensing note ------------------------------------------------------- ; ; This file is part of Straylight's Sapphire library. ; ; Sapphire is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation; either version 2, or (at your option) ; any later version. ; ; Sapphire is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; ; You should have received a copy of the GNU General Public License ; along with Sapphire. If not, write to the Free Software Foundation, ; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ;----- Overview ------------------------------------------------------------- ; ; Functions provided: ; ; fxp_atan ; fxp_pol ; fxp_sin ; fxp_cos [ :LNOT::DEF:fixedPt__dfn GBLL fixedPt__dfn ; --- fxp_atan --- ; ; On entry: R0 == x, in 16.16 fixed point form ; ; On exit: R0 == arctan x, in degrees, in 16.16 fixed point ; ; Use: Calculates arctan x, hopefully fairly swiftly. The ; accuracy of the result is open to doubt, although ; it's usually good to about 3 significant figures. ; It uses a small lookup table and linear interpolation ; to calculate the result. IMPORT fxp_atan ; --- fxp_pol --- ; ; On entry: R0 == x coordinate ; R1 == y coordinate ; ; On exit: R0 == angle in degrees, in 16.16 form ; ; Use: Calculates the angle a vector makes with the +ve x axis. ; The angle is given in degrees, rather than radians, ; although this isn't really overly significant; it just ; makes it slightly easier to work with, because it's ; bigger. ; ; This routine uses the arctan table and linear ; interpolation, so it's fairly quick, but the accuracy ; of its results is restricted to about 3 significant figures. IMPORT fxp_pol ; --- fxp_sin --- ; ; On entry: R0 == angle in degrees, in 16.16 form ; ; On exit: R0 == sin of angle, in 16.16 form ; ; Use: Calculates a sin of an angle with a degree of swiftness and ; a lot less accuracy. IMPORT fxp_sin ; --- fxp_cos --- ; ; On entry: R0 == angle in degrees, in 16.16 form ; ; On exit: R0 == cos of angle, in 16.16 form ; ; Use: Calculates a cos of an angle with a degree of swiftness and ; a lot less accuracy. IMPORT fxp_cos ] ;----- That's all, folks ---------------------------------------------------- END