| 1 |
%% optikz version 1.1.0 |
| 2 |
%% Copyright (C) 2025 Martin Beyer |
| 3 |
% |
| 4 |
% This work may be distributed and/or modified under the |
| 5 |
% conditions of the LaTeX Project Public License, either version 1.3 |
| 6 |
% of this license or any later version. |
| 7 |
% The latest version of this license is in |
| 8 |
% http://www.latex-project.org/lppl.txt |
| 9 |
% and version 1.3 or later is part of all distributions of LaTeX |
| 10 |
% version 2005/12/01 or later. |
| 11 |
% |
| 12 |
% This work has the LPPL maintenance status `maintained'. |
| 13 |
% |
| 14 |
% The Current Maintainer of this work is Martin Beyer. |
| 15 |
% |
| 16 |
% This work consists of the files optikz.sty optikz_doc.tex and |
| 17 |
% the optikz_doc_code folder which contains all examples used in the documentation |
| 18 |
|
| 19 |
\NeedsTeXFormat{LaTeX2e}[1994/06/01] |
| 20 |
\ProvidesPackage{optikz}[2026/02/16 optikz] |
| 21 |
|
| 22 |
\RequirePackage{amssymb} % if amssymb is not loaded here but in the main document, it breaks the code |
| 23 |
\RequirePackage{tikz} |
| 24 |
\RequirePackage{xcolor} |
| 25 |
\RequirePackage{xparse} |
| 26 |
\usetikzlibrary{calc, positioning} |
| 27 |
|
| 28 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 29 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 30 |
% define colors for this package |
| 31 |
\definecolor{optikzblue}{rgb}{0.56,0.663,0.723} |
| 32 |
\definecolor{optikzred}{rgb}{0.7,0.2,0.2} |
| 33 |
\definecolor{optikzyellow}{rgb}{1,0.86,0} |
| 34 |
|
| 35 |
% store the color for resetting |
| 36 |
\colorlet{optikzblueSAVE}{optikzblue} |
| 37 |
\colorlet{optikzredSAVE}{optikzred} |
| 38 |
\colorlet{optikzyellowSAVE}{optikzyellow} |
| 39 |
|
| 40 |
\newcommand{\redefinecolor}[2]{% |
| 41 |
\definecolor{#1}{rgb}{#2} |
| 42 |
\savecolor{#1} |
| 43 |
} |
| 44 |
|
| 45 |
% mechanims to save and reset the color either to the previous color or the original color |
| 46 |
\newcommand{\savecolor}[1]{\colorlet{color@orig@#1}{#1}} |
| 47 |
\newcommand{\softresetcolor}[1]{\colorlet{#1}{color@orig@#1}} |
| 48 |
\newcommand{\resetcolor}[1]{% |
| 49 |
\colorlet{#1}{#1SAVE} |
| 50 |
\savecolor{#1} |
| 51 |
}% |
| 52 |
|
| 53 |
\savecolor{optikzblue} |
| 54 |
\savecolor{optikzyellow} |
| 55 |
\savecolor{optikzred} |
| 56 |
|
| 57 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 58 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 59 |
|
| 60 |
\tikzstyle{every node}=[font=\footnotesize] |
| 61 |
\tikzset{every text node part/.style={align=center}} |
| 62 |
|
| 63 |
% create a laser direction arrow |
| 64 |
\newcommand{\laserdir}{\tikz \draw[-{latex},ultra thick] (-1pt,0) -- (1pt,0);} |
| 65 |
|
| 66 |
% Define the laser node style |
| 67 |
\tikzset{laserdir/.style={sloped, midway, allow upside down}} |
| 68 |
|
| 69 |
% rays and beams |
| 70 |
\pgfkeys{ |
| 71 |
/beam/.is family, |
| 72 |
/beam, |
| 73 |
width start/.initial=0.8, |
| 74 |
width start/.store in=\beamwidthstart, |
| 75 |
width end/.initial=0.8, |
| 76 |
width end/.store in=\beamwidthend, |
| 77 |
fill color/.initial=red, |
| 78 |
fill color/.store in=\beamfillcolor, |
| 79 |
draw color/.initial=black, |
| 80 |
draw color/.store in=\beamdrawcolor, |
| 81 |
opacity/.initial=0.7, |
| 82 |
opacity/.store in=\beamopacity |
| 83 |
} |
| 84 |
|
| 85 |
% macro to calculate the geometry of a beam |
| 86 |
\newcommand{\beamgeometry}[5]{% |
| 87 |
|
| 88 |
\pgfmathsetmacro{\angleStart}{#4} |
| 89 |
\pgfmathsetmacro{\angleEnd}{#5} |
| 90 |
|
| 91 |
\path (#2); \pgfgetlastxy{\xA}{\yA} |
| 92 |
\path (#3); \pgfgetlastxy{\xB}{\yB} |
| 93 |
|
| 94 |
\pgfmathsetmacro{\dx}{\xB - \xA} |
| 95 |
\pgfmathsetmacro{\dy}{\yB - \yA} |
| 96 |
\pgfmathsetmacro{\length}{veclen(\dx,\dy)} |
| 97 |
\pgfmathsetmacro{\ux}{\dx/\length} |
| 98 |
\pgfmathsetmacro{\uy}{\dy/\length} |
| 99 |
|
| 100 |
\pgfmathsetmacro{\normalxStart}{-cos(\angleStart)} |
| 101 |
\pgfmathsetmacro{\normalyStart}{-sin(\angleStart)} |
| 102 |
\pgfmathsetmacro{\normalxEnd}{-cos(\angleEnd)} |
| 103 |
\pgfmathsetmacro{\normalyEnd}{-sin(\angleEnd)} |
| 104 |
|
| 105 |
\pgfmathsetmacro{\dotStart}{abs(\ux*\normalxStart + \uy*\normalyStart)} |
| 106 |
\pgfmathsetmacro{\dotEnd}{abs(\ux*\normalxEnd + \uy*\normalyEnd)} |
| 107 |
|
| 108 |
\pgfmathsetmacro{\dxstart}{sin(\angleStart) * \beamwidthstart/\dotStart} |
| 109 |
\pgfmathsetmacro{\dystart}{cos(\angleStart) * \beamwidthstart/\dotStart} |
| 110 |
\pgfmathsetmacro{\dxend}{sin(\angleEnd) * \beamwidthend/\dotEnd} |
| 111 |
\pgfmathsetmacro{\dyend}{cos(\angleEnd) * \beamwidthend/\dotEnd} |
| 112 |
|
| 113 |
\coordinate (beamstart) at |
| 114 |
($(#2)+({-0.5*sin(\angleStart) * \beamwidthstart/\dotStart}, |
| 115 |
{ 0.5*cos(\angleStart) * \beamwidthstart/\dotStart})$); |
| 116 |
|
| 117 |
\coordinate (beamend) at |
| 118 |
($(#3)+({-0.5*sin(\angleEnd) * \beamwidthend/\dotEnd}, |
| 119 |
{ 0.5*cos(\angleEnd) * \beamwidthend/\dotEnd})$); |
| 120 |
} |
| 121 |
|
| 122 |
\NewDocumentCommand{\drawrainbow}{O{} m m m m}{% |
| 123 |
% Reset defaults |
| 124 |
\pgfkeys{/beam/.cd, |
| 125 |
width start=0.8, |
| 126 |
width end=0.8, |
| 127 |
opacity=0.7, |
| 128 |
}% |
| 129 |
% Apply user options |
| 130 |
\pgfkeys{/beam,#1}% |
| 131 |
|
| 132 |
\beamgeometry{}{#2}{#3}{#4}{#5} |
| 133 |
|
| 134 |
\foreach \w in {400,...,700}{ |
| 135 |
\pgfmathsetmacro{\slope}{(\w - 400) / (700 - 400)} |
| 136 |
|
| 137 |
\definecolor{currentcol}{wave}{\w} |
| 138 |
\draw[line width=.05pt, color=currentcol, opacity=\beamopacity] |
| 139 |
($(beamstart)+(\dxstart * \slope, -\dystart * \slope)$) -- |
| 140 |
($(beamend)+(\dxend * \slope, -\dyend * \slope)$); |
| 141 |
} |
| 142 |
} |
| 143 |
|
| 144 |
\NewDocumentCommand{\drawbeam}{O{} m m m m}{% |
| 145 |
% Reset defaults |
| 146 |
\pgfkeys{/beam/.cd, |
| 147 |
width start=0.8, |
| 148 |
width end=0.8, |
| 149 |
fill color=optikzred, |
| 150 |
draw color=black, |
| 151 |
opacity=0.7 |
| 152 |
}% |
| 153 |
% Apply user options |
| 154 |
\pgfkeys{/beam,#1}% |
| 155 |
|
| 156 |
\beamgeometry{}{#2}{#3}{#4}{#5} |
| 157 |
|
| 158 |
\filldraw[ fill=\beamfillcolor, draw=\beamdrawcolor, thick, fill opacity=\beamopacity] |
| 159 |
(beamstart) |
| 160 |
-- +(\dxstart,-\dystart) |
| 161 |
-- (beamend) |
| 162 |
-- ++(\dxend,-\dyend) |
| 163 |
-- cycle; |
| 164 |
} |
| 165 |
|
| 166 |
% Calculate the angle of the vector AB with the x-axis |
| 167 |
% Can be used to position elements along a beam path with the right orientation |
| 168 |
\newcommand{\optikzangletwopoints}[3]{% |
| 169 |
\path let |
| 170 |
\p1 = (#1), |
| 171 |
\p2 = (#2) |
| 172 |
in |
| 173 |
\pgfextra{ |
| 174 |
\pgfmathparse{atan2(\y2-\y1,\x2-\x1)}% |
| 175 |
\global\edef#3{\pgfmathresult}% |
| 176 |
}; |
| 177 |
} |
| 178 |
|
| 179 |
% Calculate the half angle of the triangle ABC |
| 180 |
% Can be used to position reflective elements at point B with the right orientation to fulfill the law of reflection |
| 181 |
\newcommand{\optikzanglethreepoints}[4]{% |
| 182 |
\path let |
| 183 |
\p1 = (#1), |
| 184 |
\p2 = (#2), |
| 185 |
\p3 = (#3) |
| 186 |
in |
| 187 |
\pgfextra{ |
| 188 |
\pgfmathparse{0.5*atan2(\y2-\y1,\x2-\x1)+0.5*atan2(\y2-\y3,\x2-\x3)}% |
| 189 |
\global\edef#4{\pgfmathresult}% |
| 190 |
}; |
| 191 |
} |
| 192 |
|
| 193 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 194 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 195 |
|
| 196 |
% Define pgfkeys for mirror options |
| 197 |
\pgfkeys{ |
| 198 |
/mirror/.is family, /mirror, |
| 199 |
angle/.initial=0, |
| 200 |
angle/.get=\optikzangle, % to get the value from a macro |
| 201 |
angle/.store in=\optikzangle, % to store the value into a macro |
| 202 |
width/.initial=1, |
| 203 |
width/.get=\optikzwidth, |
| 204 |
width/.store in=\optikzwidth, |
| 205 |
color/.initial=optikzblue, |
| 206 |
color/.get=\optikzcolor, |
| 207 |
color/.store in=\optikzcolor, |
| 208 |
thickness/.initial=1, |
| 209 |
thickness/.get=\optikzthickness, |
| 210 |
thickness/.store in=\optikzthickness, |
| 211 |
shift/.initial=0, |
| 212 |
shift/.get=\optikzshift, |
| 213 |
shift/.store in=\optikzshift, |
| 214 |
name/.initial=, |
| 215 |
name/.get=\optikzname, |
| 216 |
name/.store in=\optikzname, |
| 217 |
wedge/.initial=0, |
| 218 |
wedge/.get=\optikzwedge, |
| 219 |
wedge/.store in=\optikzwedge, |
| 220 |
strip/.initial=1, |
| 221 |
strip/.get=\optikzstrip, |
| 222 |
strip/.store in=\optikzstrip, |
| 223 |
radius/.initial=1.462, |
| 224 |
radius/.get=\optikzradius, |
| 225 |
radius/.store in=\optikzradius, |
| 226 |
grooves/.initial=7, |
| 227 |
grooves/.get=\optikzgrooves, |
| 228 |
grooves/.store in=\optikzgrooves, |
| 229 |
groovethickness/.initial=1, |
| 230 |
groovethickness/.get=\optikzgroovethickness, |
| 231 |
groovethickness/.store in=\optikzgroovethickness |
| 232 |
} |
| 233 |
|
| 234 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 235 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 236 |
|
| 237 |
% Declare an optical element: \DeclareOpticalElement{<name>}{<draw macro>} |
| 238 |
\newcommand{\DeclareOpticalElement}[2]{% |
| 239 |
% Define the base macro (e.g., \mirror) |
| 240 |
\expandafter\def\csname #1\endcsname{% |
| 241 |
\@ifnextchar[% |
| 242 |
{\csname #1@opt\endcsname}% |
| 243 |
{\csname #1@opt\endcsname[]}% |
| 244 |
}% |
| 245 |
|
| 246 |
% Optional argument handler: \mirror[...] |
| 247 |
\expandafter\def\csname #1@opt\endcsname[##1]{% |
| 248 |
\pgfkeys{/mirror,##1}% |
| 249 |
\futurelet\@let@token\csname #1@dispatch\endcsname% |
| 250 |
}% |
| 251 |
|
| 252 |
% Dispatch to check if 'a' follows |
| 253 |
\expandafter\def\csname #1@dispatch\endcsname{% |
| 254 |
\@ifnextchar a{\csname #1@checkat\endcsname}{\mirror@error}% |
| 255 |
}% |
| 256 |
|
| 257 |
% Check second character is 't' |
| 258 |
\expandafter\def\csname #1@checkat\endcsname a{% |
| 259 |
\@ifnextchar t{\csname #1@eat@at\endcsname}{\mirror@error}% |
| 260 |
}% |
| 261 |
|
| 262 |
% Actual command parser: (x,y); |
| 263 |
\expandafter\def\csname #1@eat@at\endcsname t (##1);{% |
| 264 |
\csname #2\endcsname{##1}% |
| 265 |
\softresetcolor{optikzblue}% optional, your color reset |
| 266 |
\pgfkeys{/mirror,angle=0, width=1, color=optikzblue, thickness=1, shift=0, wedge=0, name={}, strip=1, radius=1.462, grooves=7}% |
| 267 |
}% |
| 268 |
} |
| 269 |
|
| 270 |
% setup the geometry of curved surfaces |
| 271 |
|
| 272 |
\def\optikz@setupgeometry{% |
| 273 |
% Effective radius (visual vs physical) |
| 274 |
\pgfmathsetmacro{\optikz@effradius}{% |
| 275 |
(\optikzradius == 1.462) |
| 276 |
? \optikzradius * \optikzwidth |
| 277 |
: \optikzradius |
| 278 |
}% |
| 279 |
|
| 280 |
% Half opening angle |
| 281 |
\pgfmathsetmacro{\optikz@halfangle}{% |
| 282 |
asin(0.5*\optikzwidth/\optikz@effradius) |
| 283 |
}% |
| 284 |
|
| 285 |
% Sagitta / x-distance |
| 286 |
\pgfmathsetmacro{\optikz@xdist}{% |
| 287 |
\optikz@effradius*(1-cos(\optikz@halfangle)) |
| 288 |
}% |
| 289 |
} |
| 290 |
|
| 291 |
% Declare the commands |
| 292 |
\DeclareOpticalElement{mirror}{mirror@draw} |
| 293 |
\DeclareOpticalElement{curvedmirror}{curvedmirror@draw} |
| 294 |
\DeclareOpticalElement{convexmirror}{convexmirror@draw} |
| 295 |
\DeclareOpticalElement{splitter}{splitter@draw} |
| 296 |
\DeclareOpticalElement{concavelens}{concavelens@draw} |
| 297 |
\DeclareOpticalElement{convexlens}{convexlens@draw} |
| 298 |
\DeclareOpticalElement{planconvexlens}{planconvexlens@draw} |
| 299 |
\DeclareOpticalElement{grating}{grating@draw} |
| 300 |
\DeclareOpticalElement{BScrystal}{BScrystal@draw} |
| 301 |
\DeclareOpticalElement{parabola}{parabola@draw} |
| 302 |
\DeclareOpticalElement{camera}{camera@draw} |
| 303 |
\DeclareOpticalElement{diode}{diode@draw} |
| 304 |
\DeclareOpticalElement{objective}{objective@draw} |
| 305 |
\DeclareOpticalElement{pockelscell}{pockelscell@draw} |
| 306 |
\DeclareOpticalElement{spectrometer}{spectrometer@draw} |
| 307 |
\DeclareOpticalElement{laser}{laser@draw} |
| 308 |
\DeclareOpticalElement{faradayrotator}{faradayrotator@draw} |
| 309 |
|
| 310 |
% Helper command for the doc |
| 311 |
\DeclareOpticalElement{drawallelements}{drawallelements@draw} |
| 312 |
\DeclareOpticalElement{drawallcurvedelements}{drawallcurvedelements@draw} |
| 313 |
|
| 314 |
% Declare derived commands |
| 315 |
\DeclareOpticalElement{largemirror}{largemirror@draw} |
| 316 |
\DeclareOpticalElement{smallmirror}{smallmirror@draw} |
| 317 |
\DeclareOpticalElement{TFP}{TFP@draw} |
| 318 |
\DeclareOpticalElement{tinysplitter}{tinysplitter@draw} |
| 319 |
\DeclareOpticalElement{wedge}{wedge@draw} |
| 320 |
|
| 321 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 322 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 323 |
|
| 324 |
\def\mirror@draw#1{% |
| 325 |
\coordinate (shift) at ({0.5 * \optikzshift * \optikzwidth * sin(\optikzangle)}, |
| 326 |
{-0.5 * \optikzshift * \optikzwidth * cos(\optikzangle)}); |
| 327 |
\coordinate (anchor) at ($(#1)+(shift)$); |
| 328 |
% \pgfmathsetmacro{\dy}{-0.5 * \optikzshift * \optikzwidth * abs(cos(\optikzangle))} |
| 329 |
\shadedraw[ |
| 330 |
thick, |
| 331 |
transform canvas={rotate around={\optikzangle:(anchor)}}, |
| 332 |
top color=\optikzcolor, |
| 333 |
bottom color=\optikzcolor, |
| 334 |
middle color=white |
| 335 |
] |
| 336 |
($(anchor)+(0,-0.5*\optikzwidth)$) rectangle ++(0.3*\optikzthickness,\optikzwidth); |
| 337 |
|
| 338 |
\fill[fill=black, transform canvas={rotate around={\optikzangle:(anchor)}}] |
| 339 |
($(anchor)+(0.3*\optikzthickness,-0.5*\optikzwidth)$) rectangle ++(-0.1*\optikzthickness*\optikzstrip,\optikzwidth); |
| 340 |
} |
| 341 |
|
| 342 |
\def\largemirror@draw#1{% |
| 343 |
\pgfmathsetmacro{\largerwidth}{1.3*\optikzwidth} |
| 344 |
\pgfkeysalso{/mirror, width=\largerwidth} |
| 345 |
\mirror@draw{#1} |
| 346 |
} |
| 347 |
|
| 348 |
\def\smallmirror@draw#1{% |
| 349 |
\pgfmathsetmacro{\smallerwidth}{0.7\optikzwidth} |
| 350 |
\pgfkeysalso{/mirror, width=\smallerwidth} |
| 351 |
\mirror@draw{#1} |
| 352 |
} |
| 353 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 354 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 355 |
|
| 356 |
\def\curvedmirror@draw#1{% |
| 357 |
\coordinate (anchor) at (#1);% |
| 358 |
\optikz@setupgeometry |
| 359 |
|
| 360 |
\shadedraw[ |
| 361 |
thick, |
| 362 |
transform canvas={rotate around={\optikzangle:(anchor)}}, |
| 363 |
top color=\optikzcolor, |
| 364 |
bottom color=\optikzcolor, |
| 365 |
middle color=white |
| 366 |
] |
| 367 |
(anchor) |
| 368 |
arc (0:\optikz@halfangle:\optikz@effradius) -- |
| 369 |
($(anchor)+(.3*\optikzthickness,0.5*\optikzwidth)$) -- |
| 370 |
($(anchor)+(.3*\optikzthickness,-0.5*\optikzwidth)$) -- |
| 371 |
($(anchor)+({-\optikz@effradius*(1-cos(\optikz@halfangle))},-0.5*\optikzwidth)$) |
| 372 |
arc (-\optikz@halfangle:0:\optikz@effradius); |
| 373 |
|
| 374 |
\fill[ |
| 375 |
fill=black, |
| 376 |
transform canvas={rotate around={\optikzangle:(anchor)}} |
| 377 |
] |
| 378 |
($(anchor)+(0.3*\optikzthickness,-0.5*\optikzwidth)$) |
| 379 |
rectangle ++(-0.1*\optikzthickness*\optikzstrip,\optikzwidth); |
| 380 |
} |
| 381 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 382 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 383 |
|
| 384 |
\def\convexmirror@draw#1{% |
| 385 |
\coordinate (anchor) at (#1);% |
| 386 |
\optikz@setupgeometry |
| 387 |
|
| 388 |
\shadedraw[ |
| 389 |
thick, |
| 390 |
transform canvas={rotate around={\optikzangle:(anchor)}}, |
| 391 |
top color=\optikzcolor, |
| 392 |
bottom color=\optikzcolor, |
| 393 |
middle color=white |
| 394 |
] |
| 395 |
(anchor) arc (180:180-\optikz@halfangle:\optikz@effradius) -- |
| 396 |
($(anchor)+(\optikz@xdist+.2*\optikzthickness,0.5*\optikzwidth)$) -- |
| 397 |
++(0, -\optikzwidth) -- |
| 398 |
($(anchor)+(\optikz@xdist,-0.5*\optikzwidth)$) arc (180+\optikz@halfangle:180:\optikz@effradius); |
| 399 |
|
| 400 |
\fill[fill=black,transform canvas={rotate around={\optikzangle:(anchor)}}] |
| 401 |
($(anchor)+(\optikz@xdist+.2*\optikzthickness,-0.5*\optikzwidth)$) rectangle ++(-0.1*\optikzthickness*\optikzstrip,\optikzwidth); |
| 402 |
} |
| 403 |
|
| 404 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 405 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 406 |
|
| 407 |
\def\splitter@draw#1{% |
| 408 |
\def\@coordinates{#1} |
| 409 |
\coordinate (shift) at ({0.5 * \optikzshift * \optikzwidth * sin(\optikzangle)}, |
| 410 |
{-0.5 * \optikzshift * \optikzwidth * cos(\optikzangle)}); |
| 411 |
\coordinate (anchor) at ($(\@coordinates)+(shift)$); |
| 412 |
\shadedraw[thick, top color=white, transform canvas={rotate around={\optikzangle:(anchor)}}, bottom color=\optikzcolor, shading angle=90] ($(anchor)+(0,-0.5*\optikzwidth)$) -- +({0.3*\optikzthickness*(1-\optikzwedge)},0) -- +({0.3*\optikzthickness*(1+\optikzwedge)},\optikzwidth) -- +(0,\optikzwidth) -- cycle; |
| 413 |
} |
| 414 |
|
| 415 |
\def\TFP@draw#1{% |
| 416 |
\pgfmathsetmacro{\smallerthickness}{0.66\optikzthickness} |
| 417 |
\pgfkeysalso{/mirror, thickness=\smallerthickness} |
| 418 |
\splitter@draw{#1} |
| 419 |
} |
| 420 |
|
| 421 |
\def\tinysplitter@draw#1{% |
| 422 |
\pgfmathsetmacro{\smallerthickness}{0.33\optikzthickness} |
| 423 |
\pgfmathsetmacro{\smallerwidth}{0.66\optikzwidth} |
| 424 |
\pgfkeysalso{/mirror, width=\smallerwidth, thickness=\smallerthickness} |
| 425 |
\splitter@draw{#1} |
| 426 |
} |
| 427 |
|
| 428 |
\def\wedge@draw#1{% |
| 429 |
\pgfmathsetmacro{\smallerthickness}{0.825\optikzthickness} |
| 430 |
\pgfmathsetmacro{\newwedge}{-0.165\optikzwedge} |
| 431 |
\pgfkeysalso{/mirror, thickness=\smallerthickness, wedge=\newwedge} |
| 432 |
\splitter@draw{#1} |
| 433 |
} |
| 434 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 435 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 436 |
|
| 437 |
\def\concavelens@draw#1{% |
| 438 |
\coordinate (center) at (#1); |
| 439 |
\optikz@setupgeometry |
| 440 |
|
| 441 |
\coordinate (shift) at ({(-0.1*\optikzthickness)*cos(\optikzangle)}, |
| 442 |
{(-0.1*\optikzthickness)*sin(\optikzangle)}); |
| 443 |
\coordinate (anchor) at ($(#1)+(shift)$); |
| 444 |
\shadedraw[thick, rotate around={\optikzangle:(center)}, |
| 445 |
top color=\optikzcolor, |
| 446 |
bottom color=\optikzcolor, |
| 447 |
middle color=white, |
| 448 |
shading angle=\optikzangle] |
| 449 |
(anchor) arc (0:\optikz@halfangle:\optikz@effradius) -- |
| 450 |
($(anchor)+(.2*\optikzthickness+\optikz@xdist,0.5*\optikzwidth)$) arc (180-\optikz@halfangle:180+\optikz@halfangle:\optikz@effradius) -- |
| 451 |
($(anchor)+(-\optikz@xdist,-0.5*\optikzwidth)$) arc (-\optikz@halfangle:0:\optikz@effradius); |
| 452 |
} |
| 453 |
|
| 454 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 455 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 456 |
|
| 457 |
\def\convexlens@draw#1{% |
| 458 |
\coordinate (center) at (#1); |
| 459 |
\optikz@setupgeometry |
| 460 |
|
| 461 |
\coordinate (shift) at ({(-\[email protected]*\optikzthickness)*cos(\optikzangle)}, |
| 462 |
{(-\[email protected]*\optikzthickness)*sin(\optikzangle)}); |
| 463 |
\coordinate (anchor) at ($(center)+(shift)$); |
| 464 |
\shadedraw[thick, rotate around={\optikzangle:(center)}, % transform doesn't work here |
| 465 |
top color=\optikzcolor, |
| 466 |
bottom color=\optikzcolor, |
| 467 |
middle color=white, |
| 468 |
shading angle=\optikzangle] |
| 469 |
(anchor) arc (180:180-\optikz@halfangle:\optikz@effradius) -- |
| 470 |
($(center)+(0.08*\optikzthickness,+0.5*\optikzwidth)$) arc (\optikz@halfangle:-\optikz@halfangle:\optikz@effradius) -- |
| 471 |
($(anchor)+(\optikz@xdist,-0.5*\optikzwidth)$) arc (180+\optikz@halfangle:180:\optikz@effradius); |
| 472 |
} |
| 473 |
|
| 474 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 475 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 476 |
|
| 477 |
\def\planconvexlens@draw#1{% |
| 478 |
\coordinate (center) at (#1); |
| 479 |
\optikz@setupgeometry |
| 480 |
|
| 481 |
\coordinate (shift) at ({0.5 * \optikzshift * \optikzwidth * sin(\optikzangle)}, |
| 482 |
{-0.5 * \optikzshift * \optikzwidth * cos(\optikzangle)}); |
| 483 |
\coordinate (anchor) at ($(center)+(shift)$); |
| 484 |
\shadedraw[thick, transform canvas={rotate around={\optikzangle:(center)}}, |
| 485 |
top color=\optikzcolor, |
| 486 |
bottom color=\optikzcolor, |
| 487 |
middle color=white] |
| 488 |
(anchor) -- ($(anchor)+(0,0.5*\optikzwidth)$) -- |
| 489 |
($(anchor)+(0.12*\optikzthickness,0.5*\optikzwidth)$) arc (\optikz@halfangle:-\optikz@halfangle:\optikz@effradius) -- |
| 490 |
($(anchor)+(0,-0.5*\optikzwidth)$) -- cycle; |
| 491 |
} |
| 492 |
|
| 493 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 494 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 495 |
|
| 496 |
\def\grating@draw#1{% |
| 497 |
\def\@coordinates{#1} |
| 498 |
\coordinate (shift) at ({0.5 * \optikzshift * \optikzwidth * sin(\optikzangle)}, |
| 499 |
{-0.5 * \optikzshift * \optikzwidth * cos(\optikzangle)}); |
| 500 |
\coordinate (anchor) at ($(\@coordinates)+(shift)$); |
| 501 |
\begin{scope}[transform canvas={rotate around={\optikzangle:(anchor)}}] |
| 502 |
|
| 503 |
\shadedraw[thick, top color=\optikzcolor, bottom color=\optikzcolor, middle color=white] |
| 504 |
($(anchor)+(0,-0.5*\optikzwidth)$) |
| 505 |
\foreach \i in {2,...,\optikzgrooves} { |
| 506 |
-- ++(0, {\optikzwidth / (2*\optikzgrooves-1)}) |
| 507 |
-- ++(0.1*\optikzgroovethickness, 0) |
| 508 |
-- ++(0, {\optikzwidth / (2*\optikzgrooves-1)}) |
| 509 |
-- ++(-0.1*\optikzgroovethickness, 0) |
| 510 |
} |
| 511 |
-- ++(0, {0.5 * \optikzwidth / \optikzgrooves}) |
| 512 |
-- ++({0.1*\optikzgroovethickness + 0.2*\optikzthickness}, 0) |
| 513 |
-- ++(0, {-\optikzwidth}) -- ++({-0.1*\optikzgroovethickness - 0.2*\optikzthickness}, 0) --++(0, {\optikzwidth / (2*\optikzgrooves)}); |
| 514 |
\end{scope} |
| 515 |
|
| 516 |
\fill[fill=black,rotate around={\optikzangle:(anchor)}] |
| 517 |
($(anchor)+(0.1*\optikzgroovethickness+0.2*\optikzthickness,-0.5*\optikzwidth)$) rectangle |
| 518 |
++(-0.1*\optikzthickness*\optikzstrip,\optikzwidth); |
| 519 |
} |
| 520 |
|
| 521 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 522 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 523 |
|
| 524 |
\def\BScrystal@draw#1{% |
| 525 |
% \def\@coordinates{#1} |
| 526 |
\coordinate (anchor) at (#1); |
| 527 |
\shadedraw[thick, transform canvas={rotate around={\optikzangle:(anchor)}}, |
| 528 |
top color=white, |
| 529 |
bottom color=\optikzcolor, |
| 530 |
shading angle=-45] |
| 531 |
($(anchor)+(-0.5*\optikzwidth*0.7,-0.5*\optikzwidth*0.7)$) rectangle |
| 532 |
++(0.5*\optikzwidth*1.4,0.5*\optikzwidth*1.4); |
| 533 |
\draw[rotate around={\optikzangle:(anchor)}, thick] |
| 534 |
($(anchor)+(-0.5*\optikzwidth*0.7,0.5*\optikzwidth*0.7)$) -- |
| 535 |
($(anchor)+(0.5*\optikzwidth*0.7,-0.5*\optikzwidth*0.7)$); |
| 536 |
} |
| 537 |
|
| 538 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 539 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 540 |
|
| 541 |
\def\parabola@draw#1{% |
| 542 |
% \def\@coordinates{#1} |
| 543 |
\coordinate (anchor) at (#1); |
| 544 |
\shadedraw[thick, transform canvas={rotate around={\optikzangle+90:(anchor)}}, |
| 545 |
top color=\optikzcolor, |
| 546 |
bottom color=\optikzcolor, |
| 547 |
middle color=white, |
| 548 |
shading angle=45] |
| 549 |
(anchor) arc (-135:-180:.8*\optikzwidth) -- |
| 550 |
++(-.2*\optikzwidth,0) -- |
| 551 |
++(0,-1*\optikzwidth) -- |
| 552 |
++(1*\optikzwidth,0) -- |
| 553 |
++(0,.2*\optikzwidth) arc (-90:-135:.8*\optikzwidth); |
| 554 |
} |
| 555 |
|
| 556 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 557 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 558 |
|
| 559 |
\def\drawallelements@draw#1{% |
| 560 |
\coordinate (A) at (#1); |
| 561 |
\coordinate (B) at ($(A)+(1.2,0)$); |
| 562 |
\coordinate (C) at ($(A)+(2.4,0)$); |
| 563 |
\coordinate (D) at ($(A)+(3.6,0)$); |
| 564 |
\coordinate (E) at ($(A)+(4.8,0)$); |
| 565 |
\coordinate (F) at ($(A)+(6,0)$); |
| 566 |
\coordinate (G) at ($(A)+(7.2,0)$); |
| 567 |
\coordinate (H) at ($(A)+(8.4,0)$); |
| 568 |
\coordinate (I) at ($(A)+(10,0)$); |
| 569 |
\coordinate (J) at ($(A)+(11.5,0)$); |
| 570 |
\mirror@draw{A}% |
| 571 |
\curvedmirror@draw{B} |
| 572 |
\convexmirror@draw{C} |
| 573 |
\splitter@draw{D} |
| 574 |
\concavelens@draw{E} |
| 575 |
\convexlens@draw{F} |
| 576 |
\planconvexlens@draw{G} |
| 577 |
\grating@draw{H} |
| 578 |
\BScrystal@draw{I} |
| 579 |
\parabola@draw{J} |
| 580 |
} |
| 581 |
|
| 582 |
\def\drawallcurvedelements@draw#1{% |
| 583 |
\coordinate (A) at (#1); |
| 584 |
\coordinate (B) at ($(A)+(1.2,0)$); |
| 585 |
\coordinate (C) at ($(A)+(2.4,0)$); |
| 586 |
\coordinate (D) at ($(A)+(3.6,0)$); |
| 587 |
\coordinate (E) at ($(A)+(4.8,0)$); |
| 588 |
\curvedmirror@draw{A} |
| 589 |
\convexmirror@draw{B} |
| 590 |
\concavelens@draw{C} |
| 591 |
\convexlens@draw{D} |
| 592 |
\planconvexlens@draw{E} |
| 593 |
} |
| 594 |
|
| 595 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 596 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 597 |
|
| 598 |
\def\camera@draw#1{% |
| 599 |
\def\@coordinates{#1} |
| 600 |
% Flip label if angle is between 90 and 270 |
| 601 |
\pgfmathparse{(abs(\optikzangle) > 90 && abs(\optikzangle) < 270) ? 180 : 0} |
| 602 |
\let\labelangle\pgfmathresult |
| 603 |
|
| 604 |
\colorlet{optikzblue}{optikzred} |
| 605 |
\shadedraw[thick, rotate around={\optikzangle:(\@coordinates)}, |
| 606 |
top color=black, |
| 607 |
bottom color=black, |
| 608 |
middle color=gray, |
| 609 |
shading angle=\optikzangle] |
| 610 |
($(\@coordinates)+(0,-.25*\optikzwidth)$) rectangle ++(0.15,.5*\optikzwidth); |
| 611 |
\shadedraw[thick, rotate around={\optikzangle:(\@coordinates)}, |
| 612 |
top color=\optikzcolor, |
| 613 |
bottom color=\optikzcolor, |
| 614 |
middle color=\optikzcolor!80!white, |
| 615 |
shading angle=\optikzangle] |
| 616 |
($(\@coordinates)+(.15,-0.4*\optikzwidth)$) rectangle ++(1.2*\optikzthickness,0.8*\optikzwidth); |
| 617 |
\node[rotate=\optikzangle, shift={(0.6*\optikzthickness+0.15,0)}, rotate=\labelangle] at (\@coordinates){\optikzname}; |
| 618 |
} |
| 619 |
|
| 620 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 621 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 622 |
|
| 623 |
\def\objective@draw#1{% |
| 624 |
\def\@coordinates{#1} |
| 625 |
% Flip label if angle is between 90 and 270 |
| 626 |
\pgfmathparse{(abs(\optikzangle) > 90 && abs(\optikzangle) < 270) ? 180 : 0} |
| 627 |
\let\labelangle\pgfmathresult |
| 628 |
\coordinate (anchor) at (\@coordinates); |
| 629 |
|
| 630 |
\colorlet{objectivecolor}{optikzblue} |
| 631 |
\colorlet{optikzblue}{optikzred} |
| 632 |
\shadedraw[thick, transform canvas={rotate around={\optikzangle:(anchor)}}, |
| 633 |
top color=objectivecolor, |
| 634 |
bottom color=objectivecolor, |
| 635 |
middle color=white] |
| 636 |
(anchor) arc (180:165:1.16*\optikzwidth) -- |
| 637 |
($(anchor)+(.3,+0.3*\optikzwidth)$) -- |
| 638 |
+(0,-0.6*\optikzwidth) -- |
| 639 |
($(anchor)+(0.0395*\optikzwidth,-0.3*\optikzwidth)$) arc (195:180:1.16*\optikzwidth); |
| 640 |
\shadedraw[thick, transform canvas={rotate around={\optikzangle:(anchor)}}, |
| 641 |
top color=\optikzcolor, |
| 642 |
bottom color=\optikzcolor, |
| 643 |
middle color=\optikzcolor!80!white] |
| 644 |
($(anchor)+(.15,-.35*\optikzwidth)$) rectangle ++(1.2*\optikzthickness,.7*\optikzwidth); |
| 645 |
\node[rotate=\optikzangle, shift={(0.6*\optikzthickness+0.15,0)}, rotate=\labelangle] at (\@coordinates){\optikzname}; |
| 646 |
} |
| 647 |
|
| 648 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 649 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 650 |
|
| 651 |
\def\spectrometer@draw#1{% |
| 652 |
\coordinate (anchor) at (#1); |
| 653 |
% Flip label if angle is between 90 and 270 |
| 654 |
\pgfmathparse{(abs(\optikzangle) > 90 && abs(\optikzangle) < 270) ? 180 : 0} |
| 655 |
\let\labelangle\pgfmathresult |
| 656 |
|
| 657 |
\definecolor{optikzblue}{rgb}{0.5,0.5,0.5} |
| 658 |
\shadedraw[thick, transform canvas={rotate around={\optikzangle:(anchor)}}, |
| 659 |
top color=black, |
| 660 |
bottom color=black, |
| 661 |
middle color=gray] |
| 662 |
($(anchor)+(0,-.1)$) rectangle ++(0.15,.2); |
| 663 |
\shadedraw[thick, transform canvas={rotate around={\optikzangle:(anchor)}}, |
| 664 |
top color=\optikzcolor, |
| 665 |
bottom color=\optikzcolor, |
| 666 |
middle color=white] |
| 667 |
($(anchor)+(+.15,0)$) -- |
| 668 |
+(0,-.15) -- |
| 669 |
+(-.15,-.3*\optikzwidth) -- |
| 670 |
+(-.15,-.4*\optikzwidth) -- |
| 671 |
+(1.5*\optikzthickness,-.4*\optikzwidth) -- |
| 672 |
+(1.5*\optikzthickness,.6*\optikzwidth) -- |
| 673 |
+(-.15,.6*\optikzwidth) -- |
| 674 |
+(-.15,.3*\optikzwidth) -- |
| 675 |
+(0,.15) -- cycle; |
| 676 |
\node[rotate=\optikzangle, shift={(0.75*\optikzthickness+0.15,0.1*\optikzwidth)}, rotate=\labelangle] at (anchor){\optikzname}; |
| 677 |
} |
| 678 |
|
| 679 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 680 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 681 |
|
| 682 |
\def\diode@draw#1{% |
| 683 |
\coordinate (anchor) at (#1); |
| 684 |
\definecolor{optikzblue}{rgb}{0.5,0.5,0.5} |
| 685 |
\shadedraw[thick, transform canvas={rotate around={\optikzangle:(anchor)}}, |
| 686 |
top color=black, |
| 687 |
bottom color=black, |
| 688 |
middle color=gray] |
| 689 |
($(anchor)+(0,-.1)$) rectangle ++(0.15,.2); |
| 690 |
\shadedraw[thick, transform canvas={rotate around={\optikzangle:(anchor)}}, |
| 691 |
top color=\optikzcolor, |
| 692 |
bottom color=\optikzcolor, |
| 693 |
middle color=white] |
| 694 |
($(anchor)+(.15,-.3*\optikzwidth)$) rectangle ++(.6*\optikzthickness,.6*\optikzwidth); |
| 695 |
} |
| 696 |
|
| 697 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 698 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 699 |
|
| 700 |
\def\laser@draw#1{% |
| 701 |
\coordinate (anchor) at (#1); |
| 702 |
\colorlet{optikzblue}{optikzyellow} |
| 703 |
\begin{scope}[transform canvas={rotate around={\optikzangle:(anchor)}}] |
| 704 |
\shadedraw[thick, |
| 705 |
top color=black, |
| 706 |
bottom color=black, |
| 707 |
middle color=gray] |
| 708 |
($(anchor)+(1.2*\optikzthickness,-.35*\optikzwidth)$) rectangle ++(-0.1,.7*\optikzwidth); |
| 709 |
\filldraw[thick, fill=black!80!white] |
| 710 |
($(anchor)+(0,-0.45*\optikzwidth)$) rectangle ++(1.2*\optikzthickness-0.1,+0.9*\optikzwidth); |
| 711 |
\shadedraw[thick, |
| 712 |
top color=\optikzcolor!30!white, |
| 713 |
bottom color=\optikzcolor!30!white, |
| 714 |
middle color=\optikzcolor] |
| 715 |
($(anchor)+(0,-0.35*\optikzwidth)$) rectangle ++(1.2*\optikzthickness-0.1,0.7*\optikzwidth); |
| 716 |
\fill ($(anchor)+(0.8*\optikzthickness-0.1,0)$) circle (0.1*\optikzwidth); |
| 717 |
\draw[thick] ($(anchor)+(0.8*\optikzthickness-0.1,0)$) -- (anchor); |
| 718 |
\foreach \optikzangle in {0,30,...,359}{ |
| 719 |
\fill ($(anchor)+(0.8*\optikzthickness-0.1,0)$) -- +(\optikzangle-1:0.2*\optikzwidth) -- +(\optikzangle+1:0.2*\optikzwidth) -- cycle; |
| 720 |
\fill ($(anchor)+(0.8*\optikzthickness-0.1,0)$) -- +(\optikzangle+15+2:0.3*\optikzwidth) -- +(\optikzangle+15-2:0.3*\optikzwidth) -- cycle; |
| 721 |
} |
| 722 |
\end{scope} |
| 723 |
} |
| 724 |
|
| 725 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 726 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 727 |
|
| 728 |
\def\pockelscell@draw#1{% |
| 729 |
\def\@coordinates{#1} |
| 730 |
% Flip label if angle is between 90 and 270 |
| 731 |
\pgfmathparse{(\optikzangle < 180 && \optikzangle > 0) ? -90 : 90} |
| 732 |
\let\labelangle\pgfmathresult |
| 733 |
\coordinate (anchor) at ($(\@coordinates)$); |
| 734 |
|
| 735 |
\definecolor{optikzblue}{rgb}{0.5,0.5,0.5} |
| 736 |
\shadedraw[thick, transform canvas={rotate around={\optikzangle:(anchor)}},top color=\optikzcolor, bottom color=\optikzcolor, middle color=white, shading angle=90] |
| 737 |
(anchor) |
| 738 |
-- +(0,-.1*\optikzwidth) |
| 739 |
-- +(-.05,-.15*\optikzwidth) |
| 740 |
-- +(-.05,-1.1*\optikzwidth+0.9*\optikzshift*\optikzwidth) |
| 741 |
-- +(\optikzthickness,-1.1*\optikzwidth+0.9*\optikzshift*\optikzwidth) |
| 742 |
-- +(\optikzthickness,-.15*\optikzwidth) |
| 743 |
-- +(\optikzthickness-.05,-.1*\optikzwidth) |
| 744 |
-- +(\optikzthickness-.05,.1*\optikzwidth) |
| 745 |
-- +(\optikzthickness,.15*\optikzwidth) |
| 746 |
-- +(\optikzthickness,1.1*\optikzwidth+0.9*\optikzshift*\optikzwidth) |
| 747 |
-- +(-.05,1.1*\optikzwidth+0.9*\optikzshift*\optikzwidth) |
| 748 |
-- +(-.05,.15*\optikzwidth) |
| 749 |
-- +(0,.1*\optikzwidth) -- cycle; |
| 750 |
\node[rotate=\optikzangle, shift={(0.5*\optikzthickness,0.9*\optikzshift*\optikzwidth)}, rotate=\labelangle] at (\@coordinates){\optikzname}; |
| 751 |
} |
| 752 |
|
| 753 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 754 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 755 |
|
| 756 |
\def\faradayrotator@draw#1{% |
| 757 |
\coordinate (anchor) at (#1); |
| 758 |
\colorlet{optikzblue}{optikzred} |
| 759 |
\begin{scope}[transform canvas={rotate around={\optikzangle:(anchor)}}] |
| 760 |
\shadedraw[thick,top color=gray, |
| 761 |
bottom color=gray, |
| 762 |
middle color=white, |
| 763 |
rounded corners=2mm*\optikzwidth] |
| 764 |
($(anchor)+(-0.5*\optikzwidth,-0.3*\optikzwidth)$) rectangle +(\optikzwidth,0.6*\optikzwidth); |
| 765 |
\shadedraw[thick,top color=\optikzcolor, |
| 766 |
bottom color=\optikzcolor, |
| 767 |
middle color=\optikzcolor!80!white] |
| 768 |
($(anchor)+(-0.35*\optikzwidth,-0.35*\optikzwidth)$) rectangle ++(0.7*\optikzwidth,0.7*\optikzwidth); |
| 769 |
\end{scope} |
| 770 |
} |
| 771 |
|
| 772 |
|
| 773 |
\endinput |
| 774 |
%% |
| 775 |
%% End of file `optikz.sty'. |