Code covered by the BSD License  

Highlights from
Huygens-Fresnel integral approximation, free-form apertures and rough surfaces

image thumbnail

Huygens-Fresnel integral approximation, free-form apertures and rough surfaces

by

 

Simulate wave propagation through free-form apertures, or off rough surfaces.

generateSurfaceFunction(obj)
function [surface, nGrid] = generateSurfaceFunction(obj)
% generateSurfaceFunction - evaluate a function of (x,y) to get a map of
% height values

% get grid coordinates
[X Y] = generateMesh(obj);

if isempty(obj.xyJitter)
    [X Y] = generateMesh(obj);
else
    X = reshape(obj.referenceGrid(1,:), obj.nGrid(1),[]);
    Y = reshape(obj.referenceGrid(2,:), obj.nGrid(1),[]);
end

% get grid size
nGrid = size(X);

% scale parameters by the image size
param(1,:) = obj.scaledFunctionParameters(1,:) * obj.nGrid(1);
param(2,:) = obj.scaledFunctionParameters(2,:) * obj.nGrid(2);

% evaluate function and reshape results
Z = obj.function(X, Y, obj.functionParameters, param);

surface = zeros(3,numel(Z));
surface(1,:) = reshape(X, 1, []);
surface(2,:) = reshape(Y, 1, []);
surface(3,:) = reshape(Z, 1, []);

Contact us