opt_prism.htm
来自「Matlab实现光线跟踪算法」· HTM 代码 · 共 139 行
HTM
139 行
<HTML> <HEAD> <TITLE>/</TITLE> <META NAME="GENERATOR" CONTENT="HTML-TOOLBOX "> </HEAD> <BODY bgcolor="#FFFFF0"> <HR WIDTH="100%"></P> <CENTER><P><FONT COLOR="#000000"><FONT SIZE=+3>Cross-linked m-file</FONT></FONT></P></CENTER> <CENTER><P><FONT COLOR="#000000"><FONT SIZE=+1></FONT></FONT></P></CENTER> <CENTER><P><FONT COLOR="#000000"><FONT SIZE=+2>opt_prism.m</FONT></FONT></P></CENTER> <CENTER><P><FONT COLOR="#000000"><FONT SIZE=+1>Located in:</FONT></FONT></P></CENTER> <CENTER><P><FONT COLOR="#000000"><FONT SIZE=+1>/home/bjorn/matlab/Optical_bench</FONT></FONT></P></CENTER> <P><HR WIDTH="100%"></P> <P><FONT COLOR="#000000"><FONT SIZE=+2>Function synopsis</FONT></FONT></P> <P><FONT COLOR="#000000"><FONT SIZE=+1> OPT_LENS - Spherical lens single glass. </FONT></FONT></P> <P><HR WIDTH="100%"></P> <P><FONT COLOR="#000000"><FONT SIZE=+2>Function comments</FONT></FONT></P> <pre> % OPT_TYPE should be 'prism' (hm good and vital argument), OPT_SPEC % should be a string matrix, see README_OPT for specification. % Necessary specification fields: % r1, r2, normal1, normal2, dxdydx, glass % glass should be name of the glass type, the other 1x3 array % Optional specification fields: % arc, arc1 arc2 % example OPT_SPEC: % 'normal1 1 0 0' % 'normal2 cos(30*pi/180) sin(30*pi/180) 0' % 'r1 12 0 0' % 'r2 12.5 0 0' % 'dxdydz1 0 1.5 1.5' % 'dxdydz2 0 1.7321 1.5' % 'glass bk7' % 'arc .5' % % See also OPT_APERTURE, OPT_GRID, OPT_LENS, OPT_SCREEN, OPT_SLIT </pre> <P><HR WIDTH="100%"></P> <P><FONT COLOR="#000000"><FONT SIZE=+1>m-files called by opt_prism.m</FONT></FONT></P> <UL> <LI><A HREF ="opt_findstr.htm">opt_findstr</A></LI> <LI><A HREF ="opt_elem.htm">opt_elem</A></LI> </UL> <P><HR WIDTH="100%"></P> <P><FONT COLOR="#000000"><FONT SIZE=+1>m-files that call opt_prism.m</FONT></FONT></P> <UL> <LI><A HREF ="Contents.htm">Contents</A></LI> <LI><A HREF ="opt_build.htm">opt_build</A></LI> </UL> <P><HR WIDTH="100%"></P> <P><FONT COLOR="#000000"><FONT SIZE=+1>All the cross references in the source m-code of opt_prism.m</FONT></FONT></P> <pre> function [opt] = opt_prism(opt_type,opt_spec) % OPT_LENS - Spherical lens single glass. % OPT_TYPE should be 'prism' (hm good and vital argument), OPT_SPEC % should be a string matrix, see README_OPT for specification. % Necessary specification fields: % r1, r2, normal1, normal2, dxdydx, glass % glass should be name of the glass type, the other 1x3 array % Optional specification fields: % arc, arc1 arc2 % example OPT_SPEC: % 'normal1 1 0 0' % 'normal2 cos(30*pi/180) sin(30*pi/180) 0' % 'r1 12 0 0' % 'r2 12.5 0 0' % 'dxdydz1 0 1.5 1.5' % 'dxdydz2 0 1.7321 1.5' % 'glass bk7' % 'arc .5' % % See also OPT_APERTURE, OPT_GRID, OPT_LENS, OPT_SCREEN, OPT_SLIT % Version: 1.0 % Copyright: Bjorn Gustavsson 20020430 if nargin ~= 2, help opt_prism; ok = 0; return; end; opt1 = <A HREF ="opt_elem.htm">opt_elem</A>(opt_type); opt2 = <A HREF ="opt_elem.htm">opt_elem</A>(opt_type); % defaults opt2.glass = 'air'; % going out into air after the prism opt1.r(2:3) = 0; % Prism centered on the optical axis opt1.n = [1 0 0]; % Prism perpendicular to the optical axis opt2.r(2:3) = 0; % Prism centered on the optical axis opt2.n = [1 0 0]; % Prism perpendicular to the optical axis opt1.arc = 0; % no anti reflection coating opt2.arc = 0; % no anti reflection coating % set the necessary ones: % prism size i = <A HREF ="opt_findstr.htm">opt_findstr</A>(opt_spec,'dydz1'); opt1.dxdydz = str2num(opt_spec(i,12:end)); i = <A HREF ="opt_findstr.htm">opt_findstr</A>(opt_spec,'dydz2'); opt2.dxdydz = str2num(opt_spec(i,12:end)); % prism position i = <A HREF ="opt_findstr.htm">opt_findstr</A>(opt_spec,'r1'); opt1.r = str2num(opt_spec(i,12:end)); i = <A HREF ="opt_findstr.htm">opt_findstr</A>(opt_spec,'r2'); opt2.r = str2num(opt_spec(i,12:end)); % prism normal1 i = <A HREF ="opt_findstr.htm">opt_findstr</A>(opt_spec,'normal1'); opt1.n = str2num(opt_spec(i,12:end)); % prism normal2 i = <A HREF ="opt_findstr.htm">opt_findstr</A>(opt_spec,'normal2'); opt2.n = str2num(opt_spec(i,12:end)); % prism glass i = <A HREF ="opt_findstr.htm">opt_findstr</A>(opt_spec,'glass'); opt1.glass = strtok(opt_spec(i,12:end)); % set the optional ones i = <A HREF ="opt_findstr.htm">opt_findstr</A>(opt_spec,'arc'); if length(i) == 1 opt1.arc = str2num(opt_spec(i,12:end)); opt2.arc = str2num(opt_spec(i,12:end)); elseif length(i)>1 i = <A HREF ="opt_findstr.htm">opt_findstr</A>(opt_spec,'arc1'); opt1.arc = str2num(opt_spec(i,12:end)); i = <A HREF ="opt_findstr.htm">opt_findstr</A>(opt_spec,'arc2'); opt2.arc = str2num(opt_spec(i,12:end)); end opt = [opt1 opt2]; </pre> <P><HR WIDTH="100%"></P> <P><I><FONT COLOR="#0000FF"><FONT SIZE=+1>Written by B. Gustavsson 13:27 29/1 2003 <IMG SRC = "file:/home/bjorn/matlab/Local/Tools/htmltool/gifs/copyright.gif" ></FONT></FONT></I></P> <P><I><FONT COLOR="#0000FF"><FONT SIZE=+1>E-mail:</B><A HREF = "mailto:bjorn@irf.se">bjorn@irf.se</A></H4></FONT></FONT></I></P>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?