forked from justingardner/gru
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mglProjStencil.m
66 lines (50 loc) · 1.92 KB
/
mglProjStencil.m
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
function stencil = mglProjStencil()
%MGLPROJSTENCIL Generate a mask stencil for the GE projecter @ Stanford
% Builds a stencil based on the input list, which corresponds to the
% visual eccentricity at angles [90, -90, 0, 15, 30, 45, 60, 75, -15, -30, -45, -60, -75]
% use by adding mglStencilSelect(1); and then mglStencilSelect(0); to turn
% off
% This approximates the full screen (needs to be adjusted):
botangs1 = [-15 -30];
botangs2 = [-45 -60 -75];
transEccs = [20./cos(deg2rad(abs(botangs1))) 15./cos(deg2rad(90+botangs2))];
eccArray = [20,15,20,20,20,20,20,20, transEccs];
eccArray = eccArray;
% This is the actual recordings we made for what you can see in the 32
% channel coil:
% eccArray = [5.5, 7.5, 17, 18, 19, 11, 8, 6,14 , 15, 11, 8, 7.5];
stencil = 99;
angles = [90, -90, 0, 15, 30, 45, 60, 75, -15, -30, -45, -60, -75];
angles2 = [180-angles(3:8) angles(9:end)-90];
angles = [angles angles2];
angles = mod(angles-90,360);
eccArray = [eccArray eccArray(3:8) fliplr(eccArray(9:end))];
if length(eccArray) ~= length(angles)
error('Eccentricity array has incorrect length.');
end
mglClearScreen;
mglStencilCreateBegin(stencil);
% we will draw partial disks at every 3 deg angle, and using the linear
% interpolated position based on the eccArray
xs = [];
ys = [];
eccs = [];
sAs = [];
for curBlock = 0:15:345
for withinB = 0:0.5:14.5
xs = [xs 0];
ys = [ys 0];
cSA = curBlock+withinB;
sAs = [sAs cSA];
orig_ang = eccArray(angles==curBlock);
final_ang = eccArray(angles==mod(curBlock+15,360));
interpEcc = (final_ang-orig_ang) * withinB / 15 + orig_ang;
% disp(sprintf('%i: %.03f',curBlock,interpEcc));
eccs = [eccs interpEcc];
end
end
mglGluPartialDisk(xs,ys,zeros(size(xs)),eccs,sAs,ones(size(xs))*2,ones(3,size(xs,2)));
mglGluPartialDisk(xs,ys,zeros(size(xs)),eccs,sAs,-ones(size(xs))*2,ones(3,size(xs,2)));
mglStencilCreateEnd;
mglClearScreen();
end