2018-10-11 10:25:57 +02:00
|
|
|
function [] = initializeMirror(opts_param)
|
2018-07-11 15:44:16 +02:00
|
|
|
%% Default values for opts
|
|
|
|
opts = struct(...
|
|
|
|
'shape', 'spherical', ... % spherical or conical
|
|
|
|
'angle', 45 ...
|
|
|
|
);
|
|
|
|
|
|
|
|
%% Populate opts with input parameters
|
|
|
|
if exist('opts_param','var')
|
|
|
|
for opt = fieldnames(opts_param)'
|
|
|
|
opts.(opt{1}) = opts_param.(opt{1});
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
%%
|
|
|
|
mirror = struct();
|
|
|
|
mirror.h = 50; % height of the mirror [mm]
|
|
|
|
mirror.thickness = 25; % Thickness of the plate supporting the sample [mm]
|
|
|
|
mirror.hole_rad = 120; % radius of the hole in the mirror [mm]
|
|
|
|
mirror.support_rad = 100; % radius of the support plate [mm]
|
|
|
|
mirror.jacobian = 150; % point of interest offset in z (above the top surfave) [mm]
|
|
|
|
mirror.rad = 180; % radius of the mirror (at the bottom surface) [mm]
|
|
|
|
|
|
|
|
mirror.density = 2400; % Density of the mirror [kg/m3]
|
2018-10-29 12:57:13 +01:00
|
|
|
mirror.color = [0.4 1.0 1.0]; % Color of the mirror
|
2018-07-11 15:44:16 +02:00
|
|
|
|
|
|
|
mirror.cone_length = mirror.rad*tand(opts.angle)+mirror.h+mirror.jacobian; % Distance from Apex point of the cone to jacobian point
|
|
|
|
|
|
|
|
%% Shape
|
|
|
|
mirror.shape = [...
|
|
|
|
0 mirror.h-mirror.thickness
|
|
|
|
mirror.hole_rad mirror.h-mirror.thickness; ...
|
|
|
|
mirror.hole_rad 0; ...
|
|
|
|
mirror.rad 0 ...
|
|
|
|
];
|
|
|
|
|
|
|
|
if strcmp(opts.shape, 'spherical')
|
|
|
|
mirror.sphere_radius = sqrt((mirror.jacobian+mirror.h)^2+mirror.rad^2); % Radius of the sphere [mm]
|
|
|
|
|
|
|
|
for z = linspace(0, mirror.h, 101)
|
|
|
|
mirror.shape = [mirror.shape; sqrt(mirror.sphere_radius^2-(z-mirror.jacobian-mirror.h)^2) z];
|
|
|
|
end
|
|
|
|
elseif strcmp(opts.shape, 'conical')
|
2018-10-11 10:25:57 +02:00
|
|
|
mirror.shape = [mirror.shape; mirror.rad+mirror.h/tand(opts.angle) mirror.h];
|
2018-07-11 15:44:16 +02:00
|
|
|
else
|
|
|
|
error('Shape should be either conical or spherical');
|
|
|
|
end
|
|
|
|
|
|
|
|
mirror.shape = [mirror.shape; 0 mirror.h];
|
|
|
|
|
2018-10-11 10:25:57 +02:00
|
|
|
%% Save
|
|
|
|
save('./mat/stages.mat', 'mirror', '-append');
|
2018-07-11 15:44:16 +02:00
|
|
|
end
|