|
1 | 1 | function obj = updateStreamtube(obj, surfaceIndex) |
2 | | -if strcmpi(obj.State.Plot(surfaceIndex).Class, 'surface') |
| 2 | + if strcmpi(obj.State.Plot(surfaceIndex).Class, 'surface') |
3 | 3 | updateSurfaceStreamtube(obj, surfaceIndex) |
4 | | -end |
| 4 | + end |
5 | 5 | end |
6 | 6 |
|
7 | 7 | function updateSurfaceStreamtube(obj, surfaceIndex) |
@@ -38,28 +38,45 @@ function updateSurfaceStreamtube(obj, surfaceIndex) |
38 | 38 |
|
39 | 39 | %---------------------------------------------------------------------% |
40 | 40 |
|
41 | | -%-format x an y data-% |
42 | | -ymax = 100; |
| 41 | +%-getting plot data-% |
43 | 42 | x = image_data.XData; |
44 | 43 | y = image_data.YData; |
45 | 44 | z = image_data.ZData; |
46 | 45 | cdata = image_data.CData; |
47 | 46 |
|
48 | | -ysize = size(x,1); |
49 | | -xsize = size(x,2); |
| 47 | +%-playing with level quality-% |
| 48 | +quality = obj.PlotOptions.Quality/100; |
| 49 | +apply_quality = quality > 0; |
50 | 50 |
|
51 | | -if ysize > ymax |
52 | | - ystep = round(ysize/ymax); |
53 | | - x = x(1:ystep:end, :); |
54 | | - y = y(1:ystep:end, :); |
55 | | - z = z(1:ystep:end, :); |
56 | | - cdata = cdata(1:ystep:end, :); |
57 | | -end |
| 51 | +if apply_quality |
| 52 | + x = imresize(x, quality); |
| 53 | + y = imresize(y, quality); |
| 54 | + z = imresize(z, quality); |
| 55 | + cdata = imresize(cdata, quality); |
| 56 | +end |
58 | 57 |
|
59 | | -if isvector(x) |
60 | | - [x, y] = meshgrid(x,y); |
| 58 | +if ~isempty(obj.PlotOptions.Zmin) |
| 59 | + if any(z < obj.PlotOptions.Zmin) |
| 60 | + return; |
| 61 | + end |
61 | 62 | end |
62 | 63 |
|
| 64 | +xymax = 100; |
| 65 | +xsize = size(x,2); |
| 66 | +ysize = size(x,1); |
| 67 | + |
| 68 | +xsize = min([xsize, xymax]); |
| 69 | +ysize = min([ysize, xymax]); |
| 70 | +x = imresize(x, [ysize, xsize]); |
| 71 | +y = imresize(y, [ysize, xsize]); |
| 72 | +z = imresize(z, [ysize, xsize]); |
| 73 | +cdata = imresize(cdata, [ysize, xsize]); |
| 74 | + |
| 75 | +%-optional-% |
| 76 | +% if isvector(x) |
| 77 | +% [x, y] = meshgrid(x,y); |
| 78 | +% end |
| 79 | + |
63 | 80 | %---------------------------------------------------------------------% |
64 | 81 |
|
65 | 82 | %-surface x-% |
@@ -105,6 +122,59 @@ function updateSurfaceStreamtube(obj, surfaceIndex) |
105 | 122 | obj.data{surfaceIndex}.contours.y.show = true; |
106 | 123 | obj.data{surfaceIndex}.contours.y.color = 'black'; |
107 | 124 |
|
| 125 | +%------------------------------------------------------------------------% |
| 126 | + |
| 127 | +%-get data-% |
| 128 | + |
| 129 | +%-aspect ratio-% |
| 130 | +ar = obj.PlotOptions.AspectRatio; |
| 131 | + |
| 132 | +if ~isempty(ar) |
| 133 | + if ischar(ar) |
| 134 | + scene.aspectmode = ar; |
| 135 | + elseif isvector(ar) && length(ar) == 3 |
| 136 | + xar = ar(1); |
| 137 | + yar = ar(2); |
| 138 | + zar = ar(3); |
| 139 | + end |
| 140 | + else |
| 141 | + |
| 142 | + %-define as default-% |
| 143 | + xar = 0.5*max(x(:)); |
| 144 | + yar = 0.5*max(y(:)); |
| 145 | + zar = 0.4*max([xar, yar]); |
| 146 | +end |
| 147 | + |
| 148 | +scene.aspectratio.x = xar; |
| 149 | +scene.aspectratio.y = yar; |
| 150 | +scene.aspectratio.z = zar; |
| 151 | + |
| 152 | +%---------------------------------------------------------------------% |
| 153 | + |
| 154 | +%-camera eye-% |
| 155 | +ey = obj.PlotOptions.CameraEye; |
| 156 | + |
| 157 | +if ~isempty(ey) |
| 158 | +if isvector(ey) && length(ey) == 3 |
| 159 | + scene.camera.eye.x = ey(1); |
| 160 | + scene.camera.eye.y = ey(2); |
| 161 | + scene.camera.eye.z = ey(3); |
| 162 | +end |
| 163 | +else |
| 164 | + |
| 165 | +%-define as default-% |
| 166 | +fac = 0.35; |
| 167 | +xey = - xar; if xey>0 xfac = -fac; else xfac = fac; end |
| 168 | +yey = - yar; if yey>0 yfac = -fac; else yfac = fac; end |
| 169 | +if zar>0 zfac = fac; else zfac = -fac; end |
| 170 | + |
| 171 | +scene.camera.eye.x = xey + xfac*xey; |
| 172 | +scene.camera.eye.y = yey + yfac*yey; |
| 173 | +scene.camera.eye.z = zar + zfac*zar; |
| 174 | +end |
| 175 | + |
| 176 | +obj.layout = setfield(obj.layout,['scene'], scene); |
| 177 | + |
108 | 178 | %-------------------------------------------------------------------------% |
109 | 179 |
|
110 | 180 | %-image colorscale-% |
|
0 commit comments