Home > matGeom > geom3d > drawVector3d.m

drawVector3d

PURPOSE ^

DRAWVECTOR3D Draw vector at a given position.

SYNOPSIS ^

function varargout = drawVector3d(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(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@inrae.fr
0026 % Created: 2011-12-19, using Matlab 7.9.0.529 (R2009b)
0027 % Copyright 2011-2024 INRA - Cepia Software Platform
0028 
0029 % extract handle of axis to draw on
0030 [hAx, varargin] = parseAxisHandle(varargin{:});
0031 
0032 % retrieve geometric data
0033 pos = varargin{1};
0034 vect = varargin{2};
0035 varargin(1:2) = [];
0036 
0037 % draw the vectors using the quiver3 function
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 Thu 21-Nov-2024 11:30:22 by m2html © 2003-2022