00001 /* 00002 Copyright (c) 2008, Luke Benstead. 00003 All rights reserved. 00004 00005 Redistribution and use in source and binary forms, with or without modification, 00006 are permitted provided that the following conditions are met: 00007 00008 * Redistributions of source code must retain the above copyright notice, 00009 this list of conditions and the following disclaimer. 00010 * Redistributions in binary form must reproduce the above copyright notice, 00011 this list of conditions and the following disclaimer in the documentation 00012 and/or other materials provided with the distribution. 00013 00014 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 00015 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00016 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00017 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 00018 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00019 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00020 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 00021 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00022 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00023 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00024 */ 00025 00026 #ifndef UTILITY_H_INCLUDED 00027 #define UTILITY_H_INCLUDED 00028 00029 #include <math.h> 00030 00031 #ifndef kmScalar 00032 #define kmScalar float 00033 #endif 00034 00035 #ifndef KM_FALSE 00036 #define KM_FALSE 0 00037 #endif 00038 00039 #ifndef KM_TRUE 00040 #define KM_TRUE 1 00041 #endif 00042 00043 #define kmPI 3.141592f 00044 #define kmPIOver180 0.017453f // PI / 180 00045 #define kmPIUnder180 57.295779f // 180 / PI 00046 #define kmEpsilon 1.0 / 64.0 00047 00048 00049 00050 #ifdef __cplusplus 00051 extern "C" { 00052 #endif 00053 00054 extern kmScalar kmSQR(kmScalar s); 00055 extern kmScalar kmDegreesToRadians(kmScalar degrees); 00056 extern kmScalar kmRadiansToDegrees(kmScalar radians); 00057 00058 #ifdef __cplusplus 00059 } 00060 #endif 00061 00062 #endif /* UTILITY_H_INCLUDED */