(* Content-type: application/vnd.wolfram.mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 8.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 157, 7] NotebookDataLength[ 102266, 2256] NotebookOptionsPosition[ 101066, 2210] NotebookOutlinePosition[ 101709, 2235] CellTagsIndexPosition[ 101666, 2232] WindowTitle->2D Fourier Transforms - Source WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell["2D Fourier Transforms", "Section", CellFrame->{{0, 0}, {0, 0}}, ShowCellBracket->False, FontColor->RGBColor[0.597406, 0, 0.0527047]], Cell[BoxData[ GraphicsBox[RasterBox[CompressedData[" 1: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 FP/69esnAAAAAAAAAAAAwM74B4thROM= "], {{0, 0}, {1800, 25}}, {0, 255}, ColorFunction->RGBColor], ImageSize->{1800, 25}, PlotRange->{{0, 1800}, {0, 25}}]], "Section", CellFrame->{{0, 0}, {0, 0}}, ShowCellBracket->False], Cell[BoxData[ RowBox[{"Manipulate", "[", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{"Main", " ", "processing", " ", "code"}], "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{ "inputprimitives", ",", "inputgraphic", ",", "inputplaneimage", ",", "inputplane", ",", "ftim", ",", "ftimg", ",", "inputplanegreen", ",", "a", ",", "b", ",", "c", ",", "d", ",", "e", ",", "ir", ",", "ft", ",", "ftab2"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"gsc", "[", "image_", "]"}], ":=", RowBox[{"gsc", "[", RowBox[{"image", ",", "color"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"inputprimitives", "=", RowBox[{"Rotate", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{"latticetype", "\[Equal]", "1"}], ",", "\[IndentingNewLine]", RowBox[{"convoluteshapewithcomb", "[", RowBox[{"type", ",", "nx", ",", "ny", ",", RowBox[{"10", "^", "logradius"}], ",", RowBox[{"{", RowBox[{ RowBox[{"10", "^", "loggridspacingx"}], ",", RowBox[{"10", "^", "loggridspacingy"}]}], "}"}], ",", "internalshaperotation", ",", "externalshaperotation", ",", "annulusthickness"}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"convoluteshapewithpolygongrid", "[", RowBox[{"type", ",", "latticetype", ",", RowBox[{"10", "^", "logradius"}], ",", RowBox[{"{", RowBox[{ RowBox[{"10", "^", "loggridspacingx"}], ",", RowBox[{"10", "^", "loggridspacingy"}]}], "}"}], ",", "internalshaperotation", ",", "externalshaperotation", ",", "annulusthickness", ",", "pluszerozero"}], "]"}]}], "]"}], "\[IndentingNewLine]", ",", "rotation"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{"invertinput", ",", RowBox[{"inputplaneimage", "=", RowBox[{"ColorNegate", "[", RowBox[{"Image", "[", RowBox[{"ColorConvert", "[", RowBox[{ RowBox[{"Graphics", "[", RowBox[{ RowBox[{"{", RowBox[{"White", ",", "inputprimitives"}], "}"}], ",", RowBox[{"PlotRange", "\[Rule]", "plotrange"}], ",", RowBox[{"ImageSize", "\[Rule]", RowBox[{"{", RowBox[{"resolution", ",", "resolution"}], "}"}]}], ",", RowBox[{"Frame", "\[Rule]", "False"}], ",", RowBox[{"Background", "\[Rule]", "Black"}]}], "]"}], ",", "\"\\""}], "]"}], "]"}], "]"}]}], ",", RowBox[{"inputplaneimage", "=", RowBox[{"Image", "[", RowBox[{"ColorConvert", "[", RowBox[{ RowBox[{"Graphics", "[", RowBox[{ RowBox[{"{", RowBox[{"White", ",", "inputprimitives"}], "}"}], ",", RowBox[{"PlotRange", "\[Rule]", "plotrange"}], ",", RowBox[{"ImageSize", "\[Rule]", RowBox[{"{", RowBox[{"resolution", ",", "resolution"}], "}"}]}], ",", RowBox[{"Frame", "\[Rule]", "False"}], ",", RowBox[{"Background", "\[Rule]", "Black"}]}], "]"}], ",", "\"\\""}], "]"}], "]"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"inputplane", "=", RowBox[{"ImageData", "[", "inputplaneimage", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"ft", "=", RowBox[{"Abs", "[", RowBox[{"spl", "[", RowBox[{"Fourier", "[", "inputplane", "]"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"ftab2", "=", RowBox[{ RowBox[{"Abs", "[", "ft", "]"}], "^", "2"}]}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{"logintensity", ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"e", "=", RowBox[{"Log", "[", RowBox[{ RowBox[{"1", "*", SuperscriptBox["10", RowBox[{"-", "5"}]]}], "+", "ftab2"}], "]"}]}], ";", RowBox[{"d", "=", RowBox[{"(", RowBox[{ RowBox[{"4", "*", "logbrightnessscaling"}], "+", "e"}], ")"}]}], ";", RowBox[{"c", "=", RowBox[{"e", "+", "10"}]}], ";", RowBox[{"ir", "=", "All"}]}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"c", "=", RowBox[{"d", "=", RowBox[{"(", RowBox[{ RowBox[{"10", "^", "logbrightnessscaling"}], "*", "ftab2"}], ")"}]}]}], ";", RowBox[{"ir", "=", RowBox[{"{", RowBox[{"0", ",", "1"}], "}"}]}]}]}], "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", RowBox[{"ftim", "=", RowBox[{"Image", "[", "d", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Switch", "[", RowBox[{ "axisframe", ",", "\[IndentingNewLine]", "3", ",", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"a", "=", RowBox[{"Graphics", "[", RowBox[{ RowBox[{"{", "\[IndentingNewLine]", RowBox[{ RowBox[{"Inset", "[", RowBox[{ RowBox[{"gsc", "[", "inputplaneimage", "]"}], ",", RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}], ",", "Center", ",", "range"}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"Inset", "[", RowBox[{ RowBox[{"ListLinePlot", "[", RowBox[{ RowBox[{"inputplane", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"resolution", "[", RowBox[{"[", "1", "]"}], "]"}], "/", "2"}], "+", "1"}], "]"}], "]"}], ",", RowBox[{"DataRange", "\[Rule]", RowBox[{"plotrange", "[", RowBox[{"[", "1", "]"}], "]"}]}], ",", RowBox[{"Axes", "\[Rule]", "False"}], ",", RowBox[{"PlotStyle", "\[Rule]", RowBox[{"Directive", "[", RowBox[{"Blue", ",", "Thick"}], "]"}]}], ",", RowBox[{"AspectRatio", "\[Rule]", "0.2"}], ",", RowBox[{"PlotRange", "\[Rule]", "Automatic"}]}], "]"}], ",", RowBox[{"Scaled", "[", RowBox[{"{", RowBox[{"0.5", ",", "0.05"}], "}"}], "]"}], ",", RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}], ",", "2"}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"Inset", "[", RowBox[{ RowBox[{"ListLinePlot", "[", RowBox[{ RowBox[{"inputplane", "[", RowBox[{"[", RowBox[{"All", ",", RowBox[{ RowBox[{ RowBox[{"resolution", "[", RowBox[{"[", "1", "]"}], "]"}], "/", "2"}], "+", "1"}]}], "]"}], "]"}], ",", RowBox[{"DataRange", "\[Rule]", RowBox[{"plotrange", "[", RowBox[{"[", "2", "]"}], "]"}]}], ",", RowBox[{"Axes", "\[Rule]", "False"}], ",", RowBox[{"PlotStyle", "\[Rule]", RowBox[{"Directive", "[", RowBox[{"Blue", ",", "Thick"}], "]"}]}], ",", RowBox[{"AspectRatio", "\[Rule]", "0.2"}], ",", RowBox[{"PlotRange", "\[Rule]", "Automatic"}]}], "]"}], ",", RowBox[{"Scaled", "[", RowBox[{"{", RowBox[{"0.95", ",", "0.5"}], "}"}], "]"}], ",", RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}], ",", "2", ",", RowBox[{"{", RowBox[{"0", ",", "1"}], "}"}]}], "]"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"PlotRange", "\[Rule]", "plotrange"}], ",", RowBox[{"Frame", "\[Rule]", "True"}], ",", RowBox[{"ImagePadding", "\[Rule]", "pad"}], ",", RowBox[{"FrameLabel", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"Style", "[", RowBox[{"\"\\"", ",", "Black", ",", "Italic"}], "]"}], ",", RowBox[{"Style", "[", RowBox[{"\"\\"", ",", "Black", ",", "Italic"}], "]"}]}], "}"}]}], ",", RowBox[{"LabelStyle", "\[Rule]", RowBox[{"Directive", "[", RowBox[{"Black", ",", "12"}], "]"}]}], ",", RowBox[{"FrameTicks", "\[Rule]", "Automatic"}], ",", RowBox[{"FrameTicksStyle", "\[Rule]", RowBox[{"Directive", "[", "Black", "]"}]}], ",", RowBox[{"FrameStyle", "\[Rule]", RowBox[{"Directive", "[", "White", "]"}]}], ",", RowBox[{"RotateLabel", "\[Rule]", "False"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"b", "=", RowBox[{"Graphics", "[", RowBox[{ RowBox[{"{", "\[IndentingNewLine]", RowBox[{ RowBox[{"Inset", "[", RowBox[{ RowBox[{"gsc", "[", "ftim", "]"}], ",", RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}], ",", "Center", ",", "krange"}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"Inset", "[", RowBox[{ RowBox[{"ListLinePlot", "[", RowBox[{ RowBox[{"c", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"resolution", "[", RowBox[{"[", "1", "]"}], "]"}], "/", "2"}], "+", "1"}], "]"}], "]"}], ",", RowBox[{"DataRange", "\[Rule]", RowBox[{"kplotrange", "[", RowBox[{"[", "1", "]"}], "]"}]}], ",", RowBox[{"Axes", "\[Rule]", "False"}], ",", RowBox[{"PlotStyle", "\[Rule]", RowBox[{"Directive", "[", RowBox[{"Blue", ",", "Thick"}], "]"}]}], ",", RowBox[{"AspectRatio", "\[Rule]", "0.2"}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{"Full", ",", "ir"}], "}"}]}]}], "]"}], ",", RowBox[{"Scaled", "[", RowBox[{"{", RowBox[{"0.5", ",", "0.05"}], "}"}], "]"}], ",", RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}], ",", "krange"}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"Inset", "[", RowBox[{ RowBox[{"ListLinePlot", "[", RowBox[{ RowBox[{"c", "[", RowBox[{"[", RowBox[{"All", ",", RowBox[{ RowBox[{ RowBox[{"resolution", "[", RowBox[{"[", "1", "]"}], "]"}], "/", "2"}], "+", "1"}]}], "]"}], "]"}], ",", RowBox[{"DataRange", "\[Rule]", RowBox[{"kplotrange", "[", RowBox[{"[", "2", "]"}], "]"}]}], ",", RowBox[{"Axes", "\[Rule]", "False"}], ",", RowBox[{"PlotStyle", "\[Rule]", RowBox[{"Directive", "[", RowBox[{"Blue", ",", "Thick"}], "]"}]}], ",", RowBox[{"AspectRatio", "\[Rule]", "0.2"}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{"Full", ",", "ir"}], "}"}]}]}], "]"}], ",", RowBox[{"Scaled", "[", RowBox[{"{", RowBox[{"0.95", ",", "0.5"}], "}"}], "]"}], ",", RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}], ",", "krange", ",", RowBox[{"{", RowBox[{"0", ",", "1"}], "}"}]}], "]"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"PlotRange", "\[Rule]", "kplotrange"}], ",", RowBox[{"Frame", "\[Rule]", "True"}], ",", RowBox[{"ImagePadding", "\[Rule]", "pad"}], ",", RowBox[{"FrameLabel", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"Style", "[", RowBox[{ "\"\<\!\(\*SubscriptBox[\(k\), \(x\)]\)\>\"", ",", "Black"}], "]"}], ",", RowBox[{"Style", "[", RowBox[{ "\"\<\!\(\*SubscriptBox[\(k\), \(y\)]\)\>\"", ",", "Black"}], "]"}]}], "}"}]}], ",", RowBox[{"LabelStyle", "\[Rule]", RowBox[{"Directive", "[", RowBox[{"Black", ",", "12"}], "]"}]}], ",", RowBox[{"FrameTicks", "\[Rule]", "Automatic"}], ",", RowBox[{"FrameTicksStyle", "\[Rule]", RowBox[{"Directive", "[", "Black", "]"}]}], ",", RowBox[{"FrameStyle", "\[Rule]", RowBox[{"Directive", "[", "White", "]"}]}], ",", RowBox[{"RotateLabel", "\[Rule]", "False"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"GraphicsGrid", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", "a", "}"}], ",", RowBox[{"{", "b", "}"}]}], "}"}], ",", RowBox[{"(*", RowBox[{"ImageSize", "\[Rule]", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "2"}], "}"}], "*", RowBox[{"(", RowBox[{"resolution", "+", RowBox[{"Map", "[", RowBox[{"Total", ",", "pad"}], "]"}]}], ")"}]}]}], "*)"}], RowBox[{"ImageSize", "\[Rule]", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "2"}], "}"}], "*", "resolution"}]}], ",", RowBox[{"Spacings", "\[Rule]", RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}]}]}], "]"}]}], ",", "\[IndentingNewLine]", "2", ",", "\[IndentingNewLine]", RowBox[{"GraphicsGrid", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", "inputplaneimage", "}"}], ",", RowBox[{"{", "ftim", "}"}]}], "}"}], ",", RowBox[{"ImageSize", "\[Rule]", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "2"}], "}"}], "*", "resolution"}]}], ",", RowBox[{"Spacings", "\[Rule]", RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}]}]}], "]"}], ",", "\[IndentingNewLine]", "4", ",", "\[IndentingNewLine]", RowBox[{"GraphicsGrid", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"gsc", "[", "inputplaneimage", "]"}], "}"}], ",", RowBox[{"{", RowBox[{"gsc", "[", "ftim", "]"}], "}"}]}], "}"}], ",", RowBox[{"ImageSize", "\[Rule]", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "2"}], "}"}], "*", "resolution"}]}], ",", RowBox[{"Spacings", "\[Rule]", RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}]}]}], "]"}]}], "\[IndentingNewLine]", "]"}]}]}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{"Options", " ", "and", " ", "variables"}], "*)"}], "\[IndentingNewLine]", RowBox[{"Style", "[", RowBox[{"\"\\"", ",", "Bold"}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"type", ",", "16", ",", "\"\\""}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"16", "\[Rule]", "\"\\""}], ",", RowBox[{"15", "\[Rule]", "\"\\""}], ",", RowBox[{"14", "\[Rule]", "\"\\""}], ",", RowBox[{"13", "\[Rule]", "\"\\""}], ",", RowBox[{"3", "\[Rule]", "\"\\""}], ",", RowBox[{"4", "\[Rule]", "\"\\""}], ",", RowBox[{"5", "\[Rule]", "\"\\""}], ",", RowBox[{"6", "\[Rule]", "\"\\""}], ",", RowBox[{"7", "\[Rule]", "\"\\""}], ",", RowBox[{"8", "\[Rule]", "\"\\""}], ",", RowBox[{"9", "\[Rule]", "\"\\""}], ",", RowBox[{"10", "\[Rule]", "\"\\""}], ",", RowBox[{"11", "\[Rule]", "\"\\""}], ",", RowBox[{"12", "\[Rule]", "\"\\""}], ",", RowBox[{"17", "\[Rule]", "\"\\""}], ",", RowBox[{"19", "\[Rule]", "\"\<7\>\""}], ",", RowBox[{"20", "\[Rule]", "\"\\""}], ",", RowBox[{"21", "\[Rule]", "\"\\""}], ",", RowBox[{"23", "\[Rule]", "\"\\""}], ",", RowBox[{"22", "\[Rule]", "\"\\""}]}], "}"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"logradius", ",", RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", RowBox[{"-", "1"}]}], "}"}], ",", RowBox[{"Tooltip", "[", RowBox[{"\"\\"", ",", "\"\\""}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "2"}], ",", RowBox[{"-", "2"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"Log10", "[", RowBox[{"Sqrt", "[", "2", "]"}], "]"}], ",", RowBox[{"Log10", "[", RowBox[{"Sqrt", "[", "2", "]"}], "]"}]}], "}"}], ",", RowBox[{"ImageSize", "\[Rule]", "Small"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"annulusthickness", ",", ".1", ",", "\"\\""}], "}"}], ",", "0", ",", "1", ",", RowBox[{"ImageSize", "\[Rule]", "Tiny"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"internalshaperotation", ",", RowBox[{ RowBox[{"-", "Pi"}], "*", "0.25"}], ",", "\"\\""}], "}"}], ",", RowBox[{"-", "Pi"}], ",", "Pi", ",", RowBox[{"ImageSize", "\[Rule]", "Tiny"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ "externalshaperotation", ",", "0", ",", "\"\\""}], "}"}], ",", RowBox[{"-", "Pi"}], ",", "Pi", ",", RowBox[{"ImageSize", "\[Rule]", "Tiny"}]}], "}"}], ",", "\[IndentingNewLine]", "Delimiter", ",", "\[IndentingNewLine]", RowBox[{"Style", "[", RowBox[{"\"\\"", ",", "Bold"}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"latticetype", ",", "1", ",", "\"\\""}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"1", "\[Rule]", "\"\\""}], ",", RowBox[{"3", "\[Rule]", "\"\\""}], ",", RowBox[{"4", "\[Rule]", "\"\\""}], ",", RowBox[{"5", "\[Rule]", "\"\\""}], ",", RowBox[{"6", "\[Rule]", "\"\\""}], ",", RowBox[{"7", "\[Rule]", "\"\\""}], ",", RowBox[{"8", "\[Rule]", "\"\\""}], ",", RowBox[{"9", "\[Rule]", "\"\\""}], ",", RowBox[{"10", "\[Rule]", "\"\\""}], ",", RowBox[{"11", "\[Rule]", "\"\\""}], ",", RowBox[{"12", "\[Rule]", "\"\\""}]}], "}"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"Style", "[", RowBox[{"\"\\"", ",", "Bold"}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ "pluszerozero", ",", "False", ",", "\"\\""}], "}"}], ",", RowBox[{"{", RowBox[{"True", ",", "False"}], "}"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"nx", ",", "1", ",", "\"\\""}], "}"}], ",", "0", ",", "10", ",", "1", ",", RowBox[{"ImageSize", "\[Rule]", "Tiny"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"ny", ",", "1", ",", "\"\\""}], "}"}], ",", "0", ",", "10", ",", "1", ",", RowBox[{"ImageSize", "\[Rule]", "Tiny"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"Style", "[", RowBox[{ "\"\<\!\(\*SubscriptBox[\(Log\), \(10\)]\)(comb spacing)\>\"", ",", "Bold"}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"loggridspacingx", ",", RowBox[{"-", "0.5"}], ",", "\"\\""}], "}"}], ",", RowBox[{"-", "2"}], ",", "0.5", ",", RowBox[{"ImageSize", "\[Rule]", "Tiny"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"loggridspacingy", ",", RowBox[{"-", "0.5"}], ",", "\"\\""}], "}"}], ",", RowBox[{"-", "2"}], ",", "0.5", ",", RowBox[{"ImageSize", "\[Rule]", "Tiny"}]}], "}"}], ",", "\[IndentingNewLine]", "Delimiter", ",", "\[IndentingNewLine]", RowBox[{"Style", "[", RowBox[{"\"\\"", ",", "Bold"}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"rotation", ",", "0", ",", "\"\\""}], "}"}], ",", "0", ",", RowBox[{"2", "Pi"}], ",", RowBox[{"ImageSize", "\[Rule]", "Tiny"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ "invertinput", ",", "False", ",", "\"\\""}], "}"}], ",", RowBox[{"{", RowBox[{"True", ",", "False"}], "}"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"logintensity", ",", "False", ",", "\"\\""}], "}"}], ",", RowBox[{"{", RowBox[{"True", ",", "False"}], "}"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"logbrightnessscaling", ",", "1", ",", RowBox[{"Tooltip", "[", RowBox[{"\"\\"", ",", "\"\\""}], "]"}]}], "}"}], ",", RowBox[{"-", "4"}], ",", "3", ",", RowBox[{"ImageSize", "\[Rule]", "Tiny"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{"color", ",", "Green"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"axisframe", ",", "3", ",", "\"\\""}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"2", "\[Rule]", "\"\\""}], ",", RowBox[{"4", "\[Rule]", "\"\\""}], ",", RowBox[{"3", "\[Rule]", "\"\\""}]}], "}"}], ",", RowBox[{"ControlType", "\[Rule]", "PopupMenu"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"ContinuousAction", "\[Rule]", RowBox[{"If", "[", RowBox[{"type", ",", "Gaussian", ",", "False", ",", "True"}], "]"}]}], ",", "\[IndentingNewLine]", RowBox[{"TrackedSymbols", "\[Rule]", "True"}], ",", RowBox[{"ControlPlacement", "\[Rule]", "Left"}], ",", "\[IndentingNewLine]", RowBox[{"Initialization", "\[RuleDelayed]", RowBox[{"(", "\[IndentingNewLine]", RowBox[{ RowBox[{"Get", "[", "\"\\"", "]"}], ";", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ RowBox[{ "Initialization", " ", "variables", " ", "define", " ", "the", " ", "global", " ", "behaviour", " ", "of", " ", "the", " ", RowBox[{"plots", ".", " ", "This"}], " ", "is", " ", "useful", " ", "in", " ", "defining", " ", "the", " ", "plotrange", " ", "for", " ", "the", " ", "slits", " ", "which", " ", "should", " ", "always", " ", "occupy", " ", "the", " ", "whole", " ", "length", " ", "or", " ", "width", " ", "of", " ", "the", " ", "graph"}], ".."}], "*)"}], RowBox[{"resolution", "=", RowBox[{"{", RowBox[{"246", ",", "246"}], "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"nullim", "=", RowBox[{"Image", "[", RowBox[{"ConstantArray", "[", RowBox[{"0", ",", "resolution"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"pad", "=", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"50", ",", "20"}], "}"}], ",", RowBox[{"{", RowBox[{"35", ",", "10"}], "}"}]}], "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"plotrange", "=", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "1"}], "}"}]}], "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"range", "=", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"Max", "[", RowBox[{"plotrange", "[", RowBox[{"[", "1", "]"}], "]"}], "]"}], "-", RowBox[{"Min", "[", RowBox[{"plotrange", "[", RowBox[{"[", "1", "]"}], "]"}], "]"}]}], ",", RowBox[{ RowBox[{"Max", "[", RowBox[{"plotrange", "[", RowBox[{"[", "1", "]"}], "]"}], "]"}], "-", RowBox[{"Min", "[", RowBox[{"plotrange", "[", RowBox[{"[", "2", "]"}], "]"}], "]"}]}]}], "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"dxdy", "=", RowBox[{"range", "/", "resolution"}]}], ";", "\[IndentingNewLine]", RowBox[{"kplotrange", "=", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"-", "Pi"}], "/", RowBox[{"dxdy", "[", RowBox[{"[", "1", "]"}], "]"}]}], ",", RowBox[{"Pi", "/", RowBox[{"dxdy", "[", RowBox[{"[", "1", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"-", "Pi"}], "/", RowBox[{"dxdy", "[", RowBox[{"[", "2", "]"}], "]"}]}], ",", RowBox[{"Pi", "/", RowBox[{"dxdy", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}]}], "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"krange", "=", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"Max", "[", RowBox[{"kplotrange", "[", RowBox[{"[", "1", "]"}], "]"}], "]"}], "-", RowBox[{"Min", "[", RowBox[{"kplotrange", "[", RowBox[{"[", "1", "]"}], "]"}], "]"}]}], ",", RowBox[{ RowBox[{"Max", "[", RowBox[{"kplotrange", "[", RowBox[{"[", "1", "]"}], "]"}], "]"}], "-", RowBox[{"Min", "[", RowBox[{"kplotrange", "[", RowBox[{"[", "2", "]"}], "]"}], "]"}]}]}], "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"pointdensity", "=", RowBox[{ RowBox[{"Max", "[", "resolution", "]"}], "/", RowBox[{"Max", "[", "range", "]"}]}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"spl", "[", "array_", "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", "part", "}"}], ",", RowBox[{ RowBox[{"part", "=", RowBox[{"Partition", "[", RowBox[{"array", ",", RowBox[{ RowBox[{"Dimensions", "[", "array", "]"}], "/", "2"}]}], "]"}]}], ";", RowBox[{"Join", "[", RowBox[{ RowBox[{"Join", "[", RowBox[{ RowBox[{"part", "[", RowBox[{"[", RowBox[{"2", ",", "2"}], "]"}], "]"}], ",", RowBox[{"part", "[", RowBox[{"[", RowBox[{"2", ",", "1"}], "]"}], "]"}], ",", "2"}], "]"}], ",", RowBox[{"Join", "[", RowBox[{ RowBox[{"part", "[", RowBox[{"[", RowBox[{"1", ",", "2"}], "]"}], "]"}], ",", RowBox[{"part", "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}], ",", "2"}], "]"}], ",", "1"}], "]"}]}]}], "\[IndentingNewLine]", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ "Produces", " ", "a", " ", "gaussian", " ", "as", " ", "an", " ", "image", " ", RowBox[{"primitive", "."}]}], "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"gaussraster", "[", "res_", "]"}], ":=", RowBox[{"Raster", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{"1", ",", RowBox[{"(", RowBox[{"E", "^", RowBox[{"-", RowBox[{"(", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"x", "^", "2"}], "/", RowBox[{"(", RowBox[{"2", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"res", "[", RowBox[{"[", "1", "]"}], "]"}], "/", "6"}], ")"}], "^", "2"}]}], ")"}]}], "+", RowBox[{ RowBox[{"y", "^", "2"}], "/", RowBox[{"(", RowBox[{"2", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"res", "[", RowBox[{"[", "2", "]"}], "]"}], "/", "6"}], ")"}], "^", "2"}]}], ")"}]}]}], ")"}], ")"}]}]}], ")"}]}], "}"}], ",", RowBox[{"{", RowBox[{"x", ",", RowBox[{ RowBox[{"-", RowBox[{"res", "[", RowBox[{"[", "1", "]"}], "]"}]}], "/", "2"}], ",", RowBox[{ RowBox[{"res", "[", RowBox[{"[", "1", "]"}], "]"}], "/", "2"}], ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"y", ",", RowBox[{ RowBox[{"-", RowBox[{"res", "[", RowBox[{"[", "2", "]"}], "]"}]}], "/", "2"}], ",", RowBox[{ RowBox[{"res", "[", RowBox[{"[", "2", "]"}], "]"}], "/", "2"}], ",", "1"}], "}"}]}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "6"}], ",", RowBox[{"-", "6"}]}], "}"}], ",", RowBox[{"{", RowBox[{"6", ",", "6"}], "}"}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ RowBox[{"Unified", " ", "shape", " ", "making", " ", "function"}], ",", " ", RowBox[{ RowBox[{ "takes", " ", "into", " ", "account", " ", "the", " ", "nuances", " ", "of", " ", "each", " ", "of", " ", "the", " ", "cases", " ", "to", " ", "produce", " ", "a", " ", "shape", " ", "with", " ", "a", " ", "standard", " ", "size"}], " ", "-", " ", RowBox[{"1", " ", "unit", " ", "along", " ", "each", " ", RowBox[{"side", ".", " ", "Transformations"}], " ", "can", " ", "be", " ", "carried", " ", "out", " ", RowBox[{"later", "."}]}]}]}], "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"shape", "[", RowBox[{ "type_", ",", "position_", ",", "radius_", ",", "internalshaperotation_", ",", "externalshaperotation_", ",", "annulusthickness_"}], "]"}], ":=", "\[IndentingNewLine]", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{"trafo", ",", "baser"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"trafo", "=", RowBox[{"Composition", "[", RowBox[{ RowBox[{"RotationTransform", "[", RowBox[{"externalshaperotation", ",", "position"}], "]"}], ",", RowBox[{"TranslationTransform", "[", "position", "]"}], ",", RowBox[{"ScalingTransform", "[", "radius", "]"}], ",", RowBox[{ "RotationTransform", "[", "internalshaperotation", "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Switch", "[", RowBox[{"type", ",", "\[IndentingNewLine]", "3", ",", RowBox[{"Polygon", "[", RowBox[{"trafo", "[", RowBox[{"Vertices", "[", "Polytopes`Triangle", "]"}], "]"}], "]"}], ",", "\[IndentingNewLine]", "4", ",", RowBox[{"Polygon", "[", RowBox[{"trafo", "[", RowBox[{"Vertices", "[", "Polytopes`Square", "]"}], "]"}], "]"}], ",", "\[IndentingNewLine]", "5", ",", RowBox[{"Polygon", "[", RowBox[{"trafo", "[", RowBox[{"Vertices", "[", "Polytopes`Pentagon", "]"}], "]"}], "]"}], ",", "\[IndentingNewLine]", "6", ",", RowBox[{"Polygon", "[", RowBox[{"trafo", "[", RowBox[{"Vertices", "[", "Polytopes`Hexagon", "]"}], "]"}], "]"}], ",", "\[IndentingNewLine]", "7", ",", RowBox[{"Polygon", "[", RowBox[{"trafo", "[", RowBox[{"Vertices", "[", "Polytopes`Heptagon", "]"}], "]"}], "]"}], ",", "\[IndentingNewLine]", "8", ",", RowBox[{"Polygon", "[", RowBox[{"trafo", "[", RowBox[{"Vertices", "[", "Polytopes`Octagon", "]"}], "]"}], "]"}], ",", "\[IndentingNewLine]", "9", ",", RowBox[{"Polygon", "[", RowBox[{"trafo", "[", RowBox[{"Vertices", "[", "Polytopes`Nonagon", "]"}], "]"}], "]"}], ",", "\[IndentingNewLine]", "10", ",", RowBox[{"Polygon", "[", RowBox[{"trafo", "[", RowBox[{"Vertices", "[", "Polytopes`Decagon", "]"}], "]"}], "]"}], ",", "\[IndentingNewLine]", "11", ",", RowBox[{"Polygon", "[", RowBox[{"trafo", "[", RowBox[{"Vertices", "[", "Polytopes`Undecagon", "]"}], "]"}], "]"}], ",", "\[IndentingNewLine]", "12", ",", RowBox[{"Polygon", "[", RowBox[{"trafo", "[", RowBox[{"Vertices", "[", "Polytopes`Dodecagon", "]"}], "]"}], "]"}], ",", "\[IndentingNewLine]", "16", ",", RowBox[{"GeometricTransformation", "[", RowBox[{ RowBox[{"Disk", "[", "]"}], ",", "trafo"}], "]"}], ",", "\[IndentingNewLine]", "15", ",", RowBox[{"GeometricTransformation", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"Thickness", "[", "annulusthickness", "]"}], ",", RowBox[{"Circle", "[", "]"}]}], "}"}], ",", "trafo"}], "]"}], ",", "\[IndentingNewLine]", "14", ",", RowBox[{"Rotate", "[", RowBox[{ RowBox[{"Rectangle", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"position", "[", RowBox[{"[", "1", "]"}], "]"}], "-", RowBox[{"radius", "[", RowBox[{"[", "1", "]"}], "]"}]}], ",", RowBox[{"1.5", "*", RowBox[{"Min", "[", "plotrange", "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"position", "[", RowBox[{"[", "1", "]"}], "]"}], "+", RowBox[{"radius", "[", RowBox[{"[", "1", "]"}], "]"}]}], ",", RowBox[{"1.5", "*", RowBox[{"Max", "[", "plotrange", "]"}]}]}], "}"}]}], "]"}], ",", "externalshaperotation"}], "]"}], ",", "\[IndentingNewLine]", "13", ",", RowBox[{"GeometricTransformation", "[", RowBox[{ RowBox[{"gaussraster", "[", RowBox[{"6", "*", "pointdensity", "*", "radius"}], "]"}], ",", "trafo"}], "]"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", "19", ",", RowBox[{"GeometricTransformation", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"Thickness", "[", "annulusthickness", "]"}], ",", RowBox[{"CapForm", "[", "\"\\"", "]"}], ",", RowBox[{"Line", "[", RowBox[{"N", "@", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", FractionBox[ SqrtBox["3"], "2"]}], ",", FractionBox["1", "2"]}], "}"}], ",", RowBox[{"{", RowBox[{ FractionBox[ SqrtBox["3"], "2"], ",", FractionBox["1", "2"]}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", RowBox[{"-", "1"}]}], "}"}]}], "}"}]}], "]"}]}], "}"}], ",", "trafo"}], "]"}], ",", "\[IndentingNewLine]", "20", ",", RowBox[{"GeometricTransformation", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"Thickness", "[", "annulusthickness", "]"}], ",", RowBox[{"CapForm", "[", "\"\\"", "]"}], ",", RowBox[{"Line", "[", RowBox[{"N", "@", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", FractionBox[ SqrtBox["3"], "2"]}], ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{ FractionBox[ SqrtBox["3"], "2"], ",", "0"}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ FractionBox[ SqrtBox["3"], "2"], ",", FractionBox["1", "2"]}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", RowBox[{"-", "1"}]}], "}"}]}], "}"}]}], "}"}]}], "]"}]}], "}"}], ",", "trafo"}], "]"}], ",", "\[IndentingNewLine]", "21", ",", RowBox[{"GeometricTransformation", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"Thickness", "[", "annulusthickness", "]"}], ",", RowBox[{"CapForm", "[", "\"\\"", "]"}], ",", RowBox[{"Line", "[", RowBox[{"N", "@", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", FractionBox[ SqrtBox["3"], "2"]}], ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{ FractionBox[ SqrtBox["3"], "2"], ",", "0"}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ FractionBox[ SqrtBox["3"], "4"], ",", FractionBox["1", "2"]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", FractionBox[ SqrtBox["3"], "4"]}], ",", RowBox[{"-", "1"}]}], "}"}]}], "}"}]}], "}"}]}], "]"}]}], "}"}], ",", "trafo"}], "]"}], ",", "\[IndentingNewLine]", "17", ",", RowBox[{"GeometricTransformation", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"Thickness", "[", "annulusthickness", "]"}], ",", RowBox[{"CapForm", "[", "\"\\"", "]"}], ",", RowBox[{"Line", "[", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "0.5"}], ",", "0.5"}], "}"}], ",", RowBox[{"{", RowBox[{"0.5", ",", "0.5"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "0.5"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", RowBox[{"-", "0.5"}]}], "}"}]}], "}"}], "]"}]}], "}"}], ",", "trafo"}], "]"}], ",", "\[IndentingNewLine]", "22", ",", RowBox[{"GeometricTransformation", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"Thickness", "[", "annulusthickness", "]"}], ",", RowBox[{"CapForm", "[", "\"\\"", "]"}], ",", RowBox[{"Circle", "[", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "0.5"}], "}"}], ",", "0.5", ",", RowBox[{"{", RowBox[{"0", ",", RowBox[{"1.5", "Pi"}]}], "}"}]}], "]"}], ",", RowBox[{"Circle", "[", RowBox[{ RowBox[{"{", RowBox[{"0", ",", RowBox[{"-", "0.5"}]}], "}"}], ",", "0.5", ",", RowBox[{"{", RowBox[{"Pi", ",", RowBox[{"2.5", "Pi"}]}], "}"}]}], "]"}]}], "}"}], ",", "trafo"}], "]"}], ",", "\[IndentingNewLine]", "23", ",", RowBox[{"GeometricTransformation", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"Thickness", "[", "annulusthickness", "]"}], ",", RowBox[{"CapForm", "[", "\"\\"", "]"}], ",", RowBox[{"Line", "[", RowBox[{"N", "@", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ FractionBox[ SqrtBox["3"], "2"], ",", RowBox[{"-", FractionBox["3", "4"]}]}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", RowBox[{"3", "/", "4"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", FractionBox[ SqrtBox["3"], "2"]}], ",", RowBox[{"-", FractionBox["3", "4"]}]}], "}"}]}], "}"}]}], "]"}], ",", RowBox[{"Line", "[", RowBox[{"N", "@", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ FractionBox[ SqrtBox["3"], "4"], ",", FractionBox["0", "4"]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", FractionBox[ SqrtBox["3"], "4"]}], ",", FractionBox["0", "4"]}], "}"}]}], "}"}]}], "]"}]}], "}"}], ",", "trafo"}], "]"}]}], "]"}]}]}], "\[IndentingNewLine]", "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ RowBox[{ RowBox[{"Comb", " ", "convolution", " ", "function"}], ";", " ", RowBox[{ "puts", " ", "a", " ", "copy", " ", "of", " ", "shape", " ", "at", " ", "each", " ", "position", " ", "on", " ", "a", " ", "grid", " ", "which", " ", "is", " ", RowBox[{"rectangular", ".", " ", "It"}], " ", "is", " ", "possible", " ", "to", " ", "implement", " ", "a", " ", "variable", " ", "basis", " ", RowBox[{"(", RowBox[{ "where", " ", "a", " ", "different", " ", "arrangement", " ", "of", " ", "points", " ", "is", " ", "placed", " ", "at", " ", "each", " ", "lattice", " ", "point"}], ")"}], " ", "to", " ", "make", " ", "any", " ", "arbitrary", " ", "repeating", " ", "lattice", " ", "shape"}]}], ",", " ", RowBox[{ "but", " ", "this", " ", "obfuscates", " ", "the", " ", "purpose", " ", "of", " ", "this", " ", RowBox[{"demonstration", "."}]}]}], "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"convoluteshapewithcomb", "[", RowBox[{ "type_", ",", "nx_", ",", "ny_", ",", "radius_", ",", "gridspacing_", ",", "internalshaperotation_", ",", "externalshaperotation_", ",", "annulusthickness_"}], "]"}], ":=", "\[IndentingNewLine]", RowBox[{"Table", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"shape", "[", RowBox[{"type", ",", RowBox[{"{", RowBox[{"x", ",", "y"}], "}"}], ",", "radius", ",", "internalshaperotation", ",", "externalshaperotation", ",", "annulusthickness"}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{"x", ",", RowBox[{ RowBox[{"-", RowBox[{"(", RowBox[{"nx", "-", "1"}], ")"}]}], "*", "0.5", "*", RowBox[{"gridspacing", "[", RowBox[{"[", "1", "]"}], "]"}]}], ",", RowBox[{ RowBox[{"+", RowBox[{"(", RowBox[{"nx", "-", "1"}], ")"}]}], "*", "0.5", "*", RowBox[{"gridspacing", "[", RowBox[{"[", "1", "]"}], "]"}]}], ",", RowBox[{"gridspacing", "[", RowBox[{"[", "1", "]"}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"y", ",", RowBox[{ RowBox[{"-", RowBox[{"(", RowBox[{"ny", "-", "1"}], ")"}]}], "*", "0.5", "*", RowBox[{"gridspacing", "[", RowBox[{"[", "2", "]"}], "]"}]}], ",", RowBox[{ RowBox[{"+", RowBox[{"(", RowBox[{"ny", "-", "1"}], ")"}]}], "*", "0.5", "*", RowBox[{"gridspacing", "[", RowBox[{"[", "2", "]"}], "]"}]}], ",", RowBox[{"gridspacing", "[", RowBox[{"[", "2", "]"}], "]"}]}], "}"}]}], "\[IndentingNewLine]", "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ RowBox[{"Polygon", " ", "grid", " ", "convolution", " ", "function"}], ";", " ", RowBox[{ "puts", " ", "a", " ", "copy", " ", "of", " ", "a", " ", "shape", " ", "at", " ", "each", " ", "vertex", " ", "on", " ", "a", " ", "scaled", " ", "polygon", " ", RowBox[{"grid", "."}]}]}], "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"convoluteshapewithpolygongrid", "[", RowBox[{ "type_", ",", "latticen_", ",", "radius_", ",", "gridspacing_", ",", "internalshaperotation_", ",", "externalshaperotation_", ",", "annulusthickness_", ",", "pluszerozero_"}], "]"}], ":=", "\[IndentingNewLine]", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{"points", ",", "latticetype"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"latticetype", "=", RowBox[{"Switch", "[", RowBox[{ "latticen", ",", "\[IndentingNewLine]", "3", ",", "Polytopes`Triangle", ",", "\[IndentingNewLine]", "4", ",", "Polytopes`Square", ",", "\[IndentingNewLine]", "5", ",", "Polytopes`Pentagon", ",", "\[IndentingNewLine]", "6", ",", "Polytopes`Hexagon", ",", "\[IndentingNewLine]", "7", ",", "Polytopes`Heptagon", ",", "\[IndentingNewLine]", "8", ",", "Polytopes`Octagon", ",", "\[IndentingNewLine]", "9", ",", "Polytopes`Nonagon", ",", "\[IndentingNewLine]", "10", ",", "Polytopes`Decagon", ",", "\[IndentingNewLine]", "11", ",", "Polytopes`Undecagon", ",", "\[IndentingNewLine]", "12", ",", "Polytopes`Dodecagon"}], "\[IndentingNewLine]", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"points", "=", RowBox[{"If", "[", RowBox[{"pluszerozero", ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"ConstantArray", "[", RowBox[{"gridspacing", ",", RowBox[{ RowBox[{"NumberOfVertices", "[", "latticetype", "]"}], "+", "1"}]}], "]"}], "*", RowBox[{"Append", "[", RowBox[{ RowBox[{"Vertices", "[", "latticetype", "]"}], ",", RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}]}], "]"}]}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"ConstantArray", "[", RowBox[{"gridspacing", ",", RowBox[{"NumberOfVertices", "[", "latticetype", "]"}]}], "]"}], "*", RowBox[{"Vertices", "[", "latticetype", "]"}]}]}], "\[IndentingNewLine]", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Table", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"shape", "[", RowBox[{ "type", ",", "p", ",", "radius", ",", "internalshaperotation", ",", "externalshaperotation", ",", "annulusthickness"}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{"p", ",", "points"}], "}"}]}], "\[IndentingNewLine]", "]"}]}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"gsc", "[", RowBox[{"image_", ",", RowBox[{"RGBColor", "[", RowBox[{"r_", ",", "g_", ",", "b_"}], "]"}]}], "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", "d", "}"}], ",", RowBox[{ RowBox[{"d", "=", RowBox[{"ImageData", "[", "image", "]"}]}], " ", ";", RowBox[{"ColorCombine", "[", RowBox[{"{", RowBox[{ RowBox[{"Image", "[", RowBox[{"r", "*", "d"}], "]"}], ",", RowBox[{"Image", "[", RowBox[{"g", "*", "d"}], "]"}], ",", RowBox[{"Image", "[", RowBox[{"b", "*", "d"}], "]"}]}], "}"}], "]"}]}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"gsc", "[", RowBox[{"image_", ",", RowBox[{"GrayLevel", "[", "v_", "]"}]}], "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", "d", "}"}], ",", RowBox[{ RowBox[{"d", "=", RowBox[{"ImageData", "[", "image", "]"}]}], ";", RowBox[{"ColorCombine", "[", RowBox[{"{", RowBox[{ RowBox[{"Image", "[", RowBox[{"v", "*", "d"}], "]"}], ",", RowBox[{"Image", "[", RowBox[{"v", "*", "d"}], "]"}], ",", RowBox[{"Image", "[", RowBox[{"v", "*", "d"}], "]"}]}], "}"}], "]"}]}]}], "]"}]}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", ")"}]}]}], "\[IndentingNewLine]", "]"}]], "Input", CellChangeTimes->{ 3.35696210375764*^9, {3.493972817782628*^9, 3.493973009436801*^9}, { 3.4939730458893642`*^9, 3.493973176014164*^9}, {3.493973409170562*^9, 3.493973486907381*^9}, {3.493973627032605*^9, 3.4939736760938253`*^9}, { 3.4939737356488953`*^9, 3.493973739620406*^9}, {3.4939747687568817`*^9, 3.49397477287807*^9}, {3.493974806387919*^9, 3.493974819580172*^9}, { 3.4939748855293007`*^9, 3.493974926773757*^9}, {3.493974957891364*^9, 3.493974961186214*^9}, {3.493975011228489*^9, 3.493975088755378*^9}, { 3.493975151365348*^9, 3.4939751515158367`*^9}, {3.49397833888021*^9, 3.49397834014233*^9}, {3.4939926307593527`*^9, 3.493992654470851*^9}, { 3.493992707983324*^9, 3.4939927109023647`*^9}, {3.493992905451953*^9, 3.4939929275796003`*^9}, {3.493992980615703*^9, 3.4939930531274357`*^9}, { 3.493993109785692*^9, 3.493993122577346*^9}, {3.4939932198531103`*^9, 3.493993250623364*^9}, {3.4939932938510847`*^9, 3.493993330053362*^9}, { 3.4939933858832006`*^9, 3.493993407263194*^9}, {3.493993729326868*^9, 3.493993742757307*^9}, {3.493993802801284*^9, 3.493993885980256*^9}, { 3.493993955799838*^9, 3.4939939886083527`*^9}, {3.493994045931237*^9, 3.493994236478307*^9}, {3.493994279787861*^9, 3.493994379106306*^9}, { 3.493994535999485*^9, 3.493994555701673*^9}, {3.4939945862491207`*^9, 3.493994586354701*^9}, {3.493994624329679*^9, 3.493994777661776*^9}, { 3.493994946870352*^9, 3.493994949973217*^9}, {3.493995032921975*^9, 3.4939950779625483`*^9}, {3.494048407227714*^9, 3.4940484298428707`*^9}, { 3.494048504544278*^9, 3.494048512664852*^9}, {3.494048663458665*^9, 3.4940487245881157`*^9}, {3.494048757609116*^9, 3.494048807429997*^9}, { 3.494048895873027*^9, 3.494048980616623*^9}, {3.494049017023335*^9, 3.4940490380653257`*^9}, {3.494049091370771*^9, 3.494049270062702*^9}, { 3.4940493318357773`*^9, 3.4940493941910963`*^9}, {3.494049429451434*^9, 3.494049506737932*^9}, {3.494049541241783*^9, 3.494049626039864*^9}, { 3.494049668548654*^9, 3.4940497043199883`*^9}, {3.494049764317965*^9, 3.49404983282373*^9}, {3.494049920408133*^9, 3.494049947563795*^9}, { 3.494054679909596*^9, 3.494054700332419*^9}, {3.4940547619324417`*^9, 3.4940547662532043`*^9}, {3.4940548728704844`*^9, 3.4940549324783363`*^9}, {3.494055168629671*^9, 3.49405523028741*^9}, { 3.494055261552198*^9, 3.494055277851325*^9}, {3.4940553147841377`*^9, 3.494055466883506*^9}, {3.4940555274554358`*^9, 3.494055581811702*^9}, { 3.4940556167310047`*^9, 3.49405561684352*^9}, {3.4940556715435667`*^9, 3.494055753068984*^9}, {3.4940558026816874`*^9, 3.494055860591681*^9}, { 3.4940559850713463`*^9, 3.494055987871923*^9}, {3.494056048778639*^9, 3.494056264043674*^9}, {3.494056304809779*^9, 3.4940563084489813`*^9}, { 3.494056348842166*^9, 3.494056398686898*^9}, {3.494056442378421*^9, 3.4940564535048113`*^9}, {3.494056483702136*^9, 3.494056585458929*^9}, { 3.494056692212419*^9, 3.494056783173953*^9}, {3.494056839410564*^9, 3.4940568541786547`*^9}, {3.494056921449479*^9, 3.494056936023903*^9}, { 3.494056995567243*^9, 3.494057215815165*^9}, {3.4940573097674913`*^9, 3.494057353452304*^9}, {3.4940574330594*^9, 3.4940574773809977`*^9}, { 3.494057507727189*^9, 3.49405750807267*^9}, {3.494057703849187*^9, 3.494057715213345*^9}, {3.49405781426507*^9, 3.4940578522832413`*^9}, { 3.4940579460365667`*^9, 3.494057989053378*^9}, {3.49405806644867*^9, 3.494058238840687*^9}, {3.4940582983865423`*^9, 3.494058323630328*^9}, { 3.494058382044134*^9, 3.4940583860438757`*^9}, {3.494058474840748*^9, 3.4940584764947977`*^9}, {3.4940586360132504`*^9, 3.494058643840149*^9}, { 3.49406291556004*^9, 3.494062958150695*^9}, {3.4940631737363243`*^9, 3.494063257014159*^9}, {3.494063347830371*^9, 3.49406341090096*^9}, { 3.494063464067514*^9, 3.494063474181707*^9}, {3.4940636822440357`*^9, 3.494063693382031*^9}, {3.4940640383614273`*^9, 3.494064078482332*^9}, { 3.4940641164719143`*^9, 3.494064246236858*^9}, {3.494064392183009*^9, 3.4940644762757072`*^9}, {3.4940645487562523`*^9, 3.494064667662685*^9}, { 3.494064921262876*^9, 3.49406494352906*^9}, {3.4940650201576157`*^9, 3.494065062067387*^9}, {3.49406569555866*^9, 3.49406571695112*^9}, { 3.4940702058428154`*^9, 3.4940705368959174`*^9}, {3.494070570464274*^9, 3.4940706488151083`*^9}, {3.494070703891615*^9, 3.494070708490075*^9}, { 3.4940707394341693`*^9, 3.49407101756598*^9}, {3.494071050614284*^9, 3.494071252874508*^9}, {3.494071307018922*^9, 3.494071331213341*^9}, { 3.494071382065426*^9, 3.4940714514773664`*^9}, {3.4940714820884275`*^9, 3.4940715040156193`*^9}, {3.4940715514483624`*^9, 3.4940715543406515`*^9}, {3.4940715875589733`*^9, 3.494071605318749*^9}, { 3.494071643714588*^9, 3.4940716604082575`*^9}, {3.4940724257947884`*^9, 3.494072591689376*^9}, {3.494072650471254*^9, 3.4940727617163773`*^9}, { 3.494072980053209*^9, 3.4940730189851017`*^9}, {3.494073053044507*^9, 3.494073053113514*^9}, {3.4940731090541077`*^9, 3.4940731094421463`*^9}, { 3.494073144289631*^9, 3.494073161312333*^9}, {3.494073204867688*^9, 3.494073234921693*^9}, {3.494075622977178*^9, 3.494075629415793*^9}, { 3.494075666824844*^9, 3.494075842596686*^9}, {3.494075919009749*^9, 3.494075927801857*^9}, {3.4940760088967113`*^9, 3.494076015034974*^9}, { 3.494076241625298*^9, 3.494076244533634*^9}, {3.494076307514213*^9, 3.4940763784916487`*^9}, {3.4940764092432547`*^9, 3.4940764116571293`*^9}, {3.494076447019372*^9, 3.494076461382823*^9}, { 3.494076537369979*^9, 3.494076551010339*^9}, {3.494076711347979*^9, 3.49407672774135*^9}, {3.494076814124867*^9, 3.4940768790028133`*^9}, { 3.494076994966422*^9, 3.494077024890605*^9}, {3.494077062268407*^9, 3.4940770831257*^9}, {3.494077114511853*^9, 3.494077140604163*^9}, { 3.494077193850636*^9, 3.4940771990357723`*^9}, {3.49407730263658*^9, 3.4940773559533997`*^9}, {3.494077474000595*^9, 3.494077508969043*^9}, { 3.4940775797941732`*^9, 3.494077677462789*^9}, {3.494077736293861*^9, 3.4940777698925247`*^9}, {3.4940778746953707`*^9, 3.4940779673676357`*^9}, {3.494078035650834*^9, 3.494078071333061*^9}, { 3.494078259798606*^9, 3.494078260179132*^9}, {3.494078596155792*^9, 3.494078615890362*^9}, 3.494079256708661*^9, {3.494079292200012*^9, 3.4940792965200977`*^9}, {3.4940793569987926`*^9, 3.494079357664956*^9}, { 3.4940794036380367`*^9, 3.494079404200553*^9}, {3.494079914602522*^9, 3.4940799460225897`*^9}, {3.4940902819127407`*^9, 3.494090307069848*^9}, { 3.494090352899435*^9, 3.494090359131743*^9}, 3.49409039971238*^9, { 3.4940904752921333`*^9, 3.494090516414402*^9}, {3.494090571936651*^9, 3.494090638160762*^9}, {3.494090870036098*^9, 3.494090931210271*^9}, { 3.494090961504714*^9, 3.4940909618392563`*^9}, {3.4940909937079277`*^9, 3.494091020073123*^9}, {3.494091205291463*^9, 3.494091209727302*^9}, { 3.494094428850566*^9, 3.494094479961986*^9}, {3.494094524291094*^9, 3.494094528778558*^9}, {3.494094573546096*^9, 3.4940945966733027`*^9}, { 3.4940946975527*^9, 3.494094733672225*^9}, {3.494094773602724*^9, 3.494094837186454*^9}, {3.494094888145965*^9, 3.494094905095621*^9}, { 3.494095120550211*^9, 3.494095185606677*^9}, {3.494095261101117*^9, 3.49409527531693*^9}, {3.4940953418385*^9, 3.494095354905623*^9}, { 3.494095473042644*^9, 3.4940954737693996`*^9}, {3.4940955077882423`*^9, 3.494095559819892*^9}, {3.494095637338377*^9, 3.494095707638104*^9}, { 3.494133513027673*^9, 3.494133513228163*^9}, {3.49413355312712*^9, 3.494133575167144*^9}, {3.4941336351842833`*^9, 3.49413366911605*^9}, { 3.4941336999679728`*^9, 3.494133700507442*^9}, {3.494133752687532*^9, 3.4941338115387163`*^9}, {3.494133971314588*^9, 3.494133971732646*^9}, { 3.494134291651559*^9, 3.49413429181942*^9}, {3.494135424181858*^9, 3.4941354728902283`*^9}, {3.494135549799852*^9, 3.4941355500051126`*^9}, { 3.494135646703759*^9, 3.494135731418192*^9}, {3.494135779363648*^9, 3.494135784825714*^9}, {3.49413584022646*^9, 3.494135847823722*^9}, { 3.494135908666024*^9, 3.494135941364764*^9}, {3.494136150401306*^9, 3.4941361609426727`*^9}, {3.494136197553549*^9, 3.494136286772696*^9}, { 3.494136373550713*^9, 3.494136405695548*^9}, {3.494136453590515*^9, 3.4941364583888607`*^9}, {3.4941365376842117`*^9, 3.49413654516884*^9}, { 3.494136589971884*^9, 3.494136678396908*^9}, 3.494137676633409*^9, { 3.494137909255838*^9, 3.494137914242082*^9}, {3.4941381614913673`*^9, 3.494138168579432*^9}, {3.494238112636331*^9, 3.4942381132270203`*^9}, { 3.494238148450502*^9, 3.494238150788806*^9}, {3.494238275654964*^9, 3.494238276018092*^9}, {3.4943076883561907`*^9, 3.49430773474129*^9}, { 3.4943077663390427`*^9, 3.4943079658096647`*^9}, {3.494308021831497*^9, 3.494308092214404*^9}, {3.4943082755437727`*^9, 3.494308275910287*^9}, { 3.494308339673571*^9, 3.494308340057268*^9}, {3.4943084009747047`*^9, 3.494308427682293*^9}, {3.494308462681525*^9, 3.494308509205832*^9}, { 3.494308580085182*^9, 3.494308707550172*^9}, {3.494308791332933*^9, 3.494308796556918*^9}, {3.494308901770082*^9, 3.494308988293062*^9}, { 3.494309019940228*^9, 3.494309022586792*^9}, {3.494309054467058*^9, 3.494309057431747*^9}, {3.494309180277647*^9, 3.494309208937415*^9}, { 3.494309306201035*^9, 3.494309313130443*^9}, 3.4943093621676407`*^9, { 3.4943093955683737`*^9, 3.494309398901514*^9}, {3.4943094290912323`*^9, 3.494309488949274*^9}, {3.494309580566955*^9, 3.494309784797051*^9}, { 3.494309858298212*^9, 3.4943099260191507`*^9}, {3.4943100011638517`*^9, 3.494310108416808*^9}, {3.49431016803299*^9, 3.494310168635335*^9}, { 3.494310415165038*^9, 3.494310612051969*^9}, {3.494310716072035*^9, 3.494310719841333*^9}, {3.4943108027860727`*^9, 3.494310807717009*^9}, { 3.494310890388713*^9, 3.494310891304124*^9}, {3.494310967410136*^9, 3.494310971372052*^9}, {3.494311041123472*^9, 3.494311084731254*^9}, { 3.4943139197943983`*^9, 3.494314031158099*^9}, {3.494314071814315*^9, 3.494314076436386*^9}, {3.4943141581070747`*^9, 3.4943142286886177`*^9}, { 3.4943144213026743`*^9, 3.494314506532893*^9}, {3.494314888029264*^9, 3.494314889649472*^9}, 3.494315094357512*^9, {3.494315196846136*^9, 3.494315221339405*^9}, {3.494315301581521*^9, 3.4943153614420433`*^9}, { 3.494315395590481*^9, 3.494315401833273*^9}, {3.494315522734777*^9, 3.4943155282021646`*^9}, {3.494316045951558*^9, 3.494316106605021*^9}, { 3.494316189888866*^9, 3.4943162802814302`*^9}, 3.494316333219812*^9, { 3.49431645321846*^9, 3.494316490656313*^9}, {3.4943165889960127`*^9, 3.494316664746724*^9}, {3.49586291584967*^9, 3.495862934878119*^9}, { 3.495862972539403*^9, 3.495862977169921*^9}, {3.495863010527728*^9, 3.495863028086934*^9}, {3.4958631480641127`*^9, 3.4958631814624968`*^9}, { 3.496650009504912*^9, 3.496650457569428*^9}, {3.496650646035232*^9, 3.496650676485175*^9}, {3.496650712360402*^9, 3.4966508984958143`*^9}, 3.496650942520595*^9, {3.496651046487007*^9, 3.496651055336973*^9}, 3.496651117492548*^9, {3.496651652554225*^9, 3.496651722680667*^9}, 3.49665183097364*^9, {3.4966897100648365`*^9, 3.4966897417056637`*^9}, { 3.4966897895653453`*^9, 3.4966898391281624`*^9}, {3.4966898879566*^9, 3.496689891097245*^9}, {3.496691139386484*^9, 3.496691140011488*^9}, 3.4966911901993093`*^9, {3.4966912412933865`*^9, 3.4966912723717103`*^9}, { 3.4977128840784693`*^9, 3.4977128897050314`*^9}, {3.497719613581461*^9, 3.497719629275008*^9}}, CellID->2033897950] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ TagBox[ StyleBox[ DynamicModuleBox[{$CellContext`annulusthickness$$ = 0.1, $CellContext`axisframe$$ = 3, $CellContext`color$$ = RGBColor[ 0, 1, 0], $CellContext`externalshaperotation$$ = 0, $CellContext`internalshaperotation$$ = -0.7853981633974483, \ $CellContext`invertinput$$ = False, $CellContext`latticetype$$ = 1, $CellContext`logbrightnessscaling$$ = 1, $CellContext`loggridspacingx$$ = -0.5, $CellContext`loggridspacingy$$ \ = -0.5, $CellContext`logintensity$$ = False, $CellContext`logradius$$ = {-1, -1}, $CellContext`nx$$ = 1, $CellContext`ny$$ = 1, $CellContext`pluszerozero$$ = False, $CellContext`rotation$$ = 0, $CellContext`type$$ = 16, Typeset`show$$ = True, Typeset`bookmarkList$$ = {}, Typeset`bookmarkMode$$ = "Menu", Typeset`animator$$, Typeset`animvar$$ = 1, Typeset`name$$ = "\"untitled\"", Typeset`specs$$ = {{ Hold[ Style["aperture shape controls", Bold]], Manipulate`Dump`ThisIsNotAControl}, {{ Hold[$CellContext`type$$], 16, "type"}, { 16 -> "disk", 15 -> "annulus", 14 -> "slit", 13 -> "Gaussian", 3 -> "triangle", 4 -> "square", 5 -> "pentagon", 6 -> "hexagon", 7 -> "heptagon", 8 -> "octagon", 9 -> "nonagon", 10 -> "decagon", 11 -> "undecagon", 12 -> "dodecagon", 17 -> "T", 19 -> "7", 20 -> "cross 1", 21 -> "cross 2", 23 -> "A", 22 -> "S"}}, {{ Hold[$CellContext`logradius$$], {-1, -1}, Tooltip["scaling", "logarithmic scale"]}, {-2, -2}, { Rational[1, 2] (Log[2]/Log[10]), Rational[1, 2] (Log[2]/Log[10])}}, {{ Hold[$CellContext`annulusthickness$$], 0.1, "line width"}, 0, 1}, {{ Hold[$CellContext`internalshaperotation$$], -0.7853981633974483, "internal shape rotation"}, -Pi, Pi}, {{ Hold[$CellContext`externalshaperotation$$], 0, "external shape rotation"}, -Pi, Pi}, { Hold[ Style["lattice controls", Bold]], Manipulate`Dump`ThisIsNotAControl}, {{ Hold[$CellContext`latticetype$$], 1, "lattice type"}, { 1 -> "comb", 3 -> "triangle", 4 -> "square", 5 -> "pentagon", 6 -> "hexagon", 7 -> "heptagon", 8 -> "octagon", 9 -> "nonagon", 10 -> "decagon", 11 -> "undecagon", 12 -> "dodecagon"}}, { Hold[ Style["comb number", Bold]], Manipulate`Dump`ThisIsNotAControl}, {{ Hold[$CellContext`pluszerozero$$], False, "zero\[Hyphen]point"}, { True, False}}, {{ Hold[$CellContext`nx$$], 1, "x axis"}, 0, 10, 1}, {{ Hold[$CellContext`ny$$], 1, "y axis"}, 0, 10, 1}, { Hold[ Style["\!\(\*SubscriptBox[\(Log\), \(10\)]\)(comb spacing)", Bold]], Manipulate`Dump`ThisIsNotAControl}, {{ Hold[$CellContext`loggridspacingx$$], -0.5, "x axis \!\(\*SubscriptBox[\(d\), \(x\)]\)"}, -2, 0.5}, {{ Hold[$CellContext`loggridspacingy$$], -0.5, "y axis \!\(\*SubscriptBox[\(d\), \(Y\)]\)"}, -2, 0.5}, { Hold[ Style["whole image controls", Bold]], Manipulate`Dump`ThisIsNotAControl}, {{ Hold[$CellContext`rotation$$], 0, "rotation"}, 0, 2 Pi}, {{ Hold[$CellContext`invertinput$$], False, "invert input aperture"}, { True, False}}, {{ Hold[$CellContext`logintensity$$], False, "log of intensity"}, { True, False}}, {{ Hold[$CellContext`logbrightnessscaling$$], 1, Tooltip["scaling", "logarithmic scale"]}, -4, 3}, { Hold[$CellContext`color$$], RGBColor[0, 1, 0]}, {{ Hold[$CellContext`axisframe$$], 3, "display type"}, { 2 -> "fast", 4 -> "color", 3 -> "axes"}}}, Typeset`size$$ = { 246., {244., 248.}}, Typeset`update$$ = 0, Typeset`initDone$$, Typeset`skipInitDone$$ = False, $CellContext`type$8469$$ = False, $CellContext`logradius$8470$$ = {0, 0}, $CellContext`annulusthickness$8471$$ = 0, $CellContext`internalshaperotation$8472$$ = 0, $CellContext`externalshaperotation$8473$$ = 0, $CellContext`latticetype$8474$$ = False, $CellContext`pluszerozero$8475$$ = False, $CellContext`nx$8476$$ = 0, $CellContext`ny$8477$$ = 0, $CellContext`loggridspacingx$8478$$ = 0, $CellContext`loggridspacingy$8479$$ = 0, $CellContext`rotation$8480$$ = 0, $CellContext`invertinput$8481$$ = False}, DynamicBox[Manipulate`ManipulateBoxes[ 1, StandardForm, "Variables" :> {$CellContext`annulusthickness$$ = 0.1, $CellContext`axisframe$$ = 3, $CellContext`color$$ = RGBColor[0, 1, 0], $CellContext`externalshaperotation$$ = 0, $CellContext`internalshaperotation$$ = -0.7853981633974483, \ $CellContext`invertinput$$ = False, $CellContext`latticetype$$ = 1, $CellContext`logbrightnessscaling$$ = 1, $CellContext`loggridspacingx$$ = -0.5, \ $CellContext`loggridspacingy$$ = -0.5, $CellContext`logintensity$$ = False, $CellContext`logradius$$ = {-1, -1}, $CellContext`nx$$ = 1, $CellContext`ny$$ = 1, $CellContext`pluszerozero$$ = False, $CellContext`rotation$$ = 0, $CellContext`type$$ = 16}, "ControllerVariables" :> { Hold[$CellContext`type$$, $CellContext`type$8469$$, False], Hold[$CellContext`logradius$$, $CellContext`logradius$8470$$, {0, 0}], Hold[$CellContext`annulusthickness$$, \ $CellContext`annulusthickness$8471$$, 0], Hold[$CellContext`internalshaperotation$$, \ $CellContext`internalshaperotation$8472$$, 0], Hold[$CellContext`externalshaperotation$$, \ $CellContext`externalshaperotation$8473$$, 0], Hold[$CellContext`latticetype$$, $CellContext`latticetype$8474$$, False], Hold[$CellContext`pluszerozero$$, $CellContext`pluszerozero$8475$$, False], Hold[$CellContext`nx$$, $CellContext`nx$8476$$, 0], Hold[$CellContext`ny$$, $CellContext`ny$8477$$, 0], Hold[$CellContext`loggridspacingx$$, \ $CellContext`loggridspacingx$8478$$, 0], Hold[$CellContext`loggridspacingy$$, \ $CellContext`loggridspacingy$8479$$, 0], Hold[$CellContext`rotation$$, $CellContext`rotation$8480$$, 0], Hold[$CellContext`invertinput$$, $CellContext`invertinput$8481$$, False]}, "OtherVariables" :> { Typeset`show$$, Typeset`bookmarkList$$, Typeset`bookmarkMode$$, Typeset`animator$$, Typeset`animvar$$, Typeset`name$$, Typeset`specs$$, Typeset`size$$, Typeset`update$$, Typeset`initDone$$, Typeset`skipInitDone$$}, "Body" :> Module[{$CellContext`inputprimitives$, $CellContext`inputgraphic$, \ $CellContext`inputplaneimage$, $CellContext`inputplane$, $CellContext`ftim$, \ $CellContext`ftimg$, $CellContext`inputplanegreen$, $CellContext`a$, \ $CellContext`b$, $CellContext`c$, $CellContext`d$, $CellContext`e$, \ $CellContext`ir$, $CellContext`ft$, $CellContext`ftab2$}, $CellContext`gsc[ Pattern[$CellContext`image$, Blank[]]] := $CellContext`gsc[$CellContext`image$, \ $CellContext`color$$]; $CellContext`inputprimitives$ = Rotate[ If[$CellContext`latticetype$$ == 1, $CellContext`convoluteshapewithcomb[$CellContext`type$$, \ $CellContext`nx$$, $CellContext`ny$$, 10^$CellContext`logradius$$, { 10^$CellContext`loggridspacingx$$, 10^$CellContext`loggridspacingy$$}, \ $CellContext`internalshaperotation$$, $CellContext`externalshaperotation$$, \ $CellContext`annulusthickness$$], $CellContext`convoluteshapewithpolygongrid[$CellContext`type$$, \ $CellContext`latticetype$$, 10^$CellContext`logradius$$, { 10^$CellContext`loggridspacingx$$, 10^$CellContext`loggridspacingy$$}, \ $CellContext`internalshaperotation$$, $CellContext`externalshaperotation$$, \ $CellContext`annulusthickness$$, $CellContext`pluszerozero$$]], \ $CellContext`rotation$$]; If[$CellContext`invertinput$$, $CellContext`inputplaneimage$ = ColorNegate[ Image[ ColorConvert[ Graphics[{White, $CellContext`inputprimitives$}, PlotRange -> $CellContext`plotrange, ImageSize -> {$CellContext`resolution, \ $CellContext`resolution}, Frame -> False, Background -> Black], "Grayscale"]]], $CellContext`inputplaneimage$ = Image[ ColorConvert[ Graphics[{White, $CellContext`inputprimitives$}, PlotRange -> $CellContext`plotrange, ImageSize -> {$CellContext`resolution, $CellContext`resolution}, Frame -> False, Background -> Black], "Grayscale"]]]; $CellContext`inputplane$ = ImageData[$CellContext`inputplaneimage$]; $CellContext`ft$ = Abs[ $CellContext`spl[ Fourier[$CellContext`inputplane$]]]; $CellContext`ftab2$ = Abs[$CellContext`ft$]^2; If[$CellContext`logintensity$$, $CellContext`e$ = Log[1 10^(-5) + $CellContext`ftab2$]; $CellContext`d$ = 4 $CellContext`logbrightnessscaling$$ + $CellContext`e$; \ $CellContext`c$ = $CellContext`e$ + 10; $CellContext`ir$ = All, $CellContext`c$ = ($CellContext`d$ = 10^$CellContext`logbrightnessscaling$$ $CellContext`ftab2$); \ $CellContext`ir$ = {0, 1}]; $CellContext`ftim$ = Image[$CellContext`d$]; Switch[$CellContext`axisframe$$, 3, $CellContext`a$ = Graphics[{ Inset[ $CellContext`gsc[$CellContext`inputplaneimage$], {0, 0}, Center, $CellContext`range], Inset[ ListLinePlot[ Part[$CellContext`inputplane$, Part[$CellContext`resolution, 1]/2 + 1], DataRange -> Part[$CellContext`plotrange, 1], Axes -> False, PlotStyle -> Directive[Blue, Thick], AspectRatio -> 0.2, PlotRange -> Automatic], Scaled[{0.5, 0.05}], {0, 0}, 2], Inset[ ListLinePlot[ Part[$CellContext`inputplane$, All, Part[$CellContext`resolution, 1]/2 + 1], DataRange -> Part[$CellContext`plotrange, 2], Axes -> False, PlotStyle -> Directive[Blue, Thick], AspectRatio -> 0.2, PlotRange -> Automatic], Scaled[{0.95, 0.5}], {0, 0}, 2, {0, 1}]}, PlotRange -> $CellContext`plotrange, Frame -> True, ImagePadding -> $CellContext`pad, FrameLabel -> { Style["x/\[Lambda]", Black, Italic], Style["y/\[Lambda]", Black, Italic]}, LabelStyle -> Directive[Black, 12], FrameTicks -> Automatic, FrameTicksStyle -> Directive[Black], FrameStyle -> Directive[White], RotateLabel -> False]; $CellContext`b$ = Graphics[{ Inset[ $CellContext`gsc[$CellContext`ftim$], {0, 0}, Center, $CellContext`krange], Inset[ ListLinePlot[ Part[$CellContext`c$, Part[$CellContext`resolution, 1]/2 + 1], DataRange -> Part[$CellContext`kplotrange, 1], Axes -> False, PlotStyle -> Directive[Blue, Thick], AspectRatio -> 0.2, PlotRange -> {Full, $CellContext`ir$}], Scaled[{0.5, 0.05}], {0, 0}, $CellContext`krange], Inset[ ListLinePlot[ Part[$CellContext`c$, All, Part[$CellContext`resolution, 1]/2 + 1], DataRange -> Part[$CellContext`kplotrange, 2], Axes -> False, PlotStyle -> Directive[Blue, Thick], AspectRatio -> 0.2, PlotRange -> {Full, $CellContext`ir$}], Scaled[{0.95, 0.5}], {0, 0}, $CellContext`krange, {0, 1}]}, PlotRange -> $CellContext`kplotrange, Frame -> True, ImagePadding -> $CellContext`pad, FrameLabel -> { Style["\!\(\*SubscriptBox[\(k\), \(x\)]\)", Black], Style["\!\(\*SubscriptBox[\(k\), \(y\)]\)", Black]}, LabelStyle -> Directive[Black, 12], FrameTicks -> Automatic, FrameTicksStyle -> Directive[Black], FrameStyle -> Directive[White], RotateLabel -> False]; GraphicsGrid[{{$CellContext`a$}, {$CellContext`b$}}, ImageSize -> {1, 2} $CellContext`resolution, Spacings -> {0, 0}], 2, GraphicsGrid[{{$CellContext`inputplaneimage$}, \ {$CellContext`ftim$}}, ImageSize -> {1, 2} $CellContext`resolution, Spacings -> {0, 0}], 4, GraphicsGrid[{{ $CellContext`gsc[$CellContext`inputplaneimage$]}, { $CellContext`gsc[$CellContext`ftim$]}}, ImageSize -> {1, 2} $CellContext`resolution, Spacings -> {0, 0}]]], "Specifications" :> { Style[ "aperture shape controls", Bold], {{$CellContext`type$$, 16, "type"}, { 16 -> "disk", 15 -> "annulus", 14 -> "slit", 13 -> "Gaussian", 3 -> "triangle", 4 -> "square", 5 -> "pentagon", 6 -> "hexagon", 7 -> "heptagon", 8 -> "octagon", 9 -> "nonagon", 10 -> "decagon", 11 -> "undecagon", 12 -> "dodecagon", 17 -> "T", 19 -> "7", 20 -> "cross 1", 21 -> "cross 2", 23 -> "A", 22 -> "S"}}, {{$CellContext`logradius$$, {-1, -1}, Tooltip["scaling", "logarithmic scale"]}, {-2, -2}, { Rational[1, 2] (Log[2]/Log[10]), Rational[1, 2] (Log[2]/Log[10])}, ImageSize -> Small}, {{$CellContext`annulusthickness$$, 0.1, "line width"}, 0, 1, ImageSize -> Tiny}, {{$CellContext`internalshaperotation$$, -0.7853981633974483, "internal shape rotation"}, -Pi, Pi, ImageSize -> Tiny}, {{$CellContext`externalshaperotation$$, 0, "external shape rotation"}, -Pi, Pi, ImageSize -> Tiny}, Delimiter, Style[ "lattice controls", Bold], {{$CellContext`latticetype$$, 1, "lattice type"}, { 1 -> "comb", 3 -> "triangle", 4 -> "square", 5 -> "pentagon", 6 -> "hexagon", 7 -> "heptagon", 8 -> "octagon", 9 -> "nonagon", 10 -> "decagon", 11 -> "undecagon", 12 -> "dodecagon"}}, Style[ "comb number", Bold], {{$CellContext`pluszerozero$$, False, "zero\[Hyphen]point"}, { True, False}}, {{$CellContext`nx$$, 1, "x axis"}, 0, 10, 1, ImageSize -> Tiny}, {{$CellContext`ny$$, 1, "y axis"}, 0, 10, 1, ImageSize -> Tiny}, Style[ "\!\(\*SubscriptBox[\(Log\), \(10\)]\)(comb spacing)", Bold], {{$CellContext`loggridspacingx$$, -0.5, "x axis \!\(\*SubscriptBox[\(d\), \(x\)]\)"}, -2, 0.5, ImageSize -> Tiny}, {{$CellContext`loggridspacingy$$, -0.5, "y axis \!\(\*SubscriptBox[\(d\), \(Y\)]\)"}, -2, 0.5, ImageSize -> Tiny}, Delimiter, Style[ "whole image controls", Bold], {{$CellContext`rotation$$, 0, "rotation"}, 0, 2 Pi, ImageSize -> Tiny}, {{$CellContext`invertinput$$, False, "invert input aperture"}, { True, False}}, {{$CellContext`logintensity$$, False, "log of intensity"}, { True, False}}, {{$CellContext`logbrightnessscaling$$, 1, Tooltip["scaling", "logarithmic scale"]}, -4, 3, ImageSize -> Tiny}, {$CellContext`color$$, RGBColor[0, 1, 0]}, {{$CellContext`axisframe$$, 3, "display type"}, { 2 -> "fast", 4 -> "color", 3 -> "axes"}, ControlType -> PopupMenu}}, "Options" :> { ContinuousAction -> True, TrackedSymbols -> True, ControlPlacement -> Left}, "DefaultOptions" :> {ControllerLinking -> True}], ImageSizeCache->{593., {272., 277.}}, SingleEvaluation->True], Deinitialization:>None, DynamicModuleValues:>{}, Initialization:>(( Get["Polytopes`"]; $CellContext`resolution = {246, 246}; $CellContext`nullim = Image[ ConstantArray[0, $CellContext`resolution]]; $CellContext`pad = {{50, 20}, {35, 10}}; $CellContext`plotrange = {{-1, 1}, {-1, 1}}; $CellContext`range = {Max[ Part[$CellContext`plotrange, 1]] - Min[ Part[$CellContext`plotrange, 1]], Max[ Part[$CellContext`plotrange, 1]] - Min[ Part[$CellContext`plotrange, 2]]}; $CellContext`dxdy = \ $CellContext`range/$CellContext`resolution; $CellContext`kplotrange = {{(-Pi)/ Part[$CellContext`dxdy, 1], Pi/Part[$CellContext`dxdy, 1]}, {(-Pi)/ Part[$CellContext`dxdy, 2], Pi/ Part[$CellContext`dxdy, 2]}}; $CellContext`krange = {Max[ Part[$CellContext`kplotrange, 1]] - Min[ Part[$CellContext`kplotrange, 1]], Max[ Part[$CellContext`kplotrange, 1]] - Min[ Part[$CellContext`kplotrange, 2]]}; $CellContext`pointdensity = Max[$CellContext`resolution]/Max[$CellContext`range]; $CellContext`spl[ Pattern[$CellContext`array, Blank[]]] := Module[{$CellContext`part}, $CellContext`part = Partition[$CellContext`array, Dimensions[$CellContext`array]/2]; Join[ Join[ Part[$CellContext`part, 2, 2], Part[$CellContext`part, 2, 1], 2], Join[ Part[$CellContext`part, 1, 2], Part[$CellContext`part, 1, 1], 2], 1]]; $CellContext`gaussraster[ Pattern[$CellContext`res, Blank[]]] := Raster[ Table[{ 1, E^(-($CellContext`x^2/( 2 (Part[$CellContext`res, 1]/6)^2) + $CellContext`y^2/( 2 (Part[$CellContext`res, 2]/6)^2)))}, {$CellContext`x, (- Part[$CellContext`res, 1])/2, Part[$CellContext`res, 1]/2, 1}, {$CellContext`y, (-Part[$CellContext`res, 2])/2, Part[$CellContext`res, 2]/2, 1}], {{-6, -6}, {6, 6}}]; $CellContext`shape[ Pattern[$CellContext`type, Blank[]], Pattern[$CellContext`position, Blank[]], Pattern[$CellContext`radius, Blank[]], Pattern[$CellContext`internalshaperotation, Blank[]], Pattern[$CellContext`externalshaperotation, Blank[]], Pattern[$CellContext`annulusthickness, Blank[]]] := Module[{$CellContext`trafo, $CellContext`baser}, $CellContext`trafo = Composition[ RotationTransform[$CellContext`externalshaperotation, \ $CellContext`position], TranslationTransform[$CellContext`position], ScalingTransform[$CellContext`radius], RotationTransform[$CellContext`internalshaperotation]]; Switch[$CellContext`type, 3, Polygon[ $CellContext`trafo[ Polytopes`Vertices[Polytopes`Triangle]]], 4, Polygon[ $CellContext`trafo[ Polytopes`Vertices[Polytopes`Square]]], 5, Polygon[ $CellContext`trafo[ Polytopes`Vertices[Polytopes`Pentagon]]], 6, Polygon[ $CellContext`trafo[ Polytopes`Vertices[Polytopes`Hexagon]]], 7, Polygon[ $CellContext`trafo[ Polytopes`Vertices[Polytopes`Heptagon]]], 8, Polygon[ $CellContext`trafo[ Polytopes`Vertices[Polytopes`Octagon]]], 9, Polygon[ $CellContext`trafo[ Polytopes`Vertices[Polytopes`Nonagon]]], 10, Polygon[ $CellContext`trafo[ Polytopes`Vertices[Polytopes`Decagon]]], 11, Polygon[ $CellContext`trafo[ Polytopes`Vertices[Polytopes`Undecagon]]], 12, Polygon[ $CellContext`trafo[ Polytopes`Vertices[Polytopes`Dodecagon]]], 16, GeometricTransformation[ Disk[], $CellContext`trafo], 15, GeometricTransformation[{ Thickness[$CellContext`annulusthickness], Circle[]}, $CellContext`trafo], 14, Rotate[ Rectangle[{ Part[$CellContext`position, 1] - Part[$CellContext`radius, 1], 1.5 Min[$CellContext`plotrange]}, { Part[$CellContext`position, 1] + Part[$CellContext`radius, 1], 1.5 Max[$CellContext`plotrange]}], \ $CellContext`externalshaperotation], 13, GeometricTransformation[ $CellContext`gaussraster[( 6 $CellContext`pointdensity) $CellContext`radius], \ $CellContext`trafo], 19, GeometricTransformation[{ Thickness[$CellContext`annulusthickness], CapForm["Butt"], Line[ N[{{-(3^Rational[1, 2]/2), 1/2}, {3^Rational[1, 2]/2, 1/2}, { 0, -1}}]]}, $CellContext`trafo], 20, GeometricTransformation[{ Thickness[$CellContext`annulusthickness], CapForm["Butt"], Line[ N[{{{-(3^Rational[1, 2]/2), 0}, {3^Rational[1, 2]/2, 0}}, {{ 3^Rational[1, 2]/2, 1/2}, {0, -1}}}]]}, $CellContext`trafo], 21, GeometricTransformation[{ Thickness[$CellContext`annulusthickness], CapForm["Butt"], Line[ N[{{{-(3^Rational[1, 2]/2), 0}, {3^Rational[1, 2]/2, 0}}, {{ 3^Rational[1, 2]/4, 1/ 2}, {-(3^Rational[1, 2]/4), -1}}}]]}, $CellContext`trafo], 17, GeometricTransformation[{ Thickness[$CellContext`annulusthickness], CapForm["Butt"], Line[{{-0.5, 0.5}, {0.5, 0.5}, {0, 0.5}, { 0, -0.5}}]}, $CellContext`trafo], 22, GeometricTransformation[{ Thickness[$CellContext`annulusthickness], CapForm["Butt"], Circle[{0, 0.5}, 0.5, {0, 1.5 Pi}], Circle[{0, -0.5}, 0.5, {Pi, 2.5 Pi}]}, $CellContext`trafo], 23, GeometricTransformation[{ Thickness[$CellContext`annulusthickness], CapForm["Butt"], Line[ N[{{3^Rational[1, 2]/2, -(3/4)}, { 0, 3/4}, {-(3^Rational[1, 2]/2), -(3/4)}}]], Line[ N[{{3^Rational[1, 2]/4, 0/4}, {-(3^Rational[1, 2]/4), 0/ 4}}]]}, $CellContext`trafo]]]; \ $CellContext`convoluteshapewithcomb[ Pattern[$CellContext`type, Blank[]], Pattern[$CellContext`nx, Blank[]], Pattern[$CellContext`ny, Blank[]], Pattern[$CellContext`radius, Blank[]], Pattern[$CellContext`gridspacing, Blank[]], Pattern[$CellContext`internalshaperotation, Blank[]], Pattern[$CellContext`externalshaperotation, Blank[]], Pattern[$CellContext`annulusthickness, Blank[]]] := Table[ $CellContext`shape[$CellContext`type, {$CellContext`x, \ $CellContext`y}, $CellContext`radius, $CellContext`internalshaperotation, \ $CellContext`externalshaperotation, $CellContext`annulusthickness], \ {$CellContext`x, ((-($CellContext`nx - 1)) 0.5) Part[$CellContext`gridspacing, 1], (Plus[$CellContext`nx - 1] 0.5) Part[$CellContext`gridspacing, 1], Part[$CellContext`gridspacing, 1]}, {$CellContext`y, ((-($CellContext`ny - 1)) 0.5) Part[$CellContext`gridspacing, 2], (Plus[$CellContext`ny - 1] 0.5) Part[$CellContext`gridspacing, 2], Part[$CellContext`gridspacing, 2]}]; $CellContext`convoluteshapewithpolygongrid[ Pattern[$CellContext`type, Blank[]], Pattern[$CellContext`latticen, Blank[]], Pattern[$CellContext`radius, Blank[]], Pattern[$CellContext`gridspacing, Blank[]], Pattern[$CellContext`internalshaperotation, Blank[]], Pattern[$CellContext`externalshaperotation, Blank[]], Pattern[$CellContext`annulusthickness, Blank[]], Pattern[$CellContext`pluszerozero, Blank[]]] := Module[{$CellContext`points, $CellContext`latticetype}, \ $CellContext`latticetype = Switch[$CellContext`latticen, 3, Polytopes`Triangle, 4, Polytopes`Square, 5, Polytopes`Pentagon, 6, Polytopes`Hexagon, 7, Polytopes`Heptagon, 8, Polytopes`Octagon, 9, Polytopes`Nonagon, 10, Polytopes`Decagon, 11, Polytopes`Undecagon, 12, Polytopes`Dodecagon]; $CellContext`points = If[$CellContext`pluszerozero, ConstantArray[$CellContext`gridspacing, Polytopes`NumberOfVertices[$CellContext`latticetype] + 1] Append[ Polytopes`Vertices[$CellContext`latticetype], {0, 0}], ConstantArray[$CellContext`gridspacing, Polytopes`NumberOfVertices[$CellContext`latticetype]] Polytopes`Vertices[$CellContext`latticetype]]; Table[ $CellContext`shape[$CellContext`type, $CellContext`p, \ $CellContext`radius, $CellContext`internalshaperotation, \ $CellContext`externalshaperotation, $CellContext`annulusthickness], \ {$CellContext`p, $CellContext`points}]]; $CellContext`gsc[ Pattern[$CellContext`image, Blank[]], RGBColor[ Pattern[$CellContext`r, Blank[]], Pattern[$CellContext`g, Blank[]], Pattern[$CellContext`b, Blank[]]]] := Module[{$CellContext`d}, $CellContext`d = ImageData[$CellContext`image]; ColorCombine[{ Image[$CellContext`r $CellContext`d], Image[$CellContext`g $CellContext`d], Image[$CellContext`b $CellContext`d]}]]; $CellContext`gsc[ Pattern[$CellContext`image, Blank[]], GrayLevel[ Pattern[$CellContext`v, Blank[]]]] := Module[{$CellContext`d}, $CellContext`d = ImageData[$CellContext`image]; ColorCombine[{ Image[$CellContext`v $CellContext`d], Image[$CellContext`v $CellContext`d], Image[$CellContext`v $CellContext`d]}]]; Null); Typeset`initDone$$ = True), SynchronousInitialization->True, UnsavedVariables:>{Typeset`initDone$$}, UntrackedVariables:>{Typeset`size$$}], "Manipulate", Deployed->True, StripOnInput->False], Manipulate`InterpretManipulate[1]]], "Output", CellID->577292299], Cell[CellGroupData[{ Cell["CAPTION", "Section", CellFrame->{{0, 0}, {1, 0}}, CellFrameColor->RGBColor[0.87, 0.87, 0.87], FontFamily->"Helvetica", FontSize->12, FontWeight->"Bold", FontColor->RGBColor[0.597406, 0, 0.0527047]], Cell["\<\ This Demonstration shows an aperture (top) and its 2D Fourier transform \ (bottom). These can be pictured as an aperture illuminated by plane waves and \ the diffraction pattern in an optical system with a small Fresnel number. \ Note how lines of symmetry are shared in the aperture and its Fourier \ transform and how these are preserved under rotations. Particularly important \ is the way that the Fourier transform scales with the aperture\[LongDash]if \ the aperture widens, then the Fourier transform narrows in the same \ direction, and vice versa. It is instructive to note how the same processes \ apply analogously when looking at lattices of apertures.\ \>", "Text"] }, Close]] }, Open ]], Cell[CellGroupData[{ Cell["THIS NOTEBOOK IS THE SOURCE CODE FROM", "Text", CellFrame->{{0, 0}, {0, 0}}, CellMargins->{{48, 10}, {4, 28}}, CellGroupingRules->{"SectionGrouping", 25}, CellFrameMargins->{{48, 48}, {6, 5}}, CellFrameColor->RGBColor[0.87, 0.87, 0.87], FontFamily->"Helvetica", FontSize->10, FontWeight->"Bold", FontColor->RGBColor[0.597406, 0, 0.0527047]], Cell[TextData[{ "\"", ButtonBox["2D Fourier Transforms", BaseStyle->"Hyperlink", ButtonData->{ URL["http://demonstrations.wolfram.com/2DFourierTransforms/"], None}, ButtonNote->"http://demonstrations.wolfram.com/2DFourierTransforms/"], "\"", " from ", ButtonBox["the Wolfram Demonstrations Project", BaseStyle->"Hyperlink", ButtonData->{ URL["http://demonstrations.wolfram.com/"], None}, ButtonNote->"http://demonstrations.wolfram.com/"], "\[ParagraphSeparator]\[NonBreakingSpace]", ButtonBox["http://demonstrations.wolfram.com/2DFourierTransforms/", BaseStyle->"Hyperlink", ButtonData->{ URL["http://demonstrations.wolfram.com/2DFourierTransforms/"], None}, ButtonNote->"http://demonstrations.wolfram.com/2DFourierTransforms/"] }], "Text", CellMargins->{{48, Inherited}, {0, Inherited}}, FontFamily->"Verdana", FontSize->10, FontColor->GrayLevel[0.5]], Cell[TextData[{ "Contributed by: ", ButtonBox["John Holland", BaseStyle->"Hyperlink", ButtonData->{ URL["http://demonstrations.wolfram.com/author.html?author=John+Holland"], None}, ButtonNote-> "http://demonstrations.wolfram.com/author.html?author=John+Holland"] }], "Text", CellDingbat->"\[FilledSmallSquare]", CellMargins->{{66, 48}, {2, 4}}, FontFamily->"Verdana", FontSize->10, FontColor->GrayLevel[0.6]], Cell[CellGroupData[{ Cell[TextData[{ "A full-function Wolfram ", StyleBox["Mathematica", FontSlant->"Italic"], " system (Version 6 or higher) is required to edit this notebook.\n", StyleBox[ButtonBox["GET WOLFRAM MATHEMATICA \[RightGuillemet]", BaseStyle->"Hyperlink", ButtonData->{ URL["http://www.wolfram.com/products/mathematica/"], None}, ButtonNote->"http://www.wolfram.com/products/mathematica/"], FontFamily->"Helvetica", FontWeight->"Bold", FontSlant->"Italic", FontColor->RGBColor[1, 0.42, 0]] }], "Text", CellFrame->True, CellMargins->{{48, 68}, {8, 28}}, CellFrameMargins->12, CellFrameColor->RGBColor[0.87, 0.87, 0.87], CellChangeTimes->{3.3750111182355957`*^9}, ParagraphSpacing->{1., 1.}, FontFamily->"Verdana", FontSize->10, FontColor->GrayLevel[0.411765], Background->RGBColor[1, 1, 1]], Cell[TextData[{ "\[Copyright] ", StyleBox[ButtonBox["Wolfram Demonstrations Project & Contributors", BaseStyle->"Hyperlink", ButtonData->{ URL["http://demonstrations.wolfram.com/"], None}, ButtonNote->"http://demonstrations.wolfram.com/"], FontColor->GrayLevel[0.6]], "\[ThickSpace]\[ThickSpace]\[ThickSpace]|\[ThickSpace]\[ThickSpace]\ \[ThickSpace]", StyleBox[ButtonBox["Terms of Use", BaseStyle->"Hyperlink", ButtonData->{ URL["http://demonstrations.wolfram.com/termsofuse.html"], None}, ButtonNote->"http://demonstrations.wolfram.com/termsofuse.html"], FontColor->GrayLevel[0.6]], "\[ThickSpace]\[ThickSpace]\[ThickSpace]|\[ThickSpace]\[ThickSpace]\ \[ThickSpace]", StyleBox[ButtonBox["Make a new version of this Demonstration \ \[RightGuillemet]", BaseStyle->"Hyperlink", ButtonData->{ URL["http://demonstrations.wolfram.com/participate/upload.jsp?id=\ 2DFourierTransforms"], None}, ButtonNote->None], FontColor->GrayLevel[0.6]] }], "Text", CellFrame->{{0, 0}, {0, 0.5}}, CellMargins->{{48, 10}, {20, 50}}, CellFrameMargins->{{6, 0}, {6, 6}}, CellFrameColor->GrayLevel[0.6], FontFamily->"Verdana", FontSize->9, FontColor->GrayLevel[0.6]] }, Open ]] }, Open ]] }, Editable->True, Saveable->False, ScreenStyleEnvironment->"Working", CellInsertionPointCell->None, WindowSize->{780, 650}, WindowMargins->{{Inherited, Inherited}, {Inherited, 0}}, WindowElements->{ "StatusArea", "MemoryMonitor", "MagnificationPopUp", "VerticalScrollBar", "MenuBar"}, WindowTitle->"2D Fourier Transforms - Source", DockedCells->{}, CellContext->Notebook, FrontEndVersion->"8.0 for Microsoft Windows (32-bit) (November 7, 2010)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[623, 23, 141, 3, 70, "Section"], Cell[767, 28, 3700, 64, 70, "Section"], Cell[4470, 94, 65086, 1419, 70, "Input", CellID->2033897950] }, Open ]], Cell[CellGroupData[{ Cell[69593, 1518, 26751, 546, 70, "Output", CellID->577292299], Cell[CellGroupData[{ Cell[96369, 2068, 209, 6, 70, "Section"], Cell[96581, 2076, 688, 10, 70, "Text"] }, Close]] }, Open ]], Cell[CellGroupData[{ Cell[97317, 2092, 355, 9, 70, "Text", CellGroupingRules->{"SectionGrouping", 25}], Cell[97675, 2103, 893, 24, 70, "Text"], Cell[98571, 2129, 433, 14, 70, "Text"], Cell[CellGroupData[{ Cell[99029, 2147, 815, 24, 70, "Text"], Cell[99847, 2173, 1191, 33, 70, "Text"] }, Open ]] }, Open ]] } ] *) (* End of internal cache information *) (* NotebookSignature VS4MC1MpP4LDTC0#uV7jML@N *)