home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / dev / e / amigae / src / tools / vector / vectest3.e < prev    next >
Text File  |  1992-09-02  |  1KB  |  45 lines

  1. MODULE 'tools/vector'
  2.  
  3. CONST R=100,S=40
  4.  
  5. DEF r1=R,n1=-R,r2=R,n2=-R,fac1=-1,fac2=1,fac3=1,fac4=-1
  6. DEF o1,o2,l1,l2
  7.  
  8. PROC main()
  9.   DEF w,sx1,sx2,sy1,sy2,phi,theta
  10.   o1:=List(S)
  11.   o2:=List(S)
  12.   IF w:=OpenW(0,11,200,189,$200,$E,'3d VectorZ in E!',NIL,1,NIL)
  13.     SetRast(stdrast,1)
  14.     RefreshWindowFrame(w)
  15.     phi:=74
  16.     theta:=60
  17.     setmiddle3d(100,100)
  18.     setpers3d(750,300)
  19.     REPEAT
  20.       dofac({r1},{fac1})
  21.       dofac({r2},{fac2})
  22.       dofac({n1},{fac3})
  23.       dofac({n2},{fac4})
  24.       WaitTOF()
  25.       polygon3d(o1,1)
  26.       polygon3d(o2,1)
  27.       phi:=phi+2; IF phi>=360 THEN phi:=phi-360
  28.       theta:=theta+2; IF theta>=360 THEN theta:=theta-360
  29.       init3d(phi,theta)
  30.       polygon3d(l1:=[r1,r1,r1,r1,r1,n1,r1,n1,n1,r1,n1,r1,r1,r1,r1,r1,n1,r1,n1,n1,r1,n1,r1,r1,r1,r1,r1],2)
  31.       polygon3d(l2:=[n2,n2,n2,n2,n2,r2,n2,r2,r2,n2,r2,n2,n2,n2,n2,n2,r2,n2,r2,r2,n2,r2,n2,n2,n2,n2,n2],3)
  32.       ListCopy(o1,l1,ALL)
  33.       ListCopy(o2,l2,ALL)
  34.       Delay(1)
  35.     UNTIL GetMsg(Long(w+$56))
  36.     CloseW(w)
  37.   ENDIF
  38. ENDPROC
  39.  
  40. PROC dofac(var,f)
  41.   ^var:=^var+^f
  42.   IF ^var>0 THEN IF (^var>120) OR (^var<80) THEN ^f:=-^f
  43.   IF ^var<0 THEN IF (^var<-120) OR (^var>-80) THEN ^f:=-^f
  44. ENDPROC
  45.