|
OPTION BASE 0
LET N=60 !'分割数
DIM X(N,N),Y(N,N),Z(N,N)
INPUT PROMPT "MODE(0 - 39)=":MODE
FILE GETSAVENAME F$,"DXFファイル|*.DXF"
IF F$="" THEN STOP
IF RIGHT$(F$,1)="!" THEN LET F$=F$(1:LEN(F$)-1) & "球体" & STR$(MODE)
IF POS(UCASE$(F$),".DXF")=0 THEN LET F$=F$ & ".dxf"
OPEN #1:NAME F$
ERASE #1
PRINT #1:"0"
PRINT #1:"SECTION"
PRINT #1:"2"
PRINT #1:"ENTITIES"
FOR I=0 TO N
FOR J=0 TO N
LET ALPHA=I*180/N
LET BETA=J*360/N
LET RR=FUNC(MODE,ALPHA,BETA)
LET X(I,J)=-RR*SIN(ALPHA*PI/180)*COS(BETA*PI/180)
LET Y(I,J)=RR*COS(ALPHA*PI/180)
LET Z(I,J)=RR*SIN(ALPHA*PI/180)*SIN(BETA*PI/180)
NEXT J
NEXT I
FOR I=0 TO N-1
PRINT #1:"0"
PRINT #1:"3DFACE"
PRINT #1:"8"
PRINT #1:"LAYER1"
PRINT #1:"62"
PRINT #1:"1"
PRINT #1:"10"
PRINT #1:X(0,0)
PRINT #1:"20"
PRINT #1:Y(0,0)
PRINT #1:"30"
PRINT #1:Z(0,0)
PRINT #1:"11"
IF I+1=N THEN PRINT #1:X(1,N) ELSE PRINT #1:X(1,I+1)
PRINT #1:"21"
IF I+1=N THEN PRINT #1:Y(1,N) ELSE PRINT #1:Y(1,I+1)
PRINT #1:"31"
IF I+1=N THEN PRINT #1:Z(1,N) ELSE PRINT #1:Z(1,I+1)
PRINT #1:"12"
PRINT #1:X(1,I)
PRINT #1:"22"
PRINT #1:Y(1,I)
PRINT #1:"32"
PRINT #1:Z(1,I)
NEXT I
FOR I=1 TO N-1
FOR J=1 TO N
PRINT #1:"0"
PRINT #1:"3DFACE"
PRINT #1:"8"
PRINT #1:"LAYER1"
PRINT #1:"62"
PRINT #1:"1"
PRINT #1:"10"
PRINT #1:X(I+1,J)
PRINT #1:"20"
PRINT #1:Y(I+1,J)
PRINT #1:"30"
PRINT #1:Z(I+1,J)
PRINT #1:"11"
PRINT #1:X(I+1,J-1)
PRINT #1:"21"
PRINT #1:Y(I+1,J-1)
PRINT #1:"31"
PRINT #1:Z(I+1,J-1)
PRINT #1:"12"
PRINT #1:X(I,J-1)
PRINT #1:"22"
PRINT #1:Y(I,J-1)
PRINT #1:"32"
PRINT #1:Z(I,J-1)
PRINT #1:"13"
PRINT #1:X(I,J)
PRINT #1:"23"
PRINT #1:Y(I,J)
PRINT #1:"33"
PRINT #1:Z(I,J)
NEXT J
NEXT I
FOR I=0 TO N-1
PRINT #1:"0"
PRINT #1:"3DFACE"
PRINT #1:"8"
PRINT #1:"LAYER1"
PRINT #1:"62"
PRINT #1:"1"
PRINT #1:"10"
PRINT #1:X(N,N)
PRINT #1:"20"
PRINT #1:Y(N,N)
PRINT #1:"30"
PRINT #1:Z(N,N)
PRINT #1:"11"
PRINT #1:X(N-1,I)
PRINT #1:"21"
PRINT #1:Y(N-1,I)
PRINT #1:"31"
PRINT #1:Z(N-1,I)
PRINT #1:"12"
PRINT #1:X(N-1,I+1)
PRINT #1:"22"
PRINT #1:Y(N-1,I+1)
PRINT #1:"32"
PRINT #1:Z(N-1,I+1)
NEXT I
PRINT #1:"0"
PRINT #1:"ENDSEC"
PRINT #1:"0"
PRINT #1:"EOF"
CLOSE #1
END
EXTERNAL FUNCTION FUNC(MODE,TT,SS)
LET T=TT*PI/180
LET S=SS*PI/180
SELECT CASE MODE
CASE 0
LET FUNC=1
CASE 1
LET FUNC=SGN(COS(T))*ABS(COS(T))^.1
CASE 2
LET FUNC=ABS(COS(T))
CASE 3
LET FUNC=T*2
CASE 4
LET FUNC=T^2
CASE 5
LET FUNC=2*SIN(T)
CASE 6
LET FUNC=COS(SQR(T))
CASE 7
LET FUNC=MAX(SIN(T),ABS(COS(T)))
CASE 8
LET FUNC=MAX(SIN(T),ABS(COS(T)^8))
CASE 9
LET FUNC=MIN(SIN(T),ABS(COS(T)))
CASE 10
LET FUNC=0.8+2*SIN(T/2)+SIN(5*S)/5
CASE 11
LET FUNC=3-3*SIN(T/2)+SIN(5*S)/20
CASE 12
LET FUNC=1+(1-COS(2*T))*(1-COS(S))
CASE 13
LET FUNC=ABS(SIN(2*T)*SIN(2*S))
CASE 14
LET FUNC=2+COS(10*S)^2/10+SIN(15*T)^2/10
CASE 15
LET FUNC=2-SGN(COS(T))/5
CASE 16
LET FUNC=SGN(SIN(T)-.995)/1.1+2
CASE 17
LET FUNC=SGN(COS(T)-.975)+3
CASE 18
LET FUNC=5/6*(1-COS(10*T))*(1-COS(8*S))
CASE 19
LET FUNC=1+COS(3*S)
CASE 20
LET FUNC=3-SGN(SIN(10*T)*SIN(10*S))
CASE 21
LET FUNC=3+2*(COS(4*S)*COS(4*T))
CASE 22
LET FUNC=((1+0.5*COS(5*S))*(1-COS(5*S))+.1)*SIN(T)
CASE 23
LET FUNC=MIN(20,MAX(5,SEC(6*T)*SEC(6*S)))
CASE 24
LET FUNC=2*(SIN(5*S)+4)*SIN(T)
CASE 25
LET FUNC=ABS(SIN(5*T)*SIN(5*S))
CASE 26
LET FUNC=ABS(COS(S))
CASE 27
LET FUNC=1+COS(S)*COS(T)
CASE 28
LET FUNC=1+COS(S)
CASE 29
LET FUNC=2+SIN(3*S)*SIN(3*T)*SIN(3*S+3*T)
CASE 30
LET FUNC=2+.5*COS(50*S)*COS(25*T)
CASE 31
LET FUNC=COS(10*S)^2+SIN(15*T)^2
CASE 32
LET FUNC=4+.5*COS(25*S)*COS(50*T)
CASE 33
LET FUNC=ABS(COS(5*S)*COS(5*T))
CASE 34
LET FUNC=3+COS(20*T)/10
CASE 35
LET FUNC=COS(3*S-2*T)
CASE 36
LET FUNC=COS(2*S+3*T)
CASE 37
LET FUNC=3+COS(S*T*3)
CASE 38
LET Z=400-(SS-60*INT((SS+30)/60))^2-(TT-60*INT((TT+30)/60))^2
IF Z>0 THEN
LET FUNC=SQR(Z)+50
ELSE
LET FUNC=50
END IF
CASE 39
LET FUNC=10+S*T*(S^2-T^2)/2
END SELECT
END FUNCTION
|
|