Home > utilities > make_logo.m

make_logo

PURPOSE ^

Make the toolbox logo. Adapted from:

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 Make the toolbox logo. Adapted from:
   mathworks.com/help/matlab/examples/creating-the-matlab-logo.html

 Note: this will not produce the same figure each time as there's a call
 to rand in the script.

 Author(s):
   Pierre Cazenave (Plymouth Marine Laboratory).
 
 ChangeLog:
   2016-06-02 First version.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % Make the toolbox logo. Adapted from:
0002 %   mathworks.com/help/matlab/examples/creating-the-matlab-logo.html
0003 %
0004 % Note: this will not produce the same figure each time as there's a call
0005 % to rand in the script.
0006 %
0007 % Author(s):
0008 %   Pierre Cazenave (Plymouth Marine Laboratory).
0009 %
0010 % ChangeLog:
0011 %   2016-06-02 First version.
0012 
0013 ftbverbose = 1;
0014 
0015 [base, subname] = fileparts(mfilename('fullpath'));
0016 cd(base)
0017 
0018 global ftbverbose
0019 if ftbverbose
0020     fprintf('\nbegin : %s\n', subname)
0021 end
0022 
0023 % Make an initial membrane and then triangulate it and plot that.
0024 
0025 n = 5; % size of the membrane
0026 L = 160 * membrane(1, n);
0027 [X, Y] = meshgrid(1:n*2 + 1, 1:n*2 + 1);
0028 
0029 % Interpolate onto an irregular grid.
0030 XX = X .* (0.95 + mod(abs(rand(size(X))), 0.05));
0031 YY = Y .* (0.95 + mod(abs(rand(size(Y))), 0.05));
0032 Z = griddata(X, Y, L, XX, YY);
0033 
0034 tri = delaunayTriangulation(XX(:), YY(:));
0035 
0036 % Do the plot replicating (as closely as possible) the MATLAB logo.
0037 close all
0038 
0039 f = figure;
0040 ax = axes;
0041 s = trisurf(tri.ConnectivityList, XX(:), YY(:), Z(:));
0042 s.EdgeColor = 'none';
0043 view(3)
0044 ax.XLim = [1 max(X(:))];
0045 ax.YLim = [1 max(Y(:))];
0046 ax.ZLim = [min(Z(:)), max(Z(:))];
0047 ax.CameraUpVector = [0 0 1];
0048 ax.CameraViewAngle = 8;
0049 ax.Position = [0 0 1 1];
0050 ax.DataAspectRatio = [1 1 20];
0051 l1 = light;
0052 l1.Position = [160 400 80];
0053 l1.Style = 'local';
0054 l2 = light;
0055 l2.Position = [.5 -1 .4];
0056 l2.Color = [0.8 0.8 0];
0057 caxis([min(Z(:)), max(Z(:))])
0058 s.FaceLighting = 'gouraud';
0059 s.AmbientStrength = 0.3;
0060 s.DiffuseStrength = 0.9;
0061 s.BackFaceLighting = 'lit';
0062 s.SpecularStrength = 1;
0063 s.SpecularColorReflectance = 1;
0064 s.SpecularExponent = 7;
0065 axis off
0066 colormap(hot)
0067 
0068 % Transparent background and save to PDF.
0069 set(gca,'color','none') 
0070 print(gcf, '-dpdf', '../doc/fvcom-toolbox.pdf', '-painters')
0071 
0072 if ftbverbose
0073     fprintf('end   : %s \n', subname)
0074 end

Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005