|
46 | 46 | % - There is a huge variety of notation used across the literature, as well as the ordering
|
47 | 47 | % of the direction and moment components in the 6-vector
|
48 | 48 |
|
49 |
| - |
50 |
| -% Copyright (C) 1993-2017, by Peter I. Corke |
| 49 | +% Copyright (C) 1993-2019 Peter I. Corke |
51 | 50 | %
|
52 |
| -% This file is part of The Robotics Toolbox for MATLAB (RTB). |
53 |
| -% |
54 |
| -% RTB is free software: you can redistribute it and/or modify |
55 |
| -% it under the terms of the GNU Lesser General Public License as published by |
56 |
| -% the Free Software Foundation, either version 3 of the License, or |
57 |
| -% (at your option) any later version. |
58 |
| -% |
59 |
| -% RTB is distributed in the hope that it will be useful, |
60 |
| -% but WITHOUT ANY WARRANTY; without even the implied warranty of |
61 |
| -% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
62 |
| -% GNU Lesser General Public License for more details. |
| 51 | +% This file is part of The Spatial Math Toolbox for MATLAB (SMTB). |
63 | 52 | %
|
64 |
| -% You should have received a copy of the GNU Leser General Public License |
65 |
| -% along with RTB. If not, see <http://www.gnu.org/licenses/>. |
| 53 | +% Permission is hereby granted, free of charge, to any person obtaining a copy |
| 54 | +% of this software and associated documentation files (the "Software"), to deal |
| 55 | +% in the Software without restriction, including without limitation the rights |
| 56 | +% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies |
| 57 | +% of the Software, and to permit persons to whom the Software is furnished to do |
| 58 | +% so, subject to the following conditions: |
| 59 | +% |
| 60 | +% The above copyright notice and this permission notice shall be included in all |
| 61 | +% copies or substantial portions of the Software. |
| 62 | +% |
| 63 | +% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 64 | +% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS |
| 65 | +% FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
| 66 | +% COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER |
| 67 | +% IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 68 | +% CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
66 | 69 | %
|
67 |
| -% http://www.petercorke.com |
| 70 | +% https://github.com/petercorke/spatial-math |
68 | 71 |
|
69 | 72 | % NOTES
|
70 | 73 | % working: constructor, origin-distance, plane+volume intersect, plot, .L
|
|
127 | 130 | opt.type = {'points', 'planes', 'Pw', 'wv', 'UQ'};
|
128 | 131 | [opt,args] = tb_optparse(opt, varargin);
|
129 | 132 |
|
130 |
| - assert(length(args) == 2, 'RTB:Plucker:badarg', 'expecting two vectors'); |
| 133 | + assert(length(args) == 2, 'SMTB:Plucker:badarg', 'expecting two vectors'); |
131 | 134 |
|
132 | 135 | % get the two arguments
|
133 | 136 | A = args{1}; A = A(:);
|
|
138 | 141 | % handle various options
|
139 | 142 | switch opt.type
|
140 | 143 | case 'points'
|
141 |
| - assert( isvec(A,3) && isvec(B,3), 'RTB:Plucker:badarg', 'expecting 3-vectors'); |
| 144 | + assert( isvec(A,3) && isvec(B,3), 'SMTB:Plucker:badarg', 'expecting 3-vectors'); |
142 | 145 | % compute direction and moment
|
143 | 146 | pl.w = A - B;
|
144 | 147 | pl.v = cross(A-B, A);
|
145 | 148 | case 'planes'
|
146 |
| - assert( isvec(A,4) && isvec(B,4), 'RTB:Plucker:badarg', 'expecting 4-vectors'); |
| 149 | + assert( isvec(A,4) && isvec(B,4), 'SMTB:Plucker:badarg', 'expecting 4-vectors'); |
147 | 150 | pl.w = cross(A(1:3), B(1:3));
|
148 | 151 | pl.v = B(4)*A(1:3) - A(4)*B(1:3);
|
149 | 152 | case 'wv'
|
150 |
| - assert( isvec(A,3) && isvec(B,3), 'RTB:Plucker:badarg', 'expecting 3-vectors'); |
| 153 | + assert( isvec(A,3) && isvec(B,3), 'SMTB:Plucker:badarg', 'expecting 3-vectors'); |
151 | 154 | pl.w = A;
|
152 | 155 | pl.v = B;
|
153 | 156 | case 'Pw'
|
154 |
| - assert( isvec(A,3) && isvec(B,3), 'RTB:Plucker:badarg', 'expecting 3-vectors'); |
| 157 | + assert( isvec(A,3) && isvec(B,3), 'SMTB:Plucker:badarg', 'expecting 3-vectors'); |
155 | 158 | % pl.P = B;
|
156 | 159 | % pl.Q = A+B;
|
157 | 160 | pl.w = B;
|
158 | 161 | pl.v = cross(pl.w, A);
|
159 | 162 | otherwise
|
160 |
| - error('RTB:Plucker:badarg', 'unknown argument type'); |
| 163 | + error('SMTB:Plucker:badarg', 'unknown argument type'); |
161 | 164 | end
|
162 | 165 | end
|
163 | 166 |
|
|
179 | 182 | % reciprocal product
|
180 | 183 | z = dot(a1.uw, a2.v) + dot(a2.uw, a1.v);
|
181 | 184 | elseif isa(a1, 'Plucker') && isfloat(a2)
|
182 |
| - assert(numrows(a2) == 4, 'RTB:Plucker:badarg', 'must postmultiply by 4xN matrix'); |
| 185 | + assert(numrows(a2) == 4, 'SMTB:Plucker:badarg', 'must postmultiply by 4xN matrix'); |
183 | 186 | z = a1.skew * a2; % postmultiply by 4xN
|
184 | 187 | elseif isfloat(a1) && isa(a2, 'Plucker')
|
185 | 188 | if numcols(a1) == 4
|
186 | 189 | z = a1 * a2.skew; % premultiply by Nx4
|
187 | 190 | elseif all(size(a1) == [6 6])
|
188 | 191 | z = Plucker( a1 * double(a2) ); % premultiply by 6x6 adjoint
|
189 | 192 | else
|
190 |
| - error('RTB:Plucker:badarg', 'must premultiply by Nx4 matrix'); |
| 193 | + error('SMTB:Plucker:badarg', 'must premultiply by Nx4 matrix'); |
191 | 194 | end
|
192 | 195 | end
|
193 | 196 | end
|
|
241 | 244 | end
|
242 | 245 |
|
243 | 246 | function z = L(pl)
|
244 |
| - warning('RTB:Plucker', 'deprecated: please use skew() method instead'); |
| 247 | + warning('SMTB:Plucker', 'deprecated: please use skew() method instead'); |
245 | 248 | z = pl.skew();
|
246 | 249 | end
|
247 | 250 |
|
|
278 | 281 | %
|
279 | 282 | % PL.contains(X) is true if the point X (3x1) lies on the line defined by
|
280 | 283 | % the Plucker object PL.
|
281 |
| - assert( size(x,1) == 3, 'RTB:Plucker: points must have 3 rows'); |
| 284 | + assert( size(x,1) == 3, 'SMTB:Plucker: points must have 3 rows'); |
282 | 285 | t = zeros(1, size(x,2), 'logical');
|
283 | 286 | for i=1:size(x,2)
|
284 | 287 | t(i) = norm( cross(x(:,i) - pl.pp, pl.w) ) < 10*eps;
|
@@ -593,7 +596,7 @@ function plot(lines, varargin)
|
593 | 596 | P = pl.intersect_volume(bounds);
|
594 | 597 |
|
595 | 598 | if isempty(P)
|
596 |
| - warning('RTB:Plucker', 'line does not intersect the plot volume'); |
| 599 | + warning('SMTB:Plucker', 'line does not intersect the plot volume'); |
597 | 600 | else
|
598 | 601 | plot3(P(1,:), P(2,:), P(3,:), varargin{:});
|
599 | 602 | end
|
@@ -660,7 +663,7 @@ function disp(pl)
|
660 | 663 | % % See also Plucker.or.
|
661 | 664 | %
|
662 | 665 | % if ~isa(pl2, 'Plucker')
|
663 |
| -% error('RTB:Plucker:badarg', 'both arguments to | must be Plucker objects'); |
| 666 | +% error('SMTB:Plucker:badarg', 'both arguments to | must be Plucker objects'); |
664 | 667 | % end
|
665 | 668 | % L1 = pl1.line(); L2 = pl2.line();
|
666 | 669 | %
|
|
0 commit comments