Home > arte3.2.0 > tools > draw_patch.m

draw_patch

PURPOSE ^

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

SYNOPSIS ^

function draw_patch(F, V, C, transparent)

DESCRIPTION ^

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   DRAW_PATCH(F, V, C, transparent)

   Draws a link using faces F and vertices V.
   C Defines the color of the robot.
   If transparent == 1, the robot is drawn with transparency.
   
   
    See also DRAW_LINK, 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_PATCH(F, V, C, transparent)
0003 %
0004 %   Draws a link using faces F and vertices V.
0005 %   C Defines the color of the robot.
0006 %   If transparent == 1, the robot is drawn with transparency.
0007 %
0008 %
0009 %    See also DRAW_LINK, 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_patch(F, V, C, transparent)
0032 
0033 if nargin==2
0034     %default color
0035     C=[0.5 0.6 0.7];
0036     transparent=0;
0037 end
0038 if nargin==3
0039     transparent=0;
0040 end
0041 
0042 set(gca, 'drawmode', 'fast');
0043 
0044 %draw the vertices
0045 %note: vertices should be expressed in m
0046 p = patch('faces', F, 'vertices', V);
0047 
0048 
0049 set(p, 'facec', 'flat');          
0050 %set(p, 'FaceVertexCData', C);       % Set the color (from file)
0051 set(p, 'FaceColor', C);
0052 
0053 if transparent
0054     set(p, 'facealpha',.4)          % Draws the link with transparency
0055 end
0056 
0057 set(p, 'EdgeColor','none');         
0058 
0059 light;                               
0060 %change material properties
0061 material( [0.5 0.1 0.01]);
0062 daspect([1 1 1])                    % Setting the aspect ratio
0063 
0064 xlabel('X (m)'),ylabel('Y (m)'),zlabel('Z (m)')

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