home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / IRIT / DRAWFN3S.ZIP / PROGRAM.H < prev    next >
Encoding:
C/C++ Source or Header  |  1990-05-06  |  3.3 KB  |  104 lines

  1. /*****************************************************************************
  2. *   Definitions for program to draw a surface function given as Z = f(X, Y)  *
  3. *                                         *
  4. *   Written by :  Gershon Elber                 Ver 0.1, Apr. 1988  *
  5. *****************************************************************************/
  6.  
  7. #ifndef DRAW_FN_3D_H
  8. #define DRAW_FN_3D_H
  9.  
  10. #include "Expr2TrG.h"
  11. #include "GenMat.h"
  12.  
  13. #define VoidPtr        void *
  14.  
  15. #define ABS(y)        ((y) > 0 ? (y) : (-(y)))
  16. #define    SQR(y)        ((y) * (y))
  17. #define SGN(x)        ((x) > 0 ? 1 : ((x) == 0 ? 0 : -1))
  18. #define DEG2RAD(x)    ((x) * M_PI / 180.0)
  19.  
  20. #define IS_DISK_FILE(FileName)    (!(strstr(FileName, \
  21.                     "con com1 com2 com3 lpt1 lpt2 lpt3")))
  22.  
  23. #define    LINE_LEN    128                 /* Maximum line length. */
  24. #define    LINE_LEN_LONG    1024  /* Max. long line length - for function input. */
  25. #define FILE_NAME_LEN    80
  26.  
  27. #define    DEFAULT_SAMPLES    50    /* Default number of samples per one iso line. */
  28. #define    MAX_SAMPLES    1000  /* Maximum number of samples per one iso line. */
  29. #define    DEFAULT_ISO_LINES 20             /* Default number of iso lines. */
  30. #define    MAX_ISO_LINES    100             /* Maximum number of iso lines. */
  31.  
  32. typedef    struct IsoLine {
  33.      float Samples[MAX_SAMPLES][3];
  34. } IsoLine;
  35.  
  36. #define    FUNC_COLOR    MAGENTA                   /* Color of function. */
  37. #define    AXES_COLOR    YELLOW                   /* Color of axes. */
  38.  
  39. #define    FUNC_POS_X    -0.95             /* Function as string position. */
  40. #define    FUNC_POS_Y    0.7
  41. #define    FUNC_DIF_Y    0.1            /* Difference between two lines. */
  42.  
  43. #define    MAIN_SCALE    1.98            /* Should be 2 but for the safety... */
  44.  
  45. #ifndef INFINITY
  46. #define INFINITY 1e6
  47. #endif
  48.  
  49. #ifndef    NULL
  50. #define    NULL       0
  51. #endif
  52.  
  53. #ifndef    TRUE
  54. #define    TRUE       -1
  55. #define    FALSE       0
  56. #endif
  57.  
  58. #define FILES_TO_DIR    "*.fun"         /* Mask what files to print in dir. */
  59.  
  60. /* Prototypes in DrawFn3D.c module: */
  61.  
  62. void RedrawScreen(ExprNode *PFunc[3], char SFunc[3][LINE_LEN_LONG],
  63.     double UMin, double UMax, double VMin, double VMax,
  64.     MatrixType TransMat, int NumOfSamples, int NumOfIsoLines,
  65.     struct IsoLine *IsoLinesU[MAX_ISO_LINES],
  66.     struct IsoLine *IsoLinesV[MAX_ISO_LINES]);
  67. void SetUpHardErr(void);
  68. void MyExit(int ExitCode);
  69. extern int MouseExists;  /* Set according to autotest and config enforcment. */
  70. extern int GraphDriver;                                /* " */
  71.  
  72.  
  73. /* Prototypes in GetFunc.c module: */
  74.  
  75. void DoGetFunc(ExprNode *PFunc[3], char SFunc[3][LINE_LEN_LONG],
  76.     int *InputExists,
  77.     double *UMin, double *UMax, double *VMin, double *VMax,
  78.     int *NumOfIsoLines, int *NumOfSamples,
  79.     struct IsoLine *IsoLinesU[MAX_ISO_LINES],
  80.     struct IsoLine *IsoLinesV[MAX_ISO_LINES], MatrixType TransMat);
  81. int GetLine(FILE *f, int ReadStdin, char *Header, char *s);
  82.  
  83.  
  84. /* Prototypes in SetParam.c module: */
  85.  
  86. void DoSetParam(int *NumOfSamples, int *NumOfIsoLines,
  87.     double *UMin, double * UMax, double * VMin, double * VMax,
  88.     int *DblBuffer,
  89.     struct IsoLine *IsoLinesU[MAX_ISO_LINES],
  90.     struct IsoLine *IsoLinesV[MAX_ISO_LINES]);
  91. void UpdateDataStruct(int OldSamples, int OldIsoLines,
  92.     int *NumOfSamples, int *NumOfIsoLines,
  93.     struct IsoLine *IsoLinesU[MAX_ISO_LINES],
  94.     struct IsoLine *IsoLinesV[MAX_ISO_LINES]);
  95.  
  96.  
  97. /* Prototypes in SaveFunc.c module: */
  98.  
  99. void DoSaveFunc(ExprNode *PFunc[3], char SFunc[3][LINE_LEN_LONG],
  100.     double UMin, double UMax, double VMin, double VMax,
  101.     int NumOfIsoLines, int NumOfSamples, MatrixType TransMat);
  102.  
  103. #endif DRAW_FN_3D_H
  104.