viewNormalVectorBnd

PURPOSE ^

plot normal vector for boundary

SYNOPSIS ^

function h = viewNormalVectorBnd(input, bnd)

DESCRIPTION ^

 plot normal vector for boundary

 Syntax:  h = viewNormalVectorBnd(angle, bnd)
  or      h = viewNormalVectorBnd(normalVector, bnd)

 View normal vector and fit size to the given boundary shape.

 See also: viewBoundary, viewBoundaryShape, obtainBoundary, fitShapeBnd

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function h = viewNormalVectorBnd(input, bnd)
0002 % plot normal vector for boundary
0003 %
0004 % Syntax:  h = viewNormalVectorBnd(angle, bnd)
0005 %  or      h = viewNormalVectorBnd(normalVector, bnd)
0006 %
0007 % View normal vector and fit size to the given boundary shape.
0008 %
0009 % See also: viewBoundary, viewBoundaryShape, obtainBoundary, fitShapeBnd
0010 
0011 % The elk-library: convex geometry applied to crystallization modeling.
0012 %   Copyright (C) 2012 Alexander Reinhold
0013 %
0014 % This program is free software: you can redistribute it and/or modify it
0015 %   under the terms of the GNU General Public License as published by the
0016 %   Free Software Foundation, either version 3 of the License, or (at your
0017 %   option) any later version.
0018 %
0019 % This program is distributed in the hope that it will be useful, but
0020 %   WITHOUT ANY WARRANTY; without even the implied warranty of
0021 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0022 %   General Public License for more details.
0023 %
0024 % You should have received a copy of the GNU General Public License along
0025 %   with this program.  If not, see <http://www.gnu.org/licenses/>
0026 
0027 if length(input) == 1
0028     normVector = computeNormalFromAngle(input);
0029 elseif size(input, 1) == 2 && size(input, 2) == 1
0030     % everything OK
0031     normVector = input;
0032 elseif size(input, 1) == 1 && size(input, 2) == 2
0033     normVector = input';
0034 else
0035     error('elk:boundary:wrongInput', ['The normal vector must be ' ...
0036         'specified either by an angle or by a normal vector']);
0037 end
0038 
0039 % calculate distance
0040 normLength = max(normVector' * [bnd.cartX; bnd.cartY]);
0041 
0042 % plot
0043 h = plot([0 normVector(1)]*normLength, ...
0044          [0 normVector(2)]*normLength, 'r-');

Generated on Sat 18-Jul-2015 16:45:31 by m2html © 2005