⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 opt_intersection.htm

📁 Matlab实现光线跟踪算法
💻 HTM
字号:
<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_intersection.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> rinter = opt_intersection(optelem,rayin)                                                                                                            </FONT></FONT></P> <P><HR WIDTH="100%"></P> <P><FONT COLOR="#000000"><FONT SIZE=+2>Function comments</FONT></FONT></P> <pre> % % OPT_INTERSECTION - Determine the impact point of an optical % ray RAYIN on an lens system element OPTELEM % % See also OPT_REFRACTION, OPT_TRACE </pre> <P><HR WIDTH="100%"></P> <P><FONT COLOR="#000000"><FONT SIZE=+1>m-files called by opt_intersection.m</FONT></FONT></P> <UL> <LI><A HREF ="point_on_line.htm">point_on_line</A></LI> </UL> <P><HR WIDTH="100%"></P> <P><FONT COLOR="#000000"><FONT SIZE=+1>m-files that call opt_intersection.m</FONT></FONT></P> <UL> <LI><A HREF ="Contents.htm">Contents</A></LI> <LI><A HREF ="opt_trace.htm">opt_trace</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_intersection.m</FONT></FONT></P> <pre> function rinter = opt_intersection(optelem,rayin) % rinter = opt_intersection(optelem,rayin) % % OPT_INTERSECTION - Determine the impact point of an optical % ray RAYIN on an lens system element OPTELEM % % See also OPT_REFRACTION, OPT_TRACE  % Version: 1.0 % Copyright: Bjorn Gustavsson 20020430   if ~isempty(optelem.r)   l = (optelem.r(1)-rayin.r(1))/rayin.e(1);   rinter = <A HREF ="point_on_line.htm">point_on_line</A>(rayin.r,rayin.e,l); end  switch optelem.type  case 'aperture'   % intersection between a line and a plane   rinter = rinter+ rayin.e*( ( dot(optelem.r,optelem.n) - dot(rinter,optelem.n) ) / dot(rayin.e,optelem.n) );   case 'grid'    % intersection between a line and a plane   rinter = rinter+ rayin.e*( ( dot(optelem.r,optelem.n) - dot(rinter,optelem.n) ) / dot(rayin.e,optelem.n) );   case 'lens'    % intersection between a line and a sphere   [rinter,en] = sphereintersection(rinter,... 				   rayin.e,... 				   optelem.r+optelem.r_o_curv*optelem.n,... 				   optelem.r_o_curv,... 				   optelem.diameter/2,... 				   optelem.n);   case 'prism'    % intersection between a line and a plane   rinter = rinter+ rayin.e*( ( dot(optelem.r,optelem.n) - dot(rinter,optelem.n) ) / dot(rayin.e,optelem.n) );   case 'screen'    % intersection between a line and a plane   rinter = rinter+ rayin.e*( ( dot(optelem.r,optelem.n) - dot(rinter,optelem.n) ) / dot(rayin.e,optelem.n) );   case 'slit'    % intersection between a line and a plane   rinter = rinter+ rayin.e*( ( dot(optelem.r,optelem.n) - dot(rinter,optelem.n) ) / dot(rayin.e,optelem.n) );   otherwise    l_inter = fmins(optelem.fcn1,0,[],[],rayin.r,rayin.e,'s',optelem.arglist);   rinter = <A HREF ="point_on_line.htm">point_on_line</A>(rayin.r,rayin.e,l_inter);  end    function [rinter,en] = sphereintersection(rl,e_in,rsf,curvature,lensradius,en) % SPHEREINTERSECTION - intersection between a ray and a spherical % lens surface %  ex = e_in(1); ey = e_in(2); ez = e_in(3); xl = rl(1); yl = rl(2); zl = rl(3); x0 = rsf(1); y0 = rsf(2); z0 = rsf(3); R = curvature;  % I'd like to say that I did this by myself...  l(2) = [ 1/2/(ex^2+ey^2+ez^2)*(2*ez*z0-2*zl*ez-2*yl*ey+2*ex*x0+2*ey*y0-2*xl*ex+2*(2*ex^2*zl*z0+2*ez*z0*ex*x0-ex^2*y0^2-ex^2*z0^2-ex^2*yl^2+ex^2*R^2-ex  % ...But who am I trying to fool  l(1) = [ 1/2/(ex^2+ey^2+ez^2)*(2*ez*z0-2*zl*ez-2*yl*ey+2*ex*x0+2*ey*y0-2*xl*ex-2*(2*ex^2*zl*z0+2*ez*z0*ex*x0-ex^2*y0^2-ex^2*z0^2-ex^2*yl^2+ex^2*R^2-ex  % Where would I be without the symbolic toolbox?  [qwe,i] = min(abs(l)); l = l(i);  rinter = <A HREF ="point_on_line.htm">point_on_line</A>(rl,e_in,l);  r1 = rinter - rsf; r2 = cross(r1,en);  en = []; if norm(r2)<lensradius   en = r1/norm(r1); else   rinter = []; end </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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -