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

📄 opt_exempel.m

📁 Matlab实现光线跟踪算法
💻 M
字号:
% Example of% Set the options for ploting of the optics/raytracingopt_ops.plotrays=1; % plot the individual raysopt_ops.plotpaus=0; % do not pause after each  ray intersectionopt_ops.plotRT = 0; % do not ``drawnow'' after each ray intersection% build the optical system as specified in opt.exmploptelements = opt_build('opt.exmpl');% make a default rayray = opt_ray;%make 100 paralell rays with random displacement in y-z planenr_rays = 100;for ray_i = 1:nr_rays,    rays(ray_i) = ray;  rays(ray_i).r = [-3 -1.5+3*rand -1.5+3*rand];  rays(ray_i).color = rand([3 1]); % color is line color for                                   % plotting of rays  endclfsubplot(2,2,1)% plot the optical systemopt_plotoptics(optelements([1:end-4 end]));hold on% trace all rays[opt_screen] = opt_trace(optelements([1:end-4 end]),rays,opt_ops);view(-15,75)subplot(2,2,2)% Last element should be a screen, which stores the image.imagesc(opt_screen(end).img)axis([245 265 245 265])subplot(2,2,3)ray.r = [-3 -1 0];opt_plotoptics(optelements);hold on[opt_screen] = opt_trace(optelements,ray,opt_ops);view(-15,75)subplot(2,2,2)subplot(2,2,4)ray.r = [-3 0 0];[opt_screen] = opt_trace(optelements([end-1 end]),ray,opt_ops);view(0,90)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -