


generate a unified partition from Minkowski decomposition THIS IS NO USER FUNCTION


0001 function partitionData = generateMinkowskiPartition(dec, hC, zerotol) 0002 % generate a unified partition from Minkowski decomposition 0003 % 0004 % THIS IS NO USER FUNCTION 0005 0006 % The elk-library: convex geometry applied to crystallization modeling. 0007 % Copyright (C) 2013 Alexander Reinhold 0008 % 0009 % This program is free software: you can redistribute it and/or modify it 0010 % under the terms of the GNU General Public License as published by the 0011 % Free Software Foundation, either version 3 of the License, or (at your 0012 % option) any later version. 0013 % 0014 % This program is distributed in the hope that it will be useful, but 0015 % WITHOUT ANY WARRANTY; without even the implied warranty of 0016 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0017 % General Public License for more details. 0018 % 0019 % You should have received a copy of the GNU General Public License along 0020 % with this program. If not, see <http://www.gnu.org/licenses/>. 0021 0022 %% initialize acuumulating array structure 0023 partitionData.flagResult = []; 0024 partitionData.hrep = []; 0025 partitionData.seMatrix = []; 0026 0027 % quit if no input is given; decomposeCone uses this call to initialize 0028 % the accumulating array 0029 if ~exist('dec', 'var') 0030 partitionData(:) = []; 0031 return 0032 end 0033 0034 %% perform Minkowski decomposition 0035 seMatrix = decomposeMinkowskiHrep(struct(... 0036 'A', dec.A, 'h', dec.mappingReducedToFull * hC), ... 0037 'constraint', dec.constraintMatrix, ... 0038 'zerotol', zerotol, ... 0039 'result', 'indecomposable', ... 0040 'matrix', 1); 0041 0042 %% project to reduced space 0043 seMatrix = (dec.mappingFullToReduced * seMatrix')'; 0044 0045 %% valid or not 0046 % if full-dimensional, that is a partition! otherwise, we generate a 0047 % new hC 0048 if rank(seMatrix) == dec.nC 0049 % accept partition 0050 partitionData.flagResult = 1; 0051 partitionData.seMatrix = scaleToClose(seMatrix, dec); 0052 partitionData.hrep = openCone(convertVrepToHrep(closeCone(struct('V', ... 0053 partitionData.seMatrix )))); 0054 0055 else 0056 % strange, retry with new hC 0057 partitionData.flagResult = 0; 0058 0059 end 0060 0061 end