Mercurial > hg > octave-nkf
annotate scripts/general/pol2cart.m @ 20305:c164cfc24bdd
QtHandles: add annotations dialog
* libgui/graphics/annotation-dialog.h: new file
* libgui/graphics/annotation-dialog.cc: new file
* libgui/graphics/annotation-dialog.ui: new file
* libgui/graphics/Canvas.cc
(canvasMousePressEvent): call annotation_dialog when in TextMode.
* libgui/graphics/module.mk: add annotation-dialog to build
author | John Donoghue <john.donoghue@ieee.org> |
---|---|
date | Sun, 19 Apr 2015 09:54:54 -0400 |
parents | 4197fc428c7d |
children | 7503499a252b |
rev | line source |
---|---|
19898
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
1 ## Copyright (C) 2000-2015 Kai Habel |
3803 | 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. | |
3803 | 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/>. | |
3803 | 18 |
19 ## -*- texinfo -*- | |
10688
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
20 ## @deftypefn {Function File} {[@var{x}, @var{y}] =} pol2cart (@var{theta}, @var{r}) |
5610 | 21 ## @deftypefnx {Function File} {[@var{x}, @var{y}, @var{z}] =} pol2cart (@var{theta}, @var{r}, @var{z}) |
17585
36b9fa789d8e
Overhaul polar, spherical, cartesian conversion routiens when nargout == 1.
Rik <rik@octave.org>
parents:
17584
diff
changeset
|
22 ## @deftypefnx {Function File} {[@var{x}, @var{y}] =} pol2cart (@var{P}) |
36b9fa789d8e
Overhaul polar, spherical, cartesian conversion routiens when nargout == 1.
Rik <rik@octave.org>
parents:
17584
diff
changeset
|
23 ## @deftypefnx {Function File} {[@var{x}, @var{y}, @var{z}] =} pol2cart (@var{P}) |
10688
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
24 ## @deftypefnx {Function File} {@var{C} =} pol2cart (@dots{}) |
9168
742cf6388a8f
Update section 17.7 (Coordinate Transformations) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
25 ## Transform polar or cylindrical to Cartesian coordinates. |
10688
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
26 ## |
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
27 ## @var{theta}, @var{r}, (and @var{z}) must be the same shape, or scalar. |
9168
742cf6388a8f
Update section 17.7 (Coordinate Transformations) of arith.txi
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
28 ## @var{theta} describes the angle relative to the positive x-axis. |
8491
aaff46fef256
[docs] fix hypenation: x - axis => x-axis, etc
Brian Gough <bjg@gnu.org>
parents:
7017
diff
changeset
|
29 ## @var{r} is the distance to the z-axis (0, 0, z). |
17585
36b9fa789d8e
Overhaul polar, spherical, cartesian conversion routiens when nargout == 1.
Rik <rik@octave.org>
parents:
17584
diff
changeset
|
30 ## If called with a single matrix argument then each row of @var{P} |
17584
6278085742b7
pol2cart.m: Fix bug with z-input and only 1 output (bug #40184)
Rik <rik@octave.org>
parents:
16968
diff
changeset
|
31 ## represents the polar/(cylindrical) coordinate (@var{theta}, @var{r} (, |
6278085742b7
pol2cart.m: Fix bug with z-input and only 1 output (bug #40184)
Rik <rik@octave.org>
parents:
16968
diff
changeset
|
32 ## @var{z})). |
10688
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
33 ## |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
34 ## If only a single return argument is requested then return a matrix |
10688
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
35 ## @var{C} where each row represents one Cartesian coordinate |
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
36 ## (@var{x}, @var{y} (, @var{z})). |
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
37 ## @seealso{cart2pol, sph2cart, cart2sph} |
3803 | 38 ## @end deftypefn |
39 | |
40 ## Author: Kai Habel <kai.habel@gmx.de> | |
41 ## Adapted-by: jwe | |
42 | |
17584
6278085742b7
pol2cart.m: Fix bug with z-input and only 1 output (bug #40184)
Rik <rik@octave.org>
parents:
16968
diff
changeset
|
43 function [x, y, z] = pol2cart (theta, r, z = []) |
3803 | 44 |
10688
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
45 if (nargin < 1 || nargin > 3) |
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
46 print_usage (); |
3803 | 47 endif |
48 | |
10688
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
49 if (nargin == 1) |
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
50 if (ismatrix (theta) && (columns (theta) == 2 || columns (theta) == 3)) |
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
51 if (columns (theta) == 3) |
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
52 z = theta(:,3); |
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
53 endif |
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
54 r = theta(:,2); |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
55 theta = theta(:,1); |
10688
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
56 else |
16968
e424cdb2ef96
pol2cart.m: Correct typo in error() message.
Rik <rik@octave.org>
parents:
14363
diff
changeset
|
57 error ("pol2cart: matrix input must have 2 or 3 columns [THETA, R (, Z)]"); |
10688
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
58 endif |
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
59 elseif (nargin == 2) |
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
60 if (! ((ismatrix (theta) && ismatrix (r)) |
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
61 && (size_equal (theta, r) || isscalar (theta) || isscalar (r)))) |
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
62 error ("pol2cart: arguments must be matrices of same size, or scalar"); |
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
63 endif |
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
64 elseif (nargin == 3) |
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
65 if (! ((ismatrix (theta) && ismatrix (r) && ismatrix (z)) |
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
66 && (size_equal (theta, r) || isscalar (theta) || isscalar (r)) |
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
67 && (size_equal (theta, z) || isscalar (theta) || isscalar (z)) |
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
68 && (size_equal (r, z) || isscalar (r) || isscalar (z)))) |
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
69 error ("pol2cart: arguments must be matrices of same size, or scalar"); |
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
70 endif |
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
71 endif |
8533
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
72 |
10688
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
73 x = r .* cos (theta); |
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
74 y = r .* sin (theta); |
8533
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
75 |
10688
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
76 if (nargout <= 1) |
17584
6278085742b7
pol2cart.m: Fix bug with z-input and only 1 output (bug #40184)
Rik <rik@octave.org>
parents:
16968
diff
changeset
|
77 x = [x(:), y(:), z(:)]; |
3803 | 78 endif |
79 | |
8533
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
80 endfunction |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
81 |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
82 |
8533
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
83 %!test |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
84 %! t = [0, 0.5, 1] * pi; |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
85 %! r = 1; |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
86 %! [x, y] = pol2cart (t, r); |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
87 %! assert (x, [1, 0, -1], sqrt (eps)); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
88 %! assert (y, [0, 1, 0], sqrt (eps)); |
8533
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
89 |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
90 %!test |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
91 %! t = [0, 1, 1] * pi/4; |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
92 %! r = sqrt (2) * [0, 1, 2]; |
17585
36b9fa789d8e
Overhaul polar, spherical, cartesian conversion routiens when nargout == 1.
Rik <rik@octave.org>
parents:
17584
diff
changeset
|
93 %! C = pol2cart (t, r); |
36b9fa789d8e
Overhaul polar, spherical, cartesian conversion routiens when nargout == 1.
Rik <rik@octave.org>
parents:
17584
diff
changeset
|
94 %! assert (C(:,1), [0; 1; 2], sqrt (eps)); |
36b9fa789d8e
Overhaul polar, spherical, cartesian conversion routiens when nargout == 1.
Rik <rik@octave.org>
parents:
17584
diff
changeset
|
95 %! assert (C(:,2), [0; 1; 2], sqrt (eps)); |
8533
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
96 |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
97 %!test |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
98 %! t = [0, 1, 1] * pi/4; |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
99 %! r = sqrt (2) * [0, 1, 2]; |
8533
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
100 %! z = [0, 1, 2]; |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
101 %! [x, y, z2] = pol2cart (t, r, z); |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
102 %! assert (x, [0, 1, 2], sqrt (eps)); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
103 %! assert (y, [0, 1, 2], sqrt (eps)); |
8533
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
104 %! assert (z, z2); |
3803 | 105 |
8533
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
106 %!test |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
107 %! t = 0; |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
108 %! r = [0, 1, 2]; |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
109 %! z = [0, 1, 2]; |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
110 %! [x, y, z2] = pol2cart (t, r, z); |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
111 %! assert (x, [0, 1, 2], sqrt (eps)); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
112 %! assert (y, [0, 0, 0], sqrt (eps)); |
8533
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
113 %! assert (z, z2); |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
114 |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
115 %!test |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
116 %! t = [1, 1, 1]*pi/4; |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
117 %! r = 1; |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
118 %! z = [0, 1, 2]; |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
119 %! [x, y, z2] = pol2cart (t, r, z); |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
120 %! assert (x, [1, 1, 1] / sqrt (2), eps); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
121 %! assert (y, [1, 1, 1] / sqrt (2), eps); |
8533
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
122 %! assert (z, z2); |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
123 |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
124 %!test |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
125 %! t = 0; |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
126 %! r = [1, 2, 3]; |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
127 %! z = 1; |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
128 %! [x, y, z2] = pol2cart (t, r, z); |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
129 %! assert (x, [1, 2, 3], eps); |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
130 %! assert (y, [0, 0, 0] / sqrt (2), eps); |
8533
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
131 %! assert (z, z2); |
fb1b87ea4af9
Permit scalars when transforming coordinates.
Ben Abbott <bpabbott@mac.com>
parents:
8507
diff
changeset
|
132 |
10688
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
133 %!test |
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
134 %! P = [0, 0; pi/4, sqrt(2); pi/4, 2*sqrt(2)]; |
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
135 %! C = [0, 0; 1, 1; 2, 2]; |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
136 %! assert (pol2cart (P), C, sqrt (eps)); |
10688
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
137 |
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
138 %!test |
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
139 %! P = [0, 0, 0; pi/4, sqrt(2), 1; pi/4, 2*sqrt(2), 2]; |
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
140 %! C = [0, 0, 0; 1, 1, 1; 2, 2, 2]; |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
141 %! assert (pol2cart (P), C, sqrt (eps)); |
10688
7357e37f34fa
coordinate transforms: add option to operate on column matrix of coordinates.
Rik <octave@nomad.inbox5.com>
parents:
9168
diff
changeset
|
142 |