Commit 5e416ad5 authored by Jan-Gerrit Richter's avatar Jan-Gerrit Richter

added some coordinate functions to overload operations with itaOrientation

parent 6dcf37d6
function returnCoords = mrdivide(position,orientation)
if ~isa(orientation,'itaOrientation')
error('Only multiplication with itaOrientation object is supported')
end
if orientation.nPoints > 1
if orientation.nPoints ~= position.nPoints
error('Number of points and orientations does not fit.');
end
end
if strcmp(orientation.coordSystem,'openGLrh')
position.cart = ita_matlab2openGL(position.cart);
end
if orientation.nPoints > 1
for index = 1:position.nPoints
tmp(index,:) = (orientation.n(index).quat.inverse.RotationMatrix*position.n(index).cart.').';
end
else
tmp = (orientation.quat.inverse.RotationMatrix*position.cart.').';
end
returnCoords = position;
if strcmp(orientation.coordSystem,'openGLrh')
returnCoords.cart = ita_openGL2Matlab(tmp);
else
returnCoords.cart = tmp;
end
\ No newline at end of file
function [ returnCoords ] = mtimes(position,b)
%TIMES Summary of this function goes here
% Detailed explanation goes here
if ~isa(b,'itaOrientation')
error('Only multiplication with itaOrientation object is supported')
end
if b.nPoints > 1
if b.nPoints ~= position.nPoints
error('Number of points and orientations does not fit.');
end
end
if strcmp(b.coordSystem,'openGLrh')
position.cart = ita_matlab2openGL(position.cart);
end
if b.nPoints > 1
for index = 1:position.nPoints
tmp(index,:) = (b.n(index).quat.RotationMatrix*position.n(index).cart.').';
end
else
tmp = (b.quat.RotationMatrix*position.cart.').';
end
returnCoords = position;
if strcmp(b.coordSystem,'openGLrh')
returnCoords.cart = ita_openGL2Matlab(tmp);
else
returnCoords.cart = tmp;
end
end
function result = uminus(a)
% <ITA-Toolbox>
% This file is part of the ITA-Toolbox. Some rights reserved.
% You can find the license for this m-file in the license.txt file in the ITA-Toolbox folder.
% </ITA-Toolbox>
result = a;
result.cart = -a.cart;
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment