cut_plane.m

来自「利用电磁场的源激发方法来计算光子晶体波导例如光子晶体光纤」· M 代码 · 共 38 行

M
38
字号
function posOut = cut_plane(oGd, pos, ang, bAbove, vGreen)
x0 = oGd.offsetX;
y0 = oGd.offsetY;
sdArray = oGd.sdArray;
for iSd = 1:oGd.nSd
        bCut = 0;
        % determine whether sd is cut and cut testing points of
        % the 'inside' curve
        curve = sdArray(iSd).insideCurve;
        if isempty(curve)
                bCut = 1; % Hankel region is always cut
        else
                iCurve = curve.iCurve;
                bUpdateN = 0;
                pos.testing(iCurve) = cut_sd(pos.testing(iCurve), x0, y0, ang, bAbove,  bUpdateN);
                new_n = length(pos.testing(iCurve).vX);
                if (new_n ~= pos.testing(iCurve).n)
                        pos.testing(iCurve).n = new_n;
                        bCut = 1;
                end
                if new_n == 0
                        pos.sources(iSd).vX = [];
                        pos.sources(iSd).vY = [];
                        pos.sources(iSd).n = 0;
                        continue
                end
        end
        % sd is cut iff bCut == 1
        if ~bCut
                continue;
        end
        pos.sources(iSd).vGreen = vGreen;
        bUpdateN = 1;

        % cut sources
        pos.sources(iSd) = cut_sd(pos.sources(iSd), x0, y0, ang, bAbove, bUpdateN);
end
posOut = pos;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?