Optical Layout Example -- 4-f Imaging System

Contents

Basic Example

% Use "sub-shapes" to specify parameters for the launch,
% the lenses, and the absorber.  Do not draw anything yet.
LAUNCH = davinci( 'optical_layout.beam_launch', 'Position',        [0 0], ...
                                                'Direction',       [1 0], ...
                                                'ConeAngle',          25, ...
                                                'BeamLineWidth',       2 );
L1 = davinci( 'optical_layout.lens',            'LineWidth',           2 );  % Default DistanceToFocus is Inf.
L2 = davinci( 'optical_layout.lens',            'DistanceToFocus',     5, ...
                                                'LineWidth',           2 );
ABSORBER = davinci( 'optical_layout.absorber',  'Height',              2, ...
                                                'Thickness',         0.4 );
% Use the ">" operator to merge the "sub-shape" parameters with the
% travel distances.  Use the ":" operator to name the components.
% Do not draw anything yet.
LAYOUT = 'S1':LAUNCH > 5 > 'L1':L1 > 10 > 'L2':L2 > 5 > 'A1':ABSORBER;
% Draw the layout.
davinci( 'optical_layout', 'Layout', LAYOUT );
daspect([1 1 1])   % Set aspect ratio to 1:1.
axis( [-2 22 -5 5] )   % Make sure the axis ranges are big enough that no clipping occurs.
% Use Matlab's findobj() function to locate optical components
% by name and adjust the color of each.
%   -- An alternate way to set these colors is to specify the
%      colors when defining L1, L2, and ABSORBER - before
%      drawing anything.
set( findobj( 'Tag', 'L1' ), 'Color', 'g' )                 % L1 = line object.
set( findobj( 'Tag', 'L2' ), 'Color', 'r' )                 % L2 = line object.
set( findobj( 'Tag', 'A1' ), 'FaceColor', [.8 .8 .8], ...   % A1 = patch object.
                             'EdgeColor', 'k', ...
                             'LineWidth', 2 )