How would one go about drawing light / laser illumination rays using tikz? I would like to draw the schematic of an optical microscope illumination path. Examples of kinds of rays I would like to produce are:
- A linear gradient from out to in:
- A cone shaped beam with a radial gradient:
- The kind of laser illumination I am after is as follows:
Note: I am mainly interested in just the 'rays' in each picture. Not the optical elements or rest of the microscope setup. But they were the only pictures I could find that illustrate the look I am trying to achieve. I want to append them to my highly technical (lol) schematic so far:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw (-0.8,-0.2) -- (0.8,-0.2) -- (1.2,-0.6) -- (1.2,-1.8) -- (-1.2,-1.8) -- (-1.2,-0.6)--(-0.8,-0.2);
\draw (-1.8,0.8) rectangle (1.8,0.4);
\draw (-1.2,1.4) -- (-1.6,2) -- (-1.8,3) -- (-1.8,3.8) -- (1.8,3.8) -- (1.8,3) -- (1.6,2) -- (1.2,1.4)--(-1.2,1.4);
\end{tikzpicture}
\end{document}
EDIT: Thanks to the responses I have gotten 90% of what I am after:
\documentclass[tikz]{standalone}
\usepgfmodule{nonlineartransformations}
\tikzset{lasernode/.style={
left color=red,
right color=red,
middle color = white
}
}
\tikzset{lasernode2/.style={
left color=white,
right color=white,
middle color = red
}
}
\begin{document}
\begin{tikzpicture}
\draw[lasernode] (-3.8,9.4) rectangle (-3.2,6.4);
\draw[lasernode] (-6.8,9) -- (-6.8,7.8) -- (-6.2,6.8) -- (-5.6,7.8) -- (-5.6,9) -- (-6.8,9);
\draw[lasernode2] (-5.4,9) -- (-5.4,7.8) -- (-4.8,6.8) -- (-4.2,7.8) -- (-4.2,9) -- (-5.4,9);
\end{tikzpicture}
\end{document}
What I want is for the shaded beam to stay perpendicular to the direction of propagation. Example of what I am after made with Photoshop is, but obviously with tikz correctly shading...:
Thanks all
EDIT 2
Thanks to suggestions I am getting very close:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{fadings}
\tikzfading[name=fade right, left color=transparent!100, right color=transparent!10, middle color=transparent!100]
\tikzfading[name=fade rect, left color=transparent!100, right color=transparent!70, middle color=transparent!100]
\begin{document}
\begin{tikzpicture}[fill opacity=0.9,thick, line cap=round,line join=round]
\fill[red,path fading=fade right, fading angle=-30] (-0.2,1.8) -- (-1.6,3.4) -- (1.2,3.4) -- cycle;
\fill[red,path fading=fade right, fading angle=210] (-0.2,1.8) -- (-1.6,3.4) -- (1.2,3.4) -- cycle;
\draw (-1.6,3.4) -- (-0.2,1.8) -- (1.2,3.4);
\fill [red,path fading=fade rect] (-0.2,3.4) rectangle (1.2,6.4);
\fill [red,path fading=fade rect, fading angle=180] (-1.6,3.4) rectangle (-0.2,6.4);
\draw (-1.6,3.4) -- (-1.6,6.4);
\draw (1.2,3.4) -- (1.2,6.4);
% \fill [blue,path fading=south](-0.8,7.8) rectangle (0.4,-3.4);
\end{tikzpicture}
\end{document}
I am very happy with it but as you can see my implementation is quite messy. Basically after drawing a triangle I play around with rotations until it matches how I want, and then I draw another triangle behind it with the same rotation mirror vertically. The final problem is matching the horizontal beam up with the rotated one. Right now I am just doing trial and error. Thanks for all getting me onto the right track. If there is a solution to joining them together then I will be satisfied 100%.
tikzedt
from www.tikzedt.org – sandu May 30 '14 at 5:44