Mercurial > hg > octave-nkf
annotate scripts/plot/view.m @ 8710:739141cde75a ss-3-1-52
fix typo in Array-f.cc
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Mon, 09 Feb 2009 21:51:31 +0100 |
parents | a626db2e8a1c |
children | eb63fbe60fab |
rev | line source |
---|---|
6257 | 1 ## Copyright (C) 2007 John W. Eaton |
2 ## | |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7016 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
6257 | 9 ## |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
6257 | 18 |
19 ## -*- texinfo -*- | |
20 ## @deftypefn {Function File} {} view (@var{azimuth}, @var{elevation}) | |
21 ## @deftypefnx {Function File} {} view (@var{dims}) | |
22 ## @deftypefnx {Function File} {[@var{azimuth}, @var{elevation}] =} view () | |
23 ## Set or get the viewpoint for the current axes. | |
24 ## @end deftypefn | |
25 | |
26 ## Author: jwe | |
27 | |
28 function [azimuth, elevation] = view (x, y, z) | |
29 | |
30 if (nargin < 4) | |
7712
a626db2e8a1c
view: get values from current axes if nargin == 0
John W. Eaton <jwe@octave.org>
parents:
7016
diff
changeset
|
31 if (nargin == 0) |
a626db2e8a1c
view: get values from current axes if nargin == 0
John W. Eaton <jwe@octave.org>
parents:
7016
diff
changeset
|
32 tmp = get (gca (), "view"); |
a626db2e8a1c
view: get values from current axes if nargin == 0
John W. Eaton <jwe@octave.org>
parents:
7016
diff
changeset
|
33 az = tmp(1); |
a626db2e8a1c
view: get values from current axes if nargin == 0
John W. Eaton <jwe@octave.org>
parents:
7016
diff
changeset
|
34 el = tmp(2); |
a626db2e8a1c
view: get values from current axes if nargin == 0
John W. Eaton <jwe@octave.org>
parents:
7016
diff
changeset
|
35 elseif (nargin == 1) |
6257 | 36 if (x == 2) |
37 az = 0; | |
38 el = 90; | |
39 elseif (x == 3) | |
40 az = -37.5; | |
41 el = 30; | |
42 else | |
43 error ("view: expecting single argument to be 2 or 3"); | |
44 endif | |
45 elseif (nargin == 2) | |
46 az = x; | |
47 el = y; | |
48 elseif (nargin == 3) | |
49 error ("view: view (x, y, z) not implemented"); | |
50 endif | |
51 | |
52 if (nargin > 0) | |
53 set (gca (), "view", [az, el]); | |
54 endif | |
55 | |
56 if (nargout == 1) | |
57 error ("view: T = view () not implemented"); | |
58 endif | |
59 | |
60 if (nargout == 2) | |
61 azimuth = az; | |
62 elevation = el; | |
63 endif | |
64 else | |
65 print_usage (); | |
66 endif | |
67 | |
68 endfunction |