home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AMOS PD CD
/
amospdcd.iso
/
sourcecode
/
various
/
cosine.amos
/
cosine.amosSourceCode
Wrap
AMOS Source Code
|
1993-01-08
|
2KB
|
104 lines
Rem Cosine Surface
Screen Open 1,640,256,8,Hires
Wind Open 1,10,10,64,25
PCOL=5
Cls 0
Rem
Rem Upper & Lower Limits for Hidden Line Routine
Rem The 255 within I for-next loop = Screen Height - 1
Rem and not some magic HEX value.
Rem
Dim YTOPLINE(640),YBASELINE(640)
For I=1 To 639 : YTOPLINE(I)=255 : Next I
Rem Center Lines for X & Y Axis
XAXIS=320 : YAXIS=127
Rem
Rem RHO = Distance from Viewer to 0,0,0
Rem THETA = Angle between Viewer & X Axis (Horizontal)
Rem PHI = Angle between Viewer & Z Axis (Vertical)
Rem D = Distance between Viewer & Display Window
Rem
RHO#=80.0 : D#=750.0
THETA#=0.4 : S1#=Sin(THETA#) : C1#=Cos(THETA#)
PHI#=1.25 : S2#=Sin(PHI#) : C2#=Cos(PHI#)
Def Fn Z#(X#)=Cos(0.06*(X#*X#+Y#*Y#))
Rem point generating loop
For X#=22.0 To -55.0 Step -0.2
FL=0
For Y#=-40.0 To 19.0 Step 0.2
Z#= Fn Z#(X#)
Gosub PLTER
Next Y#
Next X#
End
Rem End of Program.
Rem
PLTER:
XE#=(-X#*S1#+Y#*C1#)
YE#=(-X#*C1#*C2#-Y#*S1#*C2#+Z#*S2#)
ZE#=(-X#*S2#*C1#-Y#*S2#*S1#-Z#*C2#+RHO#)
SX=Int(D#*(XE#/ZE#)+XAXIS)
SY=Int(-D#*(YE#/ZE#)+YAXIS)
If FL=0
FL=1
F=0
Else
DX=OLDX-SX
If DX=0
DX=1
End If
SL=(OLDY-SY)/DX
YP=OLDY
For XP=Int(OLDX)+1 To SX
FG=1
YP=YP+SL
If(XP<0) or(XP>630)
FG=0
F=0
Goto LOP
End If
If(YP<0) or(YP>250)
FG=0
F=0
End If
If YP<=YTOPLINE(XP)
YTOPLINE(XP)=YP
If FG<>0
If F=0
Plot XP,YP,PCOL
F=1
End If
Plot XP,YP
End If
If YP=>YBASELINE(XP)
YBASELINE(XP)=YP
If FG=0
Goto LOP
End If
If F=0
F=1
Plot XP,YP,PCOL
End If
Plot XP,YP
Goto LOP
Else
Goto LOP
End If
End If
If YP>=YBASELINE(XP)
YBASELINE(XP)=YP
If FG=0
Goto LOP
End If
If F=0
Plot XP,YP,PCOL
F=1
End If
Plot XP,YP
Goto LOP
End If
F=0
LOP:
Next XP
End If
OLDX=SX : OLDY=SY : Return