File:Frounhofer02.webm

Summary

Description
English: Far field diffraction patterns for a few aperture shapes.
Date
Source https://twitter.com/j_bertolotti/status/1486354083799834628
Author Jacopo Bertolotti
Permission
(Reusing this file)
https://twitter.com/j_bertolotti/status/1030470604418428929

Mathematica 12.0 code

dim = 512;
size = 30;
sinstep[t_] := Sin[\[Pi]/2 t]^2;
stopstep[t_] := t (2 - t);
split[t_] := Round[80*stopstep[t] ];
\[Theta][t_] := \[Pi]*sinstep[t];

framerate = 1/30;

plottolo[ar_] := GraphicsRow[{
ArrayPlot[ar[[1/4 dim ;; 3/4 dim, dim/4 ;; 3/4 dim]],  ColorFunction -> "AvocadoColors", PlotLabel -> "Aperture", LabelStyle -> {White, Bold}, Frame -> False], 
ArrayPlot[ RotateRight[ Abs[Fourier[PadRight[ar(*-Mean[Flatten@ar]*), {8 dim, 8 dim}]]]^2, {dim/2, dim/2}][[1 ;; dim, 1 ;; dim]](*[[2/8dim;;6/8dim,2/8dim;;6/8dim]]*), ColorFunction -> "AvocadoColors", PlotRange -> {0, 0.5}, ClippingStyle -> White,     PlotLabel -> "Far field diffraction", LabelStyle -> {White, Bold}, Frame -> False]
   }, Background -> Black]

frames1 = Table[
   ar = Clip[ RotateRight[DiskMatrix[size, dim], {0, split[t]}] +  RotateRight[DiskMatrix[size, dim], {0, -split[t]}], {0, 1}];
   plottolo[ar]
   , {t, 0, 1, framerate}];
frames2 = Table[
   ar = Clip[ DiskMatrix[size, dim] +  RotateRight[DiskMatrix[size, dim], {0, split[t]}] + RotateRight[DiskMatrix[size, dim], {0, -split[t]}], {0, 1}];
   plottolo[ar]
   , {t, 0, 1, framerate}];
frames3 = Table[
   ar = Clip[ RotateRight[ DiskMatrix[size, dim], {Round[split[1]*Sin[\[Theta][t]]], Round[split[1]*Cos[\[Theta][t]]]}] + RotateRight[       DiskMatrix[size, dim], {-Round[split[1]*Sin[\[Theta][t]]], -Round[split[1]*Cos[\[Theta][t]]]}], {0, 1}];
   plottolo[ar]
   , {t, 0, 1, framerate}];
frames4 = Table[
   ar = Clip[ RotateRight[DiskMatrix[size, dim], {split[t], split[1]}] + RotateRight[DiskMatrix[size, dim], {-split[t], split[1]}] +       RotateRight[DiskMatrix[size, dim], {split[t], -split[1]}] + RotateRight[DiskMatrix[size, dim], {-split[t], -split[1]}], {0, 1}];
   plottolo[ar]
   , {t, 0, 1, framerate}];
frames5 = Table[
   ar = Clip[DiskMatrix[size + 3*size*stopstep[t], dim], {0, 1}];
   plottolo[ar]
   , {t, 0, 1, framerate}];
frames5bis = Table[
   ar = Clip[ DiskMatrix[size + 3*size, dim] - DiskMatrix[3*size*stopstep[t], dim], {0, 1}];
   plottolo[ar]
   , {t, 0, 1, framerate}];
frames5tris = Table[
   ar = Clip[ DiskMatrix[size + 3*size*(1 - stopstep[t]), dim] - DiskMatrix[3*size*(1 - stopstep[t]), dim], {0, 1}];
   plottolo[ar]
   , {t, 0, 1, framerate}];
frames5quater = Table[
   trianglesize = 100*stopstep[t] + 10;
   ar = Abs[ Rasterize[Graphics[Triangle[{{-1/2, -Tan[\[Pi]/6]/2}, {1/2, -Tan[\[Pi]/6]/2}, {0, Cos[\[Pi]/6]/2}}]], "Data", RasterSize -> {2*trianglesize, 2*trianglesize}][[All, All, 1]] - 255]/255;
   ar = PadRight[ ArrayPad[ar, Round[(dim - Dimensions[ar][[1]])/2]], {dim, dim}];
   ar = Clip[DiskMatrix[size*(1 - stopstep[t]), dim] + ar, {0, 1}];
   plottolo[ar]
   , {t, 0, 1, framerate}];
frames5penta = Table[
   trianglesize = 100*(1 - stopstep[t]) + 10;
   ar = Abs[ Rasterize[ Graphics[ Triangle[{{-1/2, -Tan[\[Pi]/6]/2}, {1/2, -Tan[\[Pi]/6]/2}, {0, Cos[\[Pi]/6]/2}}]], "Data", RasterSize -> {2*trianglesize, 2*trianglesize}][[All, All, 1]] - 255]/255;
   ar = PadRight[ ArrayPad[ar, Round[(dim - Dimensions[ar][[1]])/2]], {dim, dim}];
   ar = Clip[BoxMatrix[size*3*(stopstep[t]), dim] + ar, {0, 1}];
   plottolo[ar]
   , {t, 0, 1, framerate}];
frames5esa = Table[
   ar = Clip[ BoxMatrix[size/2 + size*2.5*(1 - stopstep[t]), dim], {0, 1}];
   plottolo[ar]
   , {t, 0, 1, framerate}];
frames6 = Table[
   ar = Clip[ BoxMatrix[{size/2, size/2 + Round[(100 - size/2)*sinstep[t]]},  dim], {0, 1}];
   plottolo[ar]
   , {t, 0, 1, framerate}];
frames7 = Table[
   ar = Clip[ BoxMatrix[{size/2, 100}, dim] + BoxMatrix[{size/2 + Round[(100 - size/2)*sinstep[t]], size/2}, dim], {0, 1}];
   plottolo[ar]
   , {t, 0, 1, framerate}];
frames8 = Table[
   ar = Clip[ RotateRight[ BoxMatrix[{size/2, 100},  dim], {-Round[(100 - size/2)*sinstep[t] ], 0}] + BoxMatrix[{100, size/2}, dim], {0, 1}];
   plottolo[ar]
   , {t, 0, 1, framerate}];
frames9 = Table[
   ar = Clip[ RotateRight[ BoxMatrix[{size/2, 100}, dim], {-(100 - size/2), 0}] +  RotateRight[BoxMatrix[{100, size/2}, dim], {0, -Round[(100 - size/2)*sinstep[t] ]}], {0, 1}];
   plottolo[ar]
   , {t, 0, 1, framerate}];
frames10 = Table[
   ar = Clip[ BoxMatrix[size/2*(1 - stopstep[t]), dim] + DiskMatrix[size*stopstep[t], dim], {0, 1}];
   plottolo[ar]
   , {t, 0, 1, framerate}];
ListAnimate[Join[
 frames1, Reverse@frames1, frames2, Reverse@frames2, frames1, frames3, frames4, Reverse@frames4, Reverse@frames1, frames5, frames5bis, frames5tris, frames5quater, frames5penta, frames5esa, frames6, frames7, frames8, frames9,  Reverse@frames9, Reverse@frames8, Reverse@frames7, Reverse@frames6, frames10
 ]]

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

Category:CC-Zero#Frounhofer02.webm
Category:Self-published work Category:Uploaded with video2commons Category:Videos of diffraction Category:Images with Mathematica source code
Category:CC-Zero Category:Images with Mathematica source code Category:Pages using deprecated source tags Category:Self-published work Category:Uploaded with video2commons Category:Videos of diffraction