normalizeHrep

PURPOSE ^

normalize length of facet normals to 1

SYNOPSIS ^

function Hrep = normalizeHrep(Hrep)

DESCRIPTION ^

 normalize length of facet normals to 1

 Syntax: Hrep = normalizeHrep(Hrep)

 An H-representation is not unique. For a facet normal a[i] and a facet
   distance h[i] and any g > 0 it the halfspace defined by the facet
   normal g*a[i] and g*h[i] is identical to the original halfspace. A
   normalized H-representation is unique and it holds:
     norm(a[i], 2) = 1

 See also: movePolytope, stretchPolytope, rotatePolytope

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function Hrep = normalizeHrep(Hrep)
0002 % normalize length of facet normals to 1
0003 %
0004 % Syntax: Hrep = normalizeHrep(Hrep)
0005 %
0006 % An H-representation is not unique. For a facet normal a[i] and a facet
0007 %   distance h[i] and any g > 0 it the halfspace defined by the facet
0008 %   normal g*a[i] and g*h[i] is identical to the original halfspace. A
0009 %   normalized H-representation is unique and it holds:
0010 %     norm(a[i], 2) = 1
0011 %
0012 % See also: movePolytope, stretchPolytope, rotatePolytope
0013 
0014 % The elk-library: convex geometry applied to crystallization modeling.
0015 %   Copyright (C) 2012 Alexander Reinhold
0016 %
0017 % This program is free software: you can redistribute it and/or modify it
0018 %   under the terms of the GNU General Public License as published by the
0019 %   Free Software Foundation, either version 3 of the License, or (at your
0020 %   option) any later version.
0021 %
0022 % This program is distributed in the hope that it will be useful, but
0023 %   WITHOUT ANY WARRANTY; without even the implied warranty of
0024 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0025 %   General Public License for more details.
0026 %
0027 % You should have received a copy of the GNU General Public License along
0028 %   with this program.  If not, see <http://www.gnu.org/licenses/>.
0029 
0030 for iFacet = 1:length(Hrep.h)
0031     thisNorm = norm(Hrep.A(iFacet, :), 2);
0032     Hrep.h(iFacet) = Hrep.h(iFacet) / thisNorm;
0033     Hrep.A(iFacet, :) = Hrep.A(iFacet, :) / thisNorm;
0034 end

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