00001 // Filename: cmath.h 00002 // Created by: drose (19May00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef CMATH_H 00020 #define CMATH_H 00021 00022 #include <pandabase.h> 00023 00024 #include <math.h> 00025 00026 // This file declares a number of C++-style overloading wrappers 00027 // around the standard math library functions, so we can use 00028 // overloading to differentiate on type instead of having to know 00029 // explicitly whether we need to call, for instance, sqrtf() or 00030 // sqrt(). 00031 00032 INLINE_LINMATH float csqrt(float v); 00033 INLINE_LINMATH float csin(float v); 00034 INLINE_LINMATH float ccos(float v); 00035 INLINE_LINMATH float ctan(float v); 00036 INLINE_LINMATH void csincos(float v, float *pSinResult, float *pCosResult); // does both at once (faster on x86) 00037 INLINE_LINMATH float cabs(float v); 00038 INLINE_LINMATH float catan(float v); 00039 INLINE_LINMATH float catan2(float y, float x); 00040 //INLINE_LINMATH float cfloor(float f); 00041 //INLINE_LINMATH float cceil(float f); 00042 00043 INLINE_LINMATH double cfloor(double f); 00044 INLINE_LINMATH double cceil(double f); 00045 INLINE_LINMATH double csqrt(double v); 00046 INLINE_LINMATH double csin(double v); 00047 INLINE_LINMATH double ccos(double v); 00048 INLINE_LINMATH double ctan(double v); 00049 INLINE_LINMATH double cabs(double v); 00050 INLINE_LINMATH double catan(double v); 00051 INLINE_LINMATH double catan2(double y, double x); 00052 INLINE_LINMATH void csincos(double v, double *pSinResult, double *pCosResult); // does both at once (faster on x86) 00053 00054 // Returns true if the number is nan, false if it's a genuine number 00055 // or infinity. 00056 INLINE_LINMATH bool cnan(double v); 00057 00058 #include "cmath.I" 00059 00060 #endif 00061