0001 function dec = appendUnifiedPartition(dec, seIndexVector, zerotol, ...
0002 isValid, isConfined)
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043 if ~isfield(dec, 'unifiedPartition') || ~exist('seIndexVector', 'var')
0044 dec.simplexPartition = cell(0);
0045 dec.unifiedPartition = cell(0);
0046 dec.simplexToUnifiedVector = [];
0047 dec.simplexIsValidVector = [];
0048 dec.simplexIsConfinedVector = [];
0049 dec.unifiedToSimplexVector = [];
0050 dec.unifiedIsValidVector = [];
0051 dec.unifiedIsConfinedVector = [];
0052 dec.seIncidenceMatrix = eye(dec.nS, dec.nS);
0053 return
0054 end
0055
0056 thisUnifiedIndex = length(dec.unifiedPartition) + 1;
0057
0058
0059 seSimplexIndexMatrix = computeTriangulationOfCone(...
0060 dec.seScaledToClose(seIndexVector, :));
0061
0062
0063 simplexNormalVectorMatrix = [];
0064 simplexVolumeSum = 0;
0065
0066
0067 for iSimplex = 1:size(seSimplexIndexMatrix, 1)
0068
0069
0070 thisSimplexIndex = length(dec.simplexPartition) + 1;
0071
0072
0073 thisSeMatrix = dec.seScaledToClose(seIndexVector(...
0074 seSimplexIndexMatrix(iSimplex, :)), :);
0075
0076
0077
0078 if rank(thisSeMatrix, zerotol) < dec.nC
0079 continue
0080 end
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093 dec.simplexPartition{thisSimplexIndex}.A = -1*inv(thisSeMatrix');
0094 dec.simplexPartition{thisSimplexIndex}.h = zeros([dec.nC, 1]);
0095 dec.simplexPartition{thisSimplexIndex} = normalizeHrep(...
0096 dec.simplexPartition{thisSimplexIndex});
0097
0098
0099 simplexNormalVectorMatrix = [simplexNormalVectorMatrix; ...
0100 dec.simplexPartition{thisSimplexIndex}.A];
0101
0102
0103 dec.simplexPartition{thisSimplexIndex}.seIndexVector = ...
0104 sort(seIndexVector(seSimplexIndexMatrix(iSimplex, :)));
0105
0106
0107 dec.simplexPartition{thisSimplexIndex}.volumeScaled = ...
0108 computeVolumeVrep(...
0109 struct('V', [thisSeMatrix; zeros([1, dec.nC])]) ...
0110 ) / dec.confinementCone.volume;
0111 simplexVolumeSum = simplexVolumeSum + ...
0112 dec.simplexPartition{thisSimplexIndex}.volumeScaled;
0113
0114
0115 dec.simplexToUnifiedVector(thisSimplexIndex) = thisUnifiedIndex;
0116 dec.simplexIsValidVector(thisSimplexIndex) = isValid;
0117 dec.simplexIsConfinedVector(thisSimplexIndex) = isConfined;
0118
0119
0120 dec.simplexPartition{thisSimplexIndex}.mappingHcToLam = inv(dec.se(...
0121 dec.simplexPartition{thisSimplexIndex}.seIndexVector, : ...
0122 )');
0123 end
0124
0125
0126
0127
0128
0129
0130
0131
0132 dec.unifiedPartition{thisUnifiedIndex}.A = eliminateRows(...
0133 simplexNormalVectorMatrix, -1*simplexNormalVectorMatrix, zerotol);
0134 dec.unifiedPartition{thisUnifiedIndex}.h = zeros(...
0135 [size(dec.unifiedPartition{thisUnifiedIndex}.A, 1), 1]);
0136
0137
0138 dec.unifiedPartition{thisUnifiedIndex}.seIndexVector = sort(seIndexVector);
0139
0140
0141 dec.unifiedToSimplexVector(thisUnifiedIndex) = length(dec.simplexToUnifiedVector);
0142 dec.unifiedIsValidVector(thisUnifiedIndex) = isValid;
0143 dec.unifiedIsConfinedVector(thisUnifiedIndex) = isConfined;
0144
0145
0146 dec.unifiedPartition{thisUnifiedIndex}.volumeScaled = ...
0147 computeVolumeVrep(...
0148 struct('V', [...
0149 dec.seScaledToClose(seIndexVector, :); ...
0150 zeros([1, dec.nC])...
0151 ]) ...
0152 ) / dec.confinementCone.volume;
0153
0154
0155 for iSeIndex = 1:length(seIndexVector)
0156 for jSeIndex = 1:length(seIndexVector)
0157 dec.seIncidenceMatrix(seIndexVector(iSeIndex), ...
0158 seIndexVector(jSeIndex)) = 1;
0159 end
0160 end
0161
0162 end