Home > . > transl.m

transl

PURPOSE ^

TRANSL Create translational transform

SYNOPSIS ^

function r = transl(x, y, z)

DESCRIPTION ^

TRANSL Create translational transform

    TR = TRANSL(X, Y, Z)
    TR = TRANSL( [X Y Z] )

 Returns a homogeneous transformation representing a translation of X, Y
 and Z.

    [X Y Z]' = TRANSL(T)

 Returns the translational part of a homogenous transform as a 3-element 
 column vector.

    [X Y Z] = TRANSL(TG)

 Returns a  matrix of the X, Y and Z elements extracted from a Cartesian 
 trajectory matrix TG.

 See also: CTRAJ.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %TRANSL Create translational transform
0002 %
0003 %    TR = TRANSL(X, Y, Z)
0004 %    TR = TRANSL( [X Y Z] )
0005 %
0006 % Returns a homogeneous transformation representing a translation of X, Y
0007 % and Z.
0008 %
0009 %    [X Y Z]' = TRANSL(T)
0010 %
0011 % Returns the translational part of a homogenous transform as a 3-element
0012 % column vector.
0013 %
0014 %    [X Y Z] = TRANSL(TG)
0015 %
0016 % Returns a  matrix of the X, Y and Z elements extracted from a Cartesian
0017 % trajectory matrix TG.
0018 %
0019 % See also: CTRAJ.
0020 
0021 % Copyright (C) 1993-2008, by Peter I. Corke
0022 %
0023 % This file is part of The Robotics Toolbox for Matlab (RTB).
0024 %
0025 % RTB is free software: you can redistribute it and/or modify
0026 % it under the terms of the GNU Lesser General Public License as published by
0027 % the Free Software Foundation, either version 3 of the License, or
0028 % (at your option) any later version.
0029 %
0030 % RTB is distributed in the hope that it will be useful,
0031 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0032 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0033 % GNU Lesser General Public License for more details.
0034 %
0035 % You should have received a copy of the GNU Leser General Public License
0036 % along with RTB.  If not, see <http://www.gnu.org/licenses/>.
0037 
0038 function r = transl(x, y, z)
0039     if nargin == 1,
0040         if ishomog(x),
0041             r = x(1:3,4);
0042         elseif ndims(x) == 3,
0043             r = squeeze(x(1:3,4,:))';
0044         else
0045             t = x(:);
0046             r =    [eye(3)            t;
0047                 0    0    0    1];
0048         end
0049     elseif nargin == 3,
0050         t = [x; y; z];
0051         r =    [eye(3)            t;
0052             0    0    0    1];
0053     end

Generated on Sun 15-Feb-2009 18:09:29 by m2html © 2003