GPS4Palm

Source Code Documentation


Sinetab.c

Go to the documentation of this file.
00001 /*****************************************************************************
00002  *
00003  * $RCSfile: Sinetab_8c-source.html,v $
00004  *
00005  * GPS4Palm Sine and Cosine Table Lookup -
00006  *   mainly used for Display Functions
00007  *
00008  * This program is Copyright (C) 03/2003 Matthias Prinke
00009  * <matthias.prinke@surfeu.de> and covered by GNU's GPL.
00010  * In particular, this program is free software and comes WITHOUT
00011  * ANY WARRANTY.
00012  *
00013  * $Author: mp $
00014  *
00015  * $Date: 2007-10-08 20:40:34 $
00016  *
00017  * $Revision: 1.7.2.1 $
00018  *
00019  * $Log: Sinetab_8c-source.html,v $
00019  * Revision 1.7.2.1  2007-10-08 20:40:34  mp
00019  * updated for gps4palm V0.9.5 beta
00019  *
00020  * Revision 1.1.1.1  2003-07-14 18:59:29  mp
00021  * Imported GPS4Palm to CVS revision control.
00022  *
00023  *
00024  ****************************************************************************/
00025 #include <PalmOS.h>
00026 #include "Sinetab.h"
00027 
00028 /* **************************** */
00029 /* Sine and Cosine Table Lookup */
00030 /* **************************** */ 
00031 Int32 sinetab[91] =
00032   { 0, 571, 1143, 1714, 2285, 2855, 3425, 3993, 4560, 5126, 5690, 6252, 6812,
00033   7371, 7927, 8480, 9032, 9580, 10125, 10668, 11207, 11743, 12275, 12803,
00034   13327, 13848, 14364, 14876, 15383, 15886, 16383, 16876, 17364, 17846, 18323,
00035   18794, 19260, 19720, 20173, 20621, 21062, 21497, 21926, 22347, 22762, 23170,
00036   23571, 23964, 24351, 24730, 25101, 25465, 25821, 26169, 26509, 26841, 27165,
00037   27481, 27788, 28087, 28377, 28659, 28932, 29196, 29451, 29697, 29935, 30163,
00038   30381, 30591, 30791, 30982, 31164, 31336, 31498, 31651, 31794, 31928, 32051,
00039   32165, 32270, 32364, 32449, 32523, 32588, 32643, 32688, 32723, 32748, 32763,
00040   32768
00041 };
00042 
00043 Int32 isin(Int32 angle)
00044 {
00045   while (angle >= 360)
00046     angle -= 360;
00047   while (angle < 0)
00048     angle += 360;
00049 
00050   if (angle <= 90)
00051     return sinetab[angle];
00052   if (angle <= 180)
00053     return sinetab[180 - angle];
00054   if (angle <= 270)
00055     return -sinetab[angle - 180];
00056   return -sinetab[360 - angle];
00057 }

Created: Mon, 08 Oct 2007 22:33:16 +0200
Copyright ©2004 M. Prinke