MRDIVIDE Compute quaternion quotient. Invoked on the / operator, handle two cases: q1/q2 multiply one quaternion by inverse of the second. q1/s result is non-unit quaternion, all elements divided by s
0001 %MRDIVIDE Compute quaternion quotient. 0002 % 0003 % Invoked on the / operator, handle two cases: 0004 % q1/q2 multiply one quaternion by inverse of the second. 0005 % q1/s result is non-unit quaternion, all elements divided by s 0006 0007 % Copyright (C) 1999-2008, by Peter I. Corke 0008 % 0009 % This file is part of The Robotics Toolbox for Matlab (RTB). 0010 % 0011 % RTB is free software: you can redistribute it and/or modify 0012 % it under the terms of the GNU Lesser General Public License as published by 0013 % the Free Software Foundation, either version 3 of the License, or 0014 % (at your option) any later version. 0015 % 0016 % RTB is distributed in the hope that it will be useful, 0017 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0018 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0019 % GNU Lesser General Public License for more details. 0020 % 0021 % You should have received a copy of the GNU Leser General Public License 0022 % along with RTB. If not, see <http://www.gnu.org/licenses/>. 0023 0024 function qq = mrdivide(q1, q2) 0025 0026 if isa(q2, 'quaternion'), 0027 % qq = q1 / q2 0028 % = q1 * qinv(q2) 0029 0030 qq = q1 * inv(q2); 0031 elseif isa(q2, 'double'), 0032 qq = quaternion( double(q1) / q2 ); 0033 end