Stereogram "HI" + STAR
Posted: Fri Apr 21, 2023 11:03 pm
100 REM ****** "HI" + STAR 200 REM *** 210 REM *** CODE ADAPTED FROM 220 REM *** PDF PAPER YOU CAN GOOGLE 94-HWT-SI-IHW-SIRDS 230 REM *** 240 SCREEN128 250 CLS 260 E = 2.5 270 MU = 1/3 280 DPI = 60 290 ES = E * DPI 300 PD = 20 310 C = 128 320 H=240 330 W=240 340 DIM D(W),S(W),P(W) 350 SY = H/PD 360 SX = W/PD 370 FOR Y=0 TO H-SY STEP SY 380 REM *** 390 REM COMPUTE IMAGE ONE HORIZONAL LINE AT A TIME 400 REM *** 410 FOR X=0 TO W-SX STEP SX 420 READ DA 430 FOR I=0 TO SX-1 440 D(X+I) = DA 450 NEXT I 460 NEXT X 470 REM *** 480 REM COMPUTE RESTRAINTS 490 REM *** 500 FOR X = 0 TO W-1 510 S(X) = X 520 NEXT X 530 FOR X = 0 TO W-1 540 DP = D(X) 550 SP = INT( (1 - MU * DP) * ES / (2 - MU * DP) + 0.5) 560 L = INT(X-SP/2) 570 R = L + SP 580 IF L < 0 OR R >= W GOTO 840 590 REM *** 600 REM *** NO CONSTRAINT WHEN NOT VISIBLE IN EITHER EYE 610 REM *** 620 V = 0 630 T = 1 640 ZT = DP + 2 * (2-MU*DP) * T / (MU*ES) 650 V = (D(X-T) < ZT) AND (D(X+T) < ZT) 660 T=T+1 670 REM *** 680 REM *** S() UPDATED GETS CONSTRAINTS 690 REM *** 700 IF V AND (ZT<1) GOTO 640 710 IF NOT V GOTO 840 720 LL = S(L) 730 IF (LL=L) OR (LL=R) GOTO 830 740 IF LL >= R GOTO 780 750 L = LL 760 LL = S(L) 770 GOTO 820 780 S(L) = R 790 L=R 800 LL = S(L) 810 R = LL 820 GOTO 730 830 S(L) = R 840 NEXT X 850 FOR J = 0 TO SY-1 860 REM *** 870 REM *** CREATE P(X) = LINE OF IMAGE 880 REM *** 890 FOR X=W-1 TO 0 STEP -1 900 IF S(X) = X GOTO 930 910 P(X) = P(S(X)) 920 GOTO 940 930 P(X) = C * -1 * (RND(1) > 0.5) 940 NEXT X 950 REM *** 960 REM *** PLOT HORIZONTAL LINE OF IMAGE 970 REM *** 980 FOR X=0 TO W-1 990 PSET X,Y+J, P(X) 1000 NEXT X 1010 NEXT J 1020 NEXT Y 1030 REM 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 1040 REM ======================================= 1050 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 1060 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 1070 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 1080 DATA 0,0,0,1,0,0,1,0,0,1,1,1,0,0,0,0,0,0,0,0 1090 DATA 0,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0 1100 DATA 0,0,0,1,1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0 1110 DATA 0,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0 1120 DATA 0,0,0,1,0,0,1,0,0,1,1,1,0,0,0,0,0,0,0,0 1130 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 1140 DATA 0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0 1150 DATA 0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0 1160 DATA 0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0 1170 DATA 0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0 1180 DATA 0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0 1190 DATA 0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0 1200 DATA 0,0,0,0,0,0,0,1,1,0,1,1,1,0,0,0,0,0,0,0 1210 DATA 0,0,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,0,0,0 1220 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 1230 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 1240 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0