home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / pascal / spx10.zip / SPX_DOC.ZIP / SPX_T3D.DOC < prev    next >
Text File  |  1993-05-05  |  3KB  |  69 lines

  1. { SPX Library Version 1.0  Copyright 1993 Scott D. Ramsay }
  2.  
  3.   The SPX_T3D is the basic 3D and angle unit.  It contains
  4. a sine/cosine table as well as simple rotation functions in 2D and 3D.
  5.   This unit is very simpilfied to keep the math from you ;)
  6.  
  7. GLOBAL VARIABLES:
  8.  
  9.     xc,yc:      Origin point (0,0,0) for 3D routines on the screen
  10.                 Default:  xc=160  yv=100 (center of VGA screen)
  11.     xv,yv,zv:   Viewer's position.  Location point of your eye
  12.                 Default:  xv=0  yv=-10  zv=150
  13.     sx,sy,sz:   Scale factors.  Values to scale each 3D plot.
  14.                 Default:  sx=1  sy=1 sz=1
  15.    sine,cosine: Sine and Cosine look up tables from 0 to 255.
  16.  
  17.                   sine[i] := sin(2*3.141592653/256*i)*256;
  18.                   cosine[i] := cos(2*3.141592653/256*i)*256;
  19.  
  20. ───────────────────────────────────────────────────────────────────────────
  21. procedure setpoints(xx,yy,zz:longint; var xd,yd : integer);
  22.  
  23.    Converts a 3D point to a 2D screen point.
  24.  
  25.    XX,YY,ZZ:  (x,y,z) 3D point;
  26.    XD,YD:     converted (x,y) 2D point
  27.  
  28.    XD,YD can be affected by SX, SY, SZ, XV, YV, ZV, XC, YC
  29.  
  30. ───────────────────────────────────────────────────────────────────────────
  31. procedure pset3d(xx,yy,zz:integer;n:byte);
  32.  
  33.    Draw a point.
  34.  
  35.    XX,YY,ZZ:  (x,y,z) 3D point;
  36.    N:         Color of point
  37.  
  38. ───────────────────────────────────────────────────────────────────────────
  39. procedure line3d(x1,y1,z1,x2,y2,z2:integer;n:byte;clip:boolean);
  40.  
  41.    Draw a line. Clips the line according to
  42.   WinMinX, WinMinY, WinMaxX, WinMaxY.
  43.  
  44.    X1,Y1,Z1:  Coordinate 1 of line;
  45.    X2,Y2,Z2:  Coordinate 2 of line;
  46.    N:         Color of line
  47.    CLIP:      If set to TRUE, the line will be clipped according to
  48.               WinMinX, WinMinY, WinMaxX, WinMaxY.
  49.  
  50.   NOTE: CLIP=FALSE is faster.
  51. ───────────────────────────────────────────────────────────────────────────
  52. procedure rotate256xy(var x,y:integer;angle:byte);
  53.  
  54.   Rotates a 2D point (x,y) about the origin (0,0).
  55.  
  56.   X,Y:    Point to rotate;
  57.   ANGLE:  Amount to rotate.  Legal values: 0..255
  58.  
  59. ───────────────────────────────────────────────────────────────────────────
  60. procedure rotate256xyz(var x,y,z:integer;xa,ya,za:byte);
  61.  
  62.   Rotates a 3D point (x,y,z) about the origin (0,0,0).
  63.  
  64.   X,Y,Z:    Point to rotate;
  65.   XA:       Amount to rotate on the x-axis.  Legal values: 0..255;
  66.   YA:       Amount to rotate on the y-axis.  Legal values: 0..255;
  67.   ZA:       Amount to rotate on the z-axis.  Legal values: 0..255
  68.  
  69. ───────────────────────────────────────────────────────────────────────────