home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AMOS PD CD
/
amospdcd.iso
/
sourcecode
/
various
/
cosinea.amos
/
cosinea.amosSourceCode
Wrap
AMOS Source Code
|
1993-01-08
|
1KB
|
70 lines
Rem Cosine Surface
Screen Open 1,640,256,8,Hires
Wind Open 1,10,10,80,25
PCOL=5
Cls 0
Rem Upper & Lower Limits for Hidden Line Routine
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
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#=27 To -55 Step -0.2
FL=0
For Y#=-40 To 30 Step 0.2
Z#= Fn Z#(X#)
Gosub PLTER
Next Y#
Next X#
End
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
Goto DROPOUT
End If
DX=OLDX-SX
If DX=0 Then DX=1
SL=(OLDY-SY)/DX
YP=OLDY
For XP=Int(OLDX)+1 To SX
FG=1
YP=YP+SL
If(XP<0) or(XP>630) Then FG=0 : Goto LOP
If(YP<0) or(YP>250) Then FG=0
If YP<=YTOPLINE(XP)
YTOPLINE(XP)=YP
If FG<>0
Plot XP,YP
End If
If YP=>YBASELINE(XP)
YBASELINE(XP)=YP
If FG=0
Goto LOP
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
Plot XP,YP
Goto LOP
End If
LOP:
Next XP
DROPOUT:
OLDX=SX : OLDY=SY : Return