%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Q=QPROD(Q1, Q2) Computes the product of two quaternionts Q1 and Q2 See also QUATERNIONT2T, T2QUATERNION. Author: Arturo Gil. Universidad Miguel Hernández de Elche. email: arturo.gil@umh.es date: 02/04/2012 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0002 % Q=QPROD(Q1, Q2) 0003 % Computes the product of two quaternionts Q1 and Q2 0004 % 0005 % See also QUATERNIONT2T, T2QUATERNION. 0006 % 0007 % Author: Arturo Gil. Universidad Miguel Hernández de Elche. email: 0008 % arturo.gil@umh.es date: 02/04/2012 0009 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0010 0011 % Copyright (C) 2012, by Arturo Gil Aparicio 0012 % 0013 % This file is part of ARTE (A Robotics Toolbox for Education). 0014 % 0015 % ARTE is free software: you can redistribute it and/or modify 0016 % it under the terms of the GNU Lesser General Public License as published by 0017 % the Free Software Foundation, either version 3 of the License, or 0018 % (at your option) any later version. 0019 % 0020 % ARTE is distributed in the hope that it will be useful, 0021 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0022 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0023 % GNU Lesser General Public License for more details. 0024 % 0025 % You should have received a copy of the GNU Leser General Public License 0026 % along with ARTE. If not, see <http://www.gnu.org/licenses/>. 0027 function q = qprod(q1, q2) 0028 0029 q = [q1(1)*q2(1)-q1(2:4)*q2(2:4)', q1(1)*q2(2:4)+q2(1)*q1(2:4)+cross(q1(2:4),q2(2:4))];