00001 /*--------------------------------------------------------------------------------- 00002 00003 Trig_lut.h provides access to external precompiled trig look up tables 00004 00005 Copyright (C) 2005 00006 Michael Noland (joat) 00007 Jason Rogers (dovoto) 00008 Dave Murphy (WinterMute) 00009 00010 This software is provided 'as-is', without any express or implied 00011 warranty. In no event will the authors be held liable for any 00012 damages arising from the use of this software. 00013 00014 Permission is granted to anyone to use this software for any 00015 purpose, including commercial applications, and to alter it and 00016 redistribute it freely, subject to the following restrictions: 00017 00018 1. The origin of this software must not be misrepresented; you 00019 must not claim that you wrote the original software. If you use 00020 this software in a product, an acknowledgment in the product 00021 documentation would be appreciated but is not required. 00022 2. Altered source versions must be plainly marked as such, and 00023 must not be misrepresented as being the original software. 00024 3. This notice may not be removed or altered from any source 00025 distribution. 00026 00027 00028 00029 ---------------------------------------------------------------------------------*/ 00030 #ifndef TRIG_LUT_H 00031 #define TRIG_LUT_H 00032 00033 #include <nds/ndstypes.h> 00034 00055 #ifdef __cplusplus 00056 extern "C" { 00057 #endif 00058 00059 #define DEGREES_IN_CIRCLE (1 << 15) 00060 00061 #define fixedToInt(n, bits) ((int)((n)>>(bits))) 00062 #define intToFixed(n, bits) ((int)((n)<<(bits))) 00063 00064 #define floatToFixed(n, bits) ((int)((n) * (float)(1<<(bits)))) 00065 #define fixedToFloat(n, bits) (((float)(n)) / (float)(1<<(bits))) 00066 00067 #define floorFixed(n, bits) ((int)((n) & ~(((1 << (bits)) - 1)))) 00068 00069 #define degreesToAngle(degrees) ((degrees) * DEGREES_IN_CIRCLE / 360) 00070 #define angleToDegrees(angle) ((angle) * 360 / DEGREES_IN_CIRCLE) 00071 00072 00080 s16 cosLerp(s16 angle); 00088 s16 sinLerp(s16 angle); 00089 00097 s32 tanLerp(s16 angle); 00098 00106 s16 acosLerp(s16 par); 00114 s16 asinLerp(s16 par); 00115 00116 00117 00118 #ifdef __cplusplus 00119 } 00120 #endif 00121 00122 #endif