summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/simpleoptics
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-09-06 21:12:46 +0000
committerKarl Berry <karl@freefriends.org>2019-09-06 21:12:46 +0000
commit7a8ac022f12717cefa5fd991e95b2d7f2742a4c7 (patch)
tree2e2b4edce88dd8daf8f6a55f504eaea2fadf0014 /Master/texmf-dist/tex/latex/simpleoptics
parentaf413422dd5b7743d4a7d8ec435e99f70783524d (diff)
simpleoptics (6sep19)
git-svn-id: svn://tug.org/texlive/trunk@52038 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/simpleoptics')
-rw-r--r--Master/texmf-dist/tex/latex/simpleoptics/simpleoptics.sty140
1 files changed, 140 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/simpleoptics/simpleoptics.sty b/Master/texmf-dist/tex/latex/simpleoptics/simpleoptics.sty
new file mode 100644
index 00000000000..6d24a6d266f
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/simpleoptics/simpleoptics.sty
@@ -0,0 +1,140 @@
+%%Author: Justin Cawood
+%%License: LPPL 1.3c
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{simpleoptics}[2019/09/05 v1.0.0 Simple Optics Package]
+\RequirePackage{tikz}
+
+%\mirror{x}{y}{focal length}{height}
+\newcommand{\mirror}[4]{
+
+
+ \pgfmathsetmacro{\mirrorX}{#1}
+ \pgfmathsetmacro{\mirrorY}{#2}
+
+ \pgfmathsetmacro{\mirrorRadius}{2*#3}
+ \pgfmathsetmacro{\mirrorHeight}{\mirrorY + #4}
+
+ \pgfmathsetmacro{\startAngle}{asin(\mirrorHeight/\mirrorRadius)}
+
+ \draw
+
+ (\mirrorX,\mirrorHeight) arc[start angle=180-\startAngle,delta angle=2*\startAngle,radius=\mirrorRadius]
+
+ ;
+}
+
+%\lens{x}{y}{focal length}{height}{thickness}
+\newcommand{\lens}[5]{
+
+
+ \pgfmathsetmacro{\lensX}{#1}
+ \pgfmathsetmacro{\lensY}{#2}
+ \pgfmathsetmacro{\lensRadius}{2*#3}
+ \pgfmathsetmacro{\lensHeight}{#4}
+ \pgfmathsetmacro{\lensThickness}{#5}
+
+ \pgfmathsetmacro{\lensXright}{\lensX +(0.5*\lensThickness)}
+ \pgfmathsetmacro{\lensXleft}{\lensX-(0.5*\lensThickness)}
+
+ \mirror{\lensXleft}{\lensY}{\lensRadius}{\lensHeight}
+ \mirror{\lensXright}{\lensY}{-\lensRadius}{\lensHeight}
+
+ \draw
+
+ (\lensXleft,\lensHeight) -- (\lensXright,\lensHeight)
+ (\lensXright,-\lensHeight) -- (\lensXleft,-\lensHeight)
+
+ ;
+}
+
+%\biconvexlens{x}{y}{focal length}{height}{thickness}
+\newcommand{\biconvexlens}[5]{
+\lens{#1}{#2}{#3}{#4}{#5}
+}
+
+%\biconcavelens{x}{y}{focal length}{height}{thickness}
+\newcommand{\biconcavelens}[5]{
+\lens{#1}{#2}{-#3}{#4}{#5}
+}
+
+%\concaveconvexlens{x}{y}{focal length}{height}{thickness}
+\newcommand{\concaveconvexlens}[5]{
+ \pgfmathsetmacro{\lensX}{#1}
+ \pgfmathsetmacro{\lensY}{#2}
+ \pgfmathsetmacro{\lensRadius}{-2*#3}
+ \pgfmathsetmacro{\lensHeight}{#4}
+ \pgfmathsetmacro{\lensThickness}{#5}
+
+ \pgfmathsetmacro{\lensXright}{\lensX +(0.5*\lensThickness)}
+ \pgfmathsetmacro{\lensXleft}{\lensX-(0.5*\lensThickness)}
+
+ \mirror{\lensXleft}{\lensY}{\lensRadius}{\lensHeight}
+ \mirror{\lensXright}{\lensY}{\lensRadius}{\lensHeight}
+
+ \draw
+
+ (\lensXleft,\lensHeight) -- (\lensXright,\lensHeight)
+ (\lensXright,-\lensHeight) -- (\lensXleft,-\lensHeight)
+
+ ;
+}
+
+%\convexconcavelens{x}{y}{focal length}{height}{thickness}
+\newcommand{\convexconcavelens}[5]{
+\concaveconvexlens{#1}{#2}{-#3}{#4}{#5}
+}
+
+%\rightplanoconvexlens{x}{y}{focal length}{height}{thickness}
+\newcommand{\rightplanoconvexlens}[5]{
+ \pgfmathsetmacro{\lensX}{#1}
+ \pgfmathsetmacro{\lensY}{#2}
+ \pgfmathsetmacro{\lensRadius}{2*#3}
+ \pgfmathsetmacro{\lensHeight}{#4}
+ \pgfmathsetmacro{\lensThickness}{#5}
+
+ \pgfmathsetmacro{\lensXright}{\lensX +(0.5*\lensThickness)}
+ \pgfmathsetmacro{\lensXleft}{\lensX-(0.5*\lensThickness)}
+
+ \mirror{\lensXleft}{\lensY}{\lensRadius}{\lensHeight}
+
+ \draw
+
+ (\lensXleft,\lensHeight) -- (\lensXright,\lensHeight)
+ (\lensXright,-\lensHeight) -- (\lensXleft,-\lensHeight)
+ (\lensXright,\lensHeight) -- (\lensXright,-\lensHeight)
+
+ ;
+}
+
+%\leftplanoconvexlens{x}{y}{focal length}{height}{thickness}
+\newcommand{\leftplanoconvexlens}[5]{
+\pgfmathsetmacro{\lensX}{#1}
+ \pgfmathsetmacro{\lensY}{#2}
+ \pgfmathsetmacro{\lensRadius}{2*#3}
+ \pgfmathsetmacro{\lensHeight}{#4}
+ \pgfmathsetmacro{\lensThickness}{#5}
+
+ \pgfmathsetmacro{\lensXright}{\lensX +(0.5*\lensThickness)}
+ \pgfmathsetmacro{\lensXleft}{\lensX-(0.5*\lensThickness)}
+
+ \mirror{\lensXright}{\lensY}{-\lensRadius}{\lensHeight}
+
+ \draw
+
+ (\lensXleft,\lensHeight) -- (\lensXright,\lensHeight)
+ (\lensXright,-\lensHeight) -- (\lensXleft,-\lensHeight)
+ (\lensXleft,\lensHeight) -- (\lensXleft,-\lensHeight)
+
+ ;
+}
+
+%\rightplanoconcavelens{x}{y}{focal length}{height}{thickness}
+\newcommand{\rightplanoconcavelens}[5]{
+\rightplanoconvexlens{#1}{#2}{-#3}{#4}{#5}
+}
+
+%\leftplanoconcavelens{x}{y}{focal length}{height}{thickness}
+\newcommand{\leftplanoconcavelens}[5]{
+\leftplanoconvexlens{#1}{#2}{-#3}{#4}{#5}
+} \ No newline at end of file