home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Graphics / Graphics.zip / povsrc31.zip / isofunc.h < prev    next >
C/C++ Source or Header  |  2000-01-19  |  3KB  |  203 lines

  1. #include <math.h>
  2.  
  3. #ifdef DLL
  4.   #ifdef _WIN32
  5.    #define EQPTSRF
  6.    #include <windows.h>
  7.    BOOL WINAPI DllMain (HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved)
  8.    {return TRUE;}
  9.    #undef BLOB
  10.   #endif
  11. #endif
  12.  
  13. #ifdef DLL
  14.   #ifndef DBL
  15.   #define DBL double
  16.   #endif
  17.  
  18.   #ifdef _WIN32
  19.     #define DllExport    __declspec( dllexport )
  20.     #define FUNC DllExport DBL 
  21.   #else
  22.     #define FUNC DBL 
  23.   #endif
  24.  
  25. #ifndef DLL_FRAME
  26.  #define X 0
  27.  #define Y 1
  28.  #define Z 2
  29.  
  30.  typedef DBL VECTOR [3];
  31.  typedef struct Function_Struct FUNCTION;
  32.  typedef DBL (*ISO_FUNC)(FUNCTION *, VECTOR );
  33.  
  34.  struct Function_Struct {
  35.    char      *ops_stack;
  36.    DBL       *number_stack;
  37.    int       opslen, numlen;
  38.    unsigned char      Flags;
  39.    char      *func_name;
  40.    DBL       *parm;
  41.    int       pnum;
  42.    DBL       sign;
  43.    ISO_FUNC  iso_func;
  44.    DBL       Max_gradient,gradient;
  45.    char      *isosf;
  46.    DBL       threshold;
  47.    FUNCTION  *prev, *next;
  48.    #ifdef IsoPigmentPatch
  49. #ifndef DLL
  50.    PIGMENT     *Pigment;        /* Added MCB 12-28-98 */
  51. #endif
  52.    void         *cache;        /* Added MCB 01-06-00 */
  53. #endif
  54.   };
  55. #ifndef M_PI
  56. #define M_PI   3.1415926535897932384626
  57. #endif
  58.  
  59. #ifndef M_PI_2
  60. #define M_PI_2 1.57079632679489661923
  61. #endif
  62.  
  63. #ifndef TWO_M_PI
  64. #define TWO_M_PI 6.283185307179586476925286766560
  65. #endif
  66.  
  67. #ifndef M_PI_180
  68. #define M_PI_180 0.01745329251994329576
  69. #endif
  70.  
  71. #ifndef M_PI_360
  72. #define M_PI_360 0.00872664625997164788
  73. #endif
  74.  
  75. /* Get minimum/maximum of two values. */
  76.  
  77. #ifndef min
  78. #define min(x,y) (((x)>(y))?(y):(x))
  79. #endif
  80.  
  81. #ifndef max
  82. #define max(x,y) (((x)<(y))?(y):(x))
  83. #endif
  84.  
  85. /* Get minimum/maximum of three values. */
  86.  
  87. #define max3(x,y,z) (((x)>(y))?(((x)>(z))?(x):(z)):(((y)>(z))?(y):(z)))
  88. #define min3(x,y,z) (((x)<(y))?(((x)<(z))?(x):(z)):(((y)<(z))?(y):(z)))
  89.  
  90. #ifndef labs      /* Absolute value of the long integer x. */
  91. #define labs(x) (long) (((x)<0)?-(x):(x))
  92. #endif
  93.  
  94. #ifndef fabs      /* Absolute value of the double x. */
  95. #define fabs(x) ((x) < 0.0 ? -(x) : (x))
  96. #endif
  97.  
  98.  
  99. #ifndef ACOS
  100. #define ACOS acos
  101. #endif
  102.  
  103. #ifndef SQRT
  104. #define SQRT sqrt
  105. #endif
  106.  
  107. #ifndef POW
  108. #define POW pow
  109. #endif
  110.  
  111. #ifndef COS
  112. #define COS cos
  113. #endif
  114.  
  115. #ifndef SIN
  116. #define SIN sin
  117. #endif
  118.  
  119. #ifndef TAN 
  120. #define TAN tan 
  121. #endif
  122.  
  123. #ifndef ASIN 
  124. #define ASIN asin 
  125. #endif
  126.  
  127. #ifndef ATAN 
  128. #define ATAN atan 
  129. #endif
  130.  
  131. #ifndef SINH 
  132. #define SINH sinh 
  133. #endif
  134.  
  135. #ifndef COSH 
  136. #define COSH cosh 
  137. #endif
  138.  
  139. #ifndef TANH 
  140. #define TANH tanh 
  141. #endif
  142.  
  143. #ifndef ASINH 
  144. #define ASINH asinh 
  145. #endif
  146.  
  147. #ifndef ACOSH 
  148. #define ACOSH acosh 
  149. #endif
  150.  
  151. #ifndef ATANH 
  152. #define ATANH atanh 
  153. #endif
  154.  
  155. #ifndef LOG 
  156. #define LOG log 
  157. #endif
  158.  
  159. #ifndef EXP 
  160. #define EXP exp 
  161. #endif
  162.  
  163. #ifndef ABS 
  164. #define ABS fabs 
  165. #endif
  166.  
  167. #ifndef FFLOOR
  168. #define FFLOOR floor
  169. #endif
  170.  
  171.  #ifndef FCEIL 
  172.  #define FCEIL  ceil   
  173.  #endif
  174.  
  175.  #else
  176.   #define POVWIN_FILE
  177.   #include "frame.h"
  178.   #include "isosrf.h"
  179.  #endif
  180.  
  181.   #define x XYZ[X]
  182.   #define y XYZ[Y]
  183.   #define z XYZ[Z]
  184. #endif
  185.  
  186.  
  187.  
  188. #define P0 Func->parm[0]
  189. #define P1 Func->parm[1]
  190. #define P2 Func->parm[2]
  191. #define P3 Func->parm[3]
  192. #define P4 Func->parm[4]
  193. #define P5 Func->parm[5]
  194. #define P6 Func->parm[6]
  195. #define P7 Func->parm[7]
  196. #define P8 Func->parm[8]
  197. #define P9 Func->parm[9]
  198. #define M_2PI      6.28318530718
  199. #define M_PI180   0.01745329251994
  200.  
  201.  
  202.  
  203.