1
# random dot steraogram
2
# usage: rcs.rb rcs.dat
4
sw = 40.0 # width of original pattern
5
dw = 78.0 # width of generating Random Character Streogram
7
w = 20.0 # distance between eyes
8
h =1.0 # distance from screen and base plane
10
ss="abcdefghijklmnopqrstuvwxyz0123456789#!$%^&*()-=\\[];'`,./"
11
rnd = srand() # You don't actually need this in ruby - srand() is called
12
# on the first call of rand().
16
xr = -hdw; y = h * 1.0; maxxl = -999
19
x = xr * (1 + y) - y * w / 2
20
i = (x / (1 + h) + sw / 2)
21
if (1 < i && i < $_.length)
27
xl = xr - w * y / (1 + y)
28
if xl < -hdw || xl >= hdw || xl <= maxxl