|
!'写像変換テスト
LET XSIZE=600
LET YSIZE=600
LET XH=XSIZE/2
LET YH=YSIZE/2
CALL GINIT(XSIZE,YSIZE)
LET N=8
FOR Y=0 TO YSIZE-1 STEP N !'せん断変換
LET YS=Y-YH
FOR X=0 TO XSIZE-1 STEP N
LET XS=X-XH
LET XX=XS+TAN(RAD(10))*YS
LET YY=YS+TAN(RAD(20))*XS
LET C=7
IF MOD(Y,3*N)=0 THEN LET C=2
IF MOD(X,3*N)=0 THEN LET C=4
CALL PSET(XX+XH,YY+YH,C)
NEXT X
NEXT Y
INPUT A$ !'一時停止
CLEAR
LET A=XSIZE/2
FOR Y=0 TO YSIZE-1 STEP N !'正方形変換
LET YS=Y-YH
FOR X=0 TO XSIZE-1 STEP N
LET XS=X-XH
LET XX=A*(XS/A)^2*SGN(XS)
LET YY=A*(YS/A)^2*SGN(YS)
LET C=7
IF MOD(Y,3*N)=0 THEN LET C=2
IF MOD(X,3*N)=0 THEN LET C=4
CALL PSET(XX+XH,YY+YH,C)
NEXT X
NEXT Y
INPUT A$
CLEAR
LET A=1/XSIZE
FOR Y=0 TO YSIZE-1 STEP N !'放物変換
LET YS=Y-YH
FOR X=0 TO XSIZE-1 STEP N
LET XS=X-XH
LET XX=XS+A*YS^2
LET YY=YS
LET C=7
IF MOD(Y,3*N)=0 THEN LET C=2
IF MOD(X,3*N)=0 THEN LET C=4
CALL PSET(XX+XH,YY+YH,C)
NEXT X
NEXT Y
INPUT A$
CLEAR
LET A=1/XSIZE
FOR Y=0 TO YSIZE-1 STEP N !'放物変換
LET YS=Y-YH
FOR X=0 TO XSIZE-1 STEP N
LET XS=X-XH
LET XX=XS+A*YS^2
LET YY=YS+A*XS^2
LET C=7
IF MOD(Y,3*N)=0 THEN LET C=2
IF MOD(X,3*N)=0 THEN LET C=4
CALL PSET(XX+XH,YY+YH,C)
NEXT X
NEXT Y
INPUT A$
CLEAR
LET A=XSIZE/8
FOR Y=0 TO YSIZE STEP N !'双曲変換
LET YS=Y-YH
FOR X=0 TO XSIZE-1 STEP N
LET XS=X-XH
LET XX=XS/(A+ABS(YS))*A
LET YY=YS/(A+ABS(XS))*A
LET C=7
IF MOD(Y,3*N)=0 THEN LET C=2
IF MOD(X,3*N)=0 THEN LET C=4
CALL PSET(XX+XH,YY+YH,C)
NEXT X
NEXT Y
INPUT A$
CLEAR
LET L=XSIZE
LET T=40
FOR Y=0 TO YSIZE-1 STEP N !'射影変換
LET YS=Y-YH
FOR X=0 TO XSIZE-1 STEP N
LET XS=X-XH
LET XX=L*XS/(L-YS*SIN(RAD(T)))
LET YY=L*YS*COS(RAD(T))/(L-YS*SIN(RAD(T)))
LET C=7
IF MOD(Y,3*N)=0 THEN LET C=2
IF MOD(X,3*N)=0 THEN LET C=4
CALL PSET(XX+XH,YY+YH,C)
NEXT X
NEXT Y
INPUT A$
CLEAR
LET L=XSIZE
LET T=60
FOR Y=0 TO YSIZE-1 STEP N !'三角形変換
LET YS=Y-YH
FOR X=0 TO XSIZE-1 STEP N
LET XS=X-XH
LET XX=2*TAN(RAD(T/2))*XS*(YS+YH)/L
LET YY=YS
LET C=7
IF MOD(Y,3*N)=0 THEN LET C=2
IF MOD(X,3*N)=0 THEN LET C=4
CALL PSET(XX+XH,YY+YH,C)
NEXT X
NEXT Y
INPUT A$
CLEAR
LET A=5
LET B=5
FOR Y=0 TO YSIZE-1 STEP N !'波形変換
LET YS=Y-YH
FOR X=0 TO XSIZE-1 STEP N
LET XS=X-XH
LET XX=XS+A*SIN(RAD(B*YS))
LET YY=YS+A*SIN(RAD(B*XS))
LET C=7
IF MOD(Y,3*N)=0 THEN LET C=2
IF MOD(X,3*N)=0 THEN LET C=4
CALL PSET(XX+XH,YY+YH,C)
NEXT X
NEXT Y
INPUT A$
CLEAR
LET R=XSIZE/2
FOR Y=0 TO YSIZE-1 STEP N !'球面反射変換
LET YS=Y-YH
FOR X=0 TO XSIZE-1 STEP N
LET XS=X-XH
IF XS^2+YS^2<R^2 THEN
LET Z=(2*R*R)/(XS^2+YS^2+R*R)
LET XX=XS*Z
LET YY=YS*Z
ELSE
LET XX=XS
LET YY=YS
END IF
LET C=7
IF MOD(Y,3*N)=0 THEN LET C=2
IF MOD(X,3*N)=0 THEN LET C=4
CALL PSET(XX+XH,YY+YH,C)
NEXT X
NEXT Y
END
EXTERNAL SUB PSET(X,Y,C)
SET POINT COLOR C
PLOT POINTS:X,Y
END SUB
EXTERNAL SUB GINIT(XSIZE,YSIZE)
SET BITMAP SIZE XSIZE,YSIZE
SET WINDOW 0,XSIZE-1,YSIZE-1,0
SET POINT STYLE 1
SET COLOR MIX(0) 0,0,0
SET COLOR MIX(1) 0,0,1
SET COLOR MIX(2) 1,0,0
SET COLOR MIX(3) 1,0,1
SET COLOR MIX(4) 0,1,0
SET COLOR MIX(5) 0,1,1
SET COLOR MIX(6) 1,1,0
SET COLOR MIX(7) 1,1,1
CLEAR
END SUB
|
|