time | Calls | line |
---|
| | 113 | function ViewCore(hAxes, arg1, arg2)
|
| | 114 |
|
0.003 | 2 | 115 | matlab.graphics.internal.markFigure(hAxes);
|
| | 116 |
|
< 0.001 | 2 | 117 | azIn = [];
|
< 0.001 | 2 | 118 | elIn = [];
|
| | 119 |
|
< 0.001 | 2 | 120 | switch (nargin)
|
| | 121 |
|
| | 122 | %
|
| | 123 | %--------------------------------------------------------
|
| | 124 | % 2 arg - cases are:
|
| | 125 | % view(hAxes, 2)
|
| | 126 | % view(hAxes, 3)
|
| | 127 | % view(hAxes, [az, el])
|
| | 128 | % view(hAxes, [x y z])
|
| | 129 | %
|
< 0.001 | 2 | 130 | case 2
|
< 0.001 | 2 | 131 | [r, c] = size(arg1);
|
< 0.001 | 2 | 132 | if (r == 1) && (c == 1)
|
| | 133 | %
|
| | 134 | % view(2) or view(3)
|
| | 135 | %
|
< 0.001 | 2 | 136 | switch arg1
|
< 0.001 | 2 | 137 | case 2
|
| | 138 | azIn = 0;
|
| | 139 | elIn = 90;
|
| | 140 | if hasCameraProperties(handle(hAxes))
|
| | 141 | if ~strcmpi(get(hAxes,'CameraUpVectorMode'),'auto')
|
| | 142 | if strcmpi(get(hAxes,'YDir'),'normal')
|
| | 143 | set(hAxes,'CameraUpVector',[0 1 0]);
|
| | 144 | else
|
| | 145 | set(hAxes,'CameraUpVector',[0 -1 0]);
|
| | 146 | end
|
| | 147 | end
|
| | 148 | end
|
| | 149 |
|
< 0.001 | 2 | 150 | case 3
|
< 0.001 | 2 | 151 | azIn = -37.5;
|
< 0.001 | 2 | 152 | elIn = 30;
|
< 0.001 | 2 | 153 | if hasCameraProperties(handle(hAxes)) && ~strcmpi(get(hAxes,'CameraUpVectorMode'),'auto')
|
| | 154 | set(hAxes,'CameraUpVector',[0 0 1]);
|
< 0.001 | 2 | 155 | end
|
| | 156 |
|
| | 157 | otherwise
|
| | 158 | error(message('MATLAB:view:InvalidScalarArgument'));
|
< 0.001 | 2 | 159 | end
|
| | 160 | elseif (r == 1) && (c == 2)
|
| | 161 | %
|
| | 162 | % view([az, el]
|
| | 163 | %
|
| | 164 | azIn = arg1(1);
|
| | 165 | elIn = arg1(2);
|
| | 166 | elseif r*c == 3
|
| | 167 | %
|
| | 168 | % view([x, y, z])
|
| | 169 | %
|
| | 170 | unit = arg1/norm(arg1);
|
| | 171 | azIn = atan2(unit(1),-unit(2))*180/pi;
|
| | 172 | elIn = atan2(unit(3),sqrt(unit(1)^2+unit(2)^2))*180/pi;
|
| | 173 | else
|
| | 174 | error(message('MATLAB:view:InvalidArgument'));
|
< 0.001 | 2 | 175 | end
|
| | 176 |
|
| | 177 | %
|
| | 178 | %--------------------------------------------------------
|
| | 179 | % 3 args - cases are
|
| | 180 | % view(hAxes, az, el)
|
| | 181 | %
|
| | 182 | case 3
|
| | 183 | if (length(arg1) == 1) && (length(arg2) == 1)
|
| | 184 | azIn = arg1;
|
| | 185 | elIn = arg2;
|
| | 186 | else
|
| | 187 | error(message('MATLAB:view:InvalidArgumentType'))
|
| | 188 |
|
| | 189 | end
|
| | 190 |
|
< 0.001 | 2 | 191 | end
|
| | 192 |
|
| | 193 | % there is one case at this point:
|
| | 194 | % The azimuth and elevation are defined
|
| | 195 |
|
< 0.001 | 2 | 196 | if ~isempty(azIn) && ~isempty(elIn)
|
< 0.001 | 2 | 197 | set(hAxes, 'View', [azIn, elIn]);
|
< 0.001 | 2 | 198 | end
|
Other subfunctions in this file are not included in this listing.