0001 function newFacetNormalMatrix = computeAdditionalFacetMatrix(dec, zerotol)
0002
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 [rowIndexVector, colIndexVector] = find(...
0032 (dec.seIncidenceMatrix + tril(ones(dec.nS) - eye(dec.nS))) == 0);
0033 newFacetNormalMatrix = [];
0034
0035
0036 for iPair = 1:length(rowIndexVector)
0037
0038 hrepSummand1 = dec.se(rowIndexVector(iPair), :) * dec.mappingReducedToFull';
0039 hrepSummand1 = struct('A', dec.A, 'h', hrepSummand1');
0040 hrepSummand2 = dec.se(colIndexVector(iPair), :) * dec.mappingReducedToFull';
0041 hrepSummand2 = struct('A', dec.A, 'h', hrepSummand2');
0042
0043
0044 hrepSum = addMinkowskiHrep(hrepSummand1, hrepSummand2);
0045
0046
0047
0048
0049
0050 if computeVolumeHrep(hrepSum, zerotol) < zerotol
0051 vrepSum = convertHrepToVrep(hrepSum);
0052
0053
0054 facetFilter = (hrepSum.A * vrepSum.V')';
0055
0056
0057 for iFacet = 1:size(facetFilter, 2)
0058 if all(abs(facetFilter(:,iFacet) - facetFilter(1,iFacet)) < zerotol)
0059 break;
0060 end
0061 end
0062 if iFacet == size(facetFilter, 2)
0063 error('elk:decomposition:numericalError', ...
0064 'Could not find the facets of a flat object. This should not happen');
0065 end
0066
0067 thisFacetNormalMatrix = [hrepSum.A(iFacet, :); ...
0068 -1*hrepSum.A(iFacet, :)];
0069
0070
0071 thisFacetNormalMatrix = eliminateRows(thisFacetNormalMatrix, ...
0072 dec.A, zerotol);
0073 else
0074
0075 thisFacetNormalMatrix = eliminateRows(hrepSum.A, dec.A, zerotol);
0076 end
0077
0078
0079 if isempty(thisFacetNormalMatrix)
0080 error('elk:decomposition:numericalError', ...
0081 ['Structuring elements ' num2str(rowIndexVector(iPair)) ' and ' ...
0082 num2str(colIndexVector(iPair)) ' do not share a unified partition ' ...
0083 ' but also do not create additional facets by Minkowski addition.']);
0084 end
0085
0086
0087 [thisFacetNormalMatrix, thisCreatedFacetIndexVector] = eliminateRows(...
0088 thisFacetNormalMatrix, newFacetNormalMatrix, zerotol);
0089
0090
0091 thisCreatedFacetIndexVector = [thisCreatedFacetIndexVector, ...
0092 (1:size(thisFacetNormalMatrix, 1)) + size(newFacetNormalMatrix, 1)];
0093 newFacetNormalMatrix = [newFacetNormalMatrix; thisFacetNormalMatrix];
0094
0095
0096
0097 end