home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / programming / misc_programming / hdr3d.pas < prev    next >
Pascal/Delphi Source File  |  1993-06-03  |  3KB  |  96 lines

  1. (******************************************************************************
  2. *                                    hdr3d                                    *
  3. * This unit includes the headers needed for 3D manipulation ..                *
  4. ******************************************************************************)
  5. unit hdr3d;
  6.  
  7. interface
  8.  
  9. const
  10.    version3dLib = '2.0';
  11.  
  12. const
  13.     MaxPoints  = 20;
  14.     MaxLines   = 50;
  15.     maxObjects = 9; {size of object table}
  16.     maxNest    = 10; {size of loop table of interpreter}
  17.  
  18. const ScreenWidth = 1000;
  19.       HalfWidth   = screenWidth / 2;
  20.  
  21.       radFactor = 180 / 3.1415926535897932385;
  22.  
  23. type
  24.     line3dPtr = ^ line3d;
  25.     Line3d  = record
  26.        FromP, ToP  : integer;
  27.     end;
  28.  
  29.     screenPointsPtr = ^ screenPoints;
  30.     screenPoints = record
  31.        sX,sY : integer;
  32.     end;
  33.  
  34.     axisType = (x,y,z);
  35.  
  36. type
  37.     point3dPtr = ^ point3d;
  38.     point3d = record
  39.        x, y, z     : real;
  40.     end;
  41.  
  42. const
  43.        zeroPoint : point3d = (x:0.0; y:0.0; z:0.0);
  44.        xAxis : integer = 45;
  45.        yAxis : integer = 45;
  46.  
  47. var
  48. {$ifdef windows}
  49.        MaxX, MaxY : word;          { In pixels for graphics screen }
  50.        MaxColor   : word;
  51. {$endif}
  52.        cosine_x,cosine_y,sine_x,sine_y : Real;
  53.        currentPath : string[32];
  54. const
  55.        currentAxis : axisType = x;
  56.  
  57.  
  58. Procedure CalcAxisDeg;
  59. procedure setDefaultSuffix(var Fname : string; suffix : string);
  60.  
  61. implementation
  62.  
  63. (******************************************************************************
  64. *                                 CalcAxisDeg                                 *
  65. * calculate sines and cosines of axis, xAxis + yAxis = 90 !                   *
  66. ******************************************************************************)
  67. Procedure CalcAxisDeg;
  68. begin
  69.      Cosine_X := cos(Xaxis/RadFactor);
  70.      Cosine_Y := cos(Yaxis/RadFactor);
  71.      Sine_X   := sin(Xaxis/RadFactor);
  72.      Sine_Y   := sin(Yaxis/RadFactor);
  73. end; {calcAxisDeg}
  74.  
  75. (*******************************************************************************
  76. *                              setDefaultSuffix                                *
  77. *   Set the suffix if Fname to .suffix, if it does not have a suffix           *
  78. *******************************************************************************)
  79. procedure setDefaultSuffix;
  80. var
  81.     i  : integer;
  82. begin
  83.     i := length(Fname);
  84.     while (i > 0) and (Fname[i] <> '.') do
  85.        dec(i);
  86.     if (i = 0) then
  87.        Fname := Fname + '.' + suffix;
  88. end; {setDefaultSuffix}
  89.  
  90. (******************************************************************************
  91. *                                    end.                                     *
  92. ******************************************************************************)
  93. begin
  94.        calcAxisDeg;
  95. end.
  96.