


compute extended embedding from H- and original representation
* H-representation given by esDec.A
* original representation is given by esDec.dataOriginal (as
decomposition)
THIS IS NO USER FUNCTION

0001 function esDec = computeExtendedEmbedding(esDec, zerotol) 0002 % compute extended embedding from H- and original representation 0003 % 0004 % * H-representation given by esDec.A 0005 % * original representation is given by esDec.dataOriginal (as 0006 % decomposition) 0007 % 0008 % THIS IS NO USER FUNCTION 0009 0010 % The elk-library: convex geometry applied to crystallization modeling. 0011 % Copyright (C) 2013 Alexander Reinhold 0012 % 0013 % This program is free software: you can redistribute it and/or modify it 0014 % under the terms of the GNU General Public License as published by the 0015 % Free Software Foundation, either version 3 of the License, or (at your 0016 % option) any later version. 0017 % 0018 % This program is distributed in the hope that it will be useful, but 0019 % WITHOUT ANY WARRANTY; without even the implied warranty of 0020 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0021 % General Public License for more details. 0022 % 0023 % You should have received a copy of the GNU General Public License along 0024 % with this program. If not, see <http://www.gnu.org/licenses/>. 0025 0026 %% Lift structuring elements to the extended H-representation 0027 % therefore, we cycle through all structuring elements and build a matrix 0028 % that gives the SEs in the extended H-representation. 0029 nExtraFacet = size(esDec.originalData.newFacetNormalMatrix, 1); 0030 seFacetDistanceMatrix = [... 0031 esDec.originalData.mappingReducedToFull * esDec.originalData.se'; ... 0032 zeros(nExtraFacet, esDec.originalData.nS)]; 0033 for iSe = 1:esDec.originalData.nS 0034 % generate se in hrep 0035 thisHrep = struct('A', esDec.originalData.A, 'h', ... 0036 esDec.originalData.mappingReducedToFull * ... 0037 esDec.originalData.se(iSe, :)'); 0038 % compute support values for additional faces 0039 seFacetDistanceMatrix((esDec.originalData.nH+1):end, iSe) = ... 0040 computeSupportValueHrep(thisHrep, ... 0041 esDec.originalData.newFacetNormalMatrix); 0042 end 0043 0044 %% Find new constrained H-representation (extended embedding) 0045 % Essentially, we search a linear subspace in the new h-space. With SVD 0046 % this is easily calculated giving any orthonormal basis. Since it is not 0047 % guaranteed to obtain a proper representation, this mapping is 0048 % sufficient. 0049 [u s v] = svd(seFacetDistanceMatrix); 0050 esDec.nC = sum(diag(s) > zerotol); 0051 esDec.mappingReducedToFull = u(:, 1:esDec.nC); 0052 esDec.mappingFullToReduced = u(:, 1:esDec.nC)'; 0053 0054 0055 %% Adding some more (already known information) 0056 0057 % copy unchanged information 0058 esDec.nDim = esDec.originalData.nDim; 0059 esDec.nS = esDec.originalData.nS; 0060 0061 % merge facet information 0062 esDec.constraintMatrix = eye(esDec.nH) - ... 0063 esDec.mappingReducedToFull * esDec.mappingFullToReduced; 0064 0065 % adopt (real-valued) structuring elements for additional facets. note, 0066 % that the real-scaling (mean width) is still valid because we've only 0067 % added facets that do not exist on those shapes. 0068 esDec.se = (esDec.mappingFullToReduced * seFacetDistanceMatrix)'; 0069 0070 % scale to close information 0071 esDec.centerRay = mean(esDec.se, 1)'; 0072 esDec.seScaledToClose = scaleToClose(esDec.se, esDec); 0073 0074 % validity cone - note that the valdity cone is not the true cone(!) it is 0075 % chosen so that the resulting representation survives validateDec 0076 coneVrep.V = closeCone(esDec.seScaledToClose); 0077 coneHrep = convertVrepToHrep(coneVrep); 0078 esDec.validityCone = openCone(coneHrep); 0079 esDec.validityCone.seIndexVector = 1:esDec.nS; 0080 esDec.validityCone.volume = computeVolumeVrep(coneVrep); 0081 esDec.confinementCone = esDec.validityCone; 0082 0083 % partition information - see validity cone: volumeScaled is wrong and the 0084 % partitioning is NOT complete 0085 esDec = appendUnifiedPartition(esDec); 0086 % this partition should be valid 0087 esDec = appendUnifiedPartition(esDec, 1:esDec.nS, zerotol, 1, 1); 0088 esDec.nPU = 1; 0089 esDec.nPS = 1; 0090 0091 % the output representation is not necessarily proper; in fact, we dont 0092 % even know the validity and confinement cones; the same applies for 0093 % singular/ordinary 0094 esDec.isProper = 0; 0095 esDec.isOrdinary = 0; 0096 esDec.isComplete = 0; 0097 0098 % cleanup (so far) 0099 esDec = cleanupDecStructure(esDec);