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.

plotSurfaceNormals(obj, nGrid)
function h = plotSurfaceNormals(obj, nGrid)
% plotSurfaceNormals - plot an objects surface in reference position
% (obj.translation=[0 0 0], obj.rotations=[0 0 0]) and overlay its surface
% normals
%
% h ....... the figure handle to draw on
% obj ..... object to draw
% nGrid ... interpolate surface anew at [N M] points

% get surface in reference position and interpolate data
[X, Y, Z, ~] = interpolateGrid(obj, 'surface', nGrid);

% get grid normals
gridNormals = getGridNormals(X, Y, Z);

% show surface
h = figure();
hold on;
surf(X, Y, Z);
shading flat;

% get point coordinates
Xg = reshape(X,1,[]);
Yg = reshape(Y,1,[]);
Zg = reshape(Z,1,[]);

% and surface normal vectors
Xn = gridNormals(1,:);
Yn = gridNormals(2,:);
Zn = gridNormals(3,:);

% to draw onto the surface
quiver3(Xg,Yg,Zg,Xn,Yn,Zn);
axis equal;

Contact us