-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot_amp.m
76 lines (62 loc) · 1.88 KB
/
plot_amp.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
66
67
68
69
70
71
72
73
74
75
76
function plot_amp(S, scheme, S_sd)
% function plot_amp(S, scheme, transparency)
%
% Plot amplitudes 'S' for the set of directions given
% in 'scheme', with optional colour and transparency
% specified.
colour_S = [ 1 1 0 ];
negcolour = [ 1 1 1 ];
transparency_S = 1;
colour_S_sd = [ 1 1 1 ];
transparency_S_sd = 0.4;
range = 1.5*max(S);
cla
set(gca, 'Color', [1 1 1], ...
'CameraViewAngleMode', 'manual', ...
'CameraViewAngle', 20, ...
'CameraTarget', [ 0 0 0 ], ...
'CameraPosition', 6*range*[0 0 1], ...
'Visible', 'on', ...
'Box', 'on', ...
'XLim', [ -range range ], ...
'YLim', [ -range range ], ...
'ZLim', [ -range range ]);
S2 = -S;
k = find(S<0);
k2 = find(S>=0);
S(k) = 0;
S2(k2) = 0;
V = scheme.vert .* (S*[ 1 1 1 ]);
V2 = scheme.vert .* (S2*[ 1 1 1 ]);
h = patch('Vertices', V, 'Faces', scheme.mesh);
set(h, 'LineStyle', 'None', ...
'FaceLighting', 'Phong', ...
'SpecularStrength', 0.6, ...
'FaceColor', colour_S, ...
'FaceAlpha', transparency_S);
h2 = patch('Vertices', V2, 'Faces', scheme.mesh);
set(h2, 'LineStyle', 'None', ...
'FaceLighting', 'Phong', ...
'SpecularStrength', 0.6, ...
'FaceColor', negcolour, ...
'FaceAlpha', transparency_S);
if exist('S_sd')
S(k2) = S(k2) + 2*S_sd(k2);
S2(k) = S2(k) - 2*S_sd(k);
V = scheme.vert .* (S*[ 1 1 1 ]);
V2 = scheme.vert .* (S2*[ 1 1 1 ]);
h = patch('Vertices', V, 'Faces', scheme.mesh);
set(h, 'LineStyle', 'None', ...
'FaceLighting', 'Phong', ...
'SpecularStrength', 0.6, ...
'FaceColor', colour_S_sd, ...
'FaceAlpha', transparency_S_sd);
h2 = patch('Vertices', V2, 'Faces', scheme.mesh);
set(h2, 'LineStyle', 'None', ...
'FaceLighting', 'Phong', ...
'SpecularStrength', 0.6, ...
'FaceColor', colour_S_sd, ...
'FaceAlpha', transparency_S_sd);
end
light('position', [0 1 1]);
%drawnow