Home > matGeom > geom3d > drawVector3d.m

drawVector3d

PURPOSE ^

DRAWVECTOR3D Draw vector at a given position.

SYNOPSIS ^

function varargout = drawVector3d(pos, vect, varargin)

DESCRIPTION ^

DRAWVECTOR3D Draw vector at a given position.

   drawVector3d(POS, VECT)
   Draws the vector VECT starting at the position POS. Both VECT and POS
   are N-by-3 arrays.

   drawVector3d(..., PNAME, PVALUE)
   Specifies additional optional parameters that will be given to the
   quiver3 function.

   Example
     figure; hold on;
     drawVector3d([2 3 4], [1 0 0]);
     drawVector3d([2 3 4], [0 1 0]);
     drawVector3d([2 3 4], [0 0 1]);
     view(3);

   See also
   vectors3d, quiver3

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function varargout = drawVector3d(pos, vect, varargin)
0002 %DRAWVECTOR3D Draw vector at a given position.
0003 %
0004 %   drawVector3d(POS, VECT)
0005 %   Draws the vector VECT starting at the position POS. Both VECT and POS
0006 %   are N-by-3 arrays.
0007 %
0008 %   drawVector3d(..., PNAME, PVALUE)
0009 %   Specifies additional optional parameters that will be given to the
0010 %   quiver3 function.
0011 %
0012 %   Example
0013 %     figure; hold on;
0014 %     drawVector3d([2 3 4], [1 0 0]);
0015 %     drawVector3d([2 3 4], [0 1 0]);
0016 %     drawVector3d([2 3 4], [0 0 1]);
0017 %     view(3);
0018 %
0019 %   See also
0020 %   vectors3d, quiver3
0021 %
0022 
0023 % ------
0024 % Author: David Legland
0025 % e-mail: david.legland@nantes.inra.fr
0026 % Created: 2011-12-19,    using Matlab 7.9.0.529 (R2009b)
0027 % Copyright 2011 INRA - Cepia Software Platform.
0028 
0029 if isAxisHandle(pos)
0030     hAx = pos;
0031     pos = vect;
0032     vect = varargin{1};
0033     varargin(1) = [];
0034 else
0035     hAx = gca;
0036 end
0037 
0038 h = quiver3(hAx, pos(:, 1), pos(:, 2), pos(:, 3), ...
0039     vect(:, 1), vect(:, 2), vect(:, 3), 0, varargin{:});
0040 
0041 % format output
0042 if nargout > 0
0043     varargout{1} = h;
0044 end

Generated on Wed 16-Feb-2022 15:10:47 by m2html © 2003-2019