-
Notifications
You must be signed in to change notification settings - Fork 3
/
!_FUN3D.bas
47 lines (47 loc) · 1.01 KB
/
!_FUN3D.bas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
10 CLS:KEY OFF
20 WINDOW (-5,-5)-(5,5)
30 VIEW (120,20)-(500,198),,1
40 READ X3MIN,X3MAX,Y3MIN,Y3MAX
50 DATA -3,3,-3,3
60 SPIN=45:TIP=30
70 DEF FNF(X,Y)=COS(X)*COS(Y)
80 C=1
90 XSP=(X3MAX-X3MIN)/20
100 YSP=(Y3MAX-Y3MIN)/20
110 '
120 CLS:KEY OFF
130 '
140 RD=3.14159/180
150 A11=COS(SPIN*RD)
160 A12=SIN(SPIN*RD)
170 A13=0
180 A21=-SIN(TIP*RD)*SIN(SPIN*RD)
190 A22=SIN(TIP*RD)*COS(SPIN*RD)
200 A23=COS(TIP*RD)
210 '
220 DEF FNX(X,Y,Z)=A11*X+A12*Y+A13*Z
230 DEF FNY(X,Y,Z)=A21*X+A22*Y+A23*Z
240 '
250 FOR X=X3MIN TO X3MAX STEP XSP
260 Y=Y3MIN: Z=FNF(X,Y)
270 PSET (FNX(X,Y,Z),FNY(X,Y,Z))
280 FOR Y=Y3MIN TO Y3MAX STEP YSP
290 Z=FNF(X,Y)
300 LINE -(FNX(X,Y,Z),FNY(X,Y,Z)),1
310 NEXT Y
320 NEXT X
330 '
340 FOR Y=Y3MIN TO Y3MAX STEP YSP
350 X=X3MIN: Z=FNF(X,Y)
360 PSET (FNX(X,Y,Z),FNY(X,Y,Z))
370 FOR X=X3MIN TO X3MAX STEP XSP
380 Z=FNF(X,Y)
390 LINE -(FNX(X,Y,Z),FNY(X,Y,Z)),1
400 NEXT X
410 NEXT Y
420 '
430 INPUT "SPIN = ",SPIN
440 INPUT "TIP = ",TIP
450 '
460 GOTO 120