Home > arte3.2.0 > tools > draw_axes.m

draw_axes

PURPOSE ^

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

SYNOPSIS ^

function draw_axes(T, X_text, Y_text, Z_text, scale)

DESCRIPTION ^

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   DRAW_AXES(T, X_text, Y_text, Z_text, scale) 

   Draws a reference system according to the transformation matrix T. Adds
   text X_text, Y_text, Z_text to X, Y and Z axes
   SCALE: change the size of the text and vectors.
   the reference system associated is drawn with arrows X (red), Y (green), Z (blue)

    See also DRAWROBOT3D, ANIMATE

   Author: Arturo Gil. Universidad Miguel Hernández de Elche.
   email: arturo.gil@umh.es date:   05/02/2012
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0002 %   DRAW_AXES(T, X_text, Y_text, Z_text, scale)
0003 %
0004 %   Draws a reference system according to the transformation matrix T. Adds
0005 %   text X_text, Y_text, Z_text to X, Y and Z axes
0006 %   SCALE: change the size of the text and vectors.
0007 %   the reference system associated is drawn with arrows X (red), Y (green), Z (blue)
0008 %
0009 %    See also DRAWROBOT3D, ANIMATE
0010 %
0011 %   Author: Arturo Gil. Universidad Miguel Hernández de Elche.
0012 %   email: arturo.gil@umh.es date:   05/02/2012
0013 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0014 
0015 % Copyright (C) 2012, by Arturo Gil Aparicio
0016 %
0017 % This file is part of ARTE (A Robotics Toolbox for Education).
0018 %
0019 % ARTE is free software: you can redistribute it and/or modify
0020 % it under the terms of the GNU Lesser General Public License as published by
0021 % the Free Software Foundation, either version 3 of the License, or
0022 % (at your option) any later version.
0023 %
0024 % ARTE is distributed in the hope that it will be useful,
0025 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0026 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0027 % GNU Lesser General Public License for more details.
0028 %
0029 % You should have received a copy of the GNU Leser General Public License
0030 % along with ARTE.  If not, see <http://www.gnu.org/licenses/>.
0031 function draw_axes(T, X_text, Y_text, Z_text, scale)
0032 
0033 if ~exist('scale', 'var')
0034     scale=0.8;
0035 end
0036 
0037 %origin p0
0038 p0=T(1:3,4)';
0039 x = p0 + 0.1*scale*T(1:3,1)';
0040 y = p0 + 0.1*scale*T(1:3,2)';
0041 z = p0 + 0.1*scale*T(1:3,3)';
0042 
0043 vect_arrow(p0, x, 'r', scale*3) %standard WIDTH for arrows is 3
0044 vect_arrow(p0, y, 'g', scale*3)
0045 vect_arrow(p0, z, 'b', scale*3)
0046 %plot vector names X_i Y_i Z_i
0047 %standard fontsize is
0048 text(x(1)+0.01, x(2)-0.01, x(3)+0.01,X_text, 'FontWeight', 'bold', 'HorizontalAlignment', 'Center', 'FontSize', round(24*scale)); 
0049 text(y(1)+0.01, y(2)+0.01, y(3)+0.01, Y_text, 'FontWeight', 'bold', 'HorizontalAlignment', 'Center', 'FontSize', round(24*scale));
0050 text(z(1)+0.01, z(2)+0.01, z(3)+0.01, Z_text, 'FontWeight', 'bold', 'HorizontalAlignment', 'Center', 'FontSize', round(24*scale));

Generated on Fri 03-Jan-2014 12:20:01 by m2html © 2005