home *** CD-ROM | disk | FTP | other *** search
/ AMOS PD CD / amospdcd.iso / extensions / jd / procs / _bezier.amos / _bezier.amosSourceCode
AMOS Source Code  |  1994-02-02  |  558b  |  33 lines

  1. Screen Open 0,640,256,4,Hires
  2. Dim K(3,1)
  3. Global K()
  4. Data 100,50,250,250,100,250,250,50
  5. Ink 4
  6. For I=0 To 3
  7.    Read K(I,0),K(I,1)
  8.    Plot K(I,0),K(I,1)
  9. Next 
  10. Ink 2
  11. BEZIER[20]
  12. Wait Key 
  13. End 
  14. Procedure BEZIER[S]
  15. S#=S
  16. Dim P(3,3,1)
  17. For I=0 To 3
  18.    P(I,0,0)=K(I,0)
  19.    P(I,0,1)=K(I,1)
  20. Next 
  21. M#=0.0
  22. Plot K(0,0),K(0,1)
  23. While M#<=1
  24.    M#=M#+1.0/S#
  25.    For J=1 To 3
  26.       For I=0 To 3-J
  27.          P(I,J,0)=P(I,J-1,0)+M#*(P(I+1,J-1,0)-P(I,J-1,0))
  28.          P(I,J,1)=P(I,J-1,1)+M#*(P(I+1,J-1,1)-P(I,J-1,1))
  29.       Next 
  30.    Next 
  31.    Polyline To P(0,3,0),P(0,3,1)
  32. Wend 
  33. End Proc