Graphics, Figures & Tables3D representation of a plane wave with tikz

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Tetraquark
Posts: 2
Joined: Fri Dec 27, 2013 9:45 pm

3D representation of a plane wave with tikz

Post by Tetraquark »

Hi LaTeX Community,
I wish I could represent a plane wave in 3D with tikz such as this example : Image

But I don't know how to trace a function following a 3D vector, is it possible with tikz ?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

3D representation of a plane wave with tikz

Post by cgnieder »

Hi Tetraquark,

welcome to the LaTeX community.

Have you seen the »Polarizing microscope« on texample? It might be a starting point.

I have once done the following based on the example above. The code surely can be improved:

Code: Select all

\documentclass{article}
\usepackage{tikz}
\colorlet{angcolor}{green!50!black}
\colorlet{lencolor}{red!50!black}
\begin{document}
\begin{figure}
  \centering
  \begin{tikzpicture}[x={(0.866cm,-0.5cm)}, y={(0.866cm,0.5cm)}, z={(0cm,1cm)}, scale=.5,
    %Option for nice arrows
    >=stealth, %
    inner sep=0pt, outer sep=2pt,%
    axis/.style={thick,->},
    wave/.style={thick,color=#1,smooth},
    polaroid/.style={fill=black!60!white, opacity=0.3},
    information text/.style=
      {inner sep=2pt,fill=red!10,rounded corners,text width=2.5cm, text centered}
  ]
    % Frame
    \coordinate (O) at (0,0,0);
    \draw[axis] (O) -- +(19,0,0) node [right] {x};
    \draw[axis] (O) -- +(0,2.5,0) node [right] {y};
    \draw[axis] (O) -- +(0,0,2) node [above] {z};

    \draw[thick,dashed] (-2,0,0) -- (O);

    % Licht vor dem Filter
    \draw[wave=blue, opacity=0.7, variable=\x, samples at={-2,-1.75,...,0}]
      plot (\x, {sin(2.0*\x r)}, 0);
    \draw[wave=black, opacity=0.7, variable=\x, samples at={-2,-1.75,...,0}]
      plot (\x, 0, {sin(2.0*\x r)});
    \draw[wave=black, opacity=0.7, variable=\x, samples at={-2,-1.75,...,0}]
      plot (\x, 0, {-sin(2.0*\x r)});
    \draw[wave=black, opacity=0.7, variable=\x, samples at={-2,-1.75,...,0}]
      plot (\x, {-sin(2.0*\x r)}, 0);
    \draw[wave=black, opacity=0.7, variable=\x, samples at={-2,-1.75,...,0}]
      plot (\x, {-.766*sin(2.0*\x r)}, {-.643*sin(2.0*\x r)});
    \draw[wave=black, opacity=0.7, variable=\x, samples at={-2,-1.75,...,0}]
      plot (\x, {.643*sin(2.0*\x r)}, {.766*sin(2.0*\x r)});
    \foreach \x in{-2,-1.75,...,0}{
      \draw[color=blue, opacity=0.7,->]
        (\x,0,0) -- (\x, {sin(2.0*\x r)}, 0);
      \draw[color=black, opacity=0.7,->]
        (\x,0,0) -- (\x, 0, {sin(2.0*\x r)});
      \draw[color=black, opacity=0.7,->]
        (\x,0,0) -- (\x, 0, {-sin(2.0*\x r)});
      \draw[color=black, opacity=0.7,->]
        (\x,0,0) -- (\x, {-sin(2.0*\x r)}, 0);
      \draw[color=black, opacity=0.7,->]
        (\x,0,0) -- (\x, {-.766*sin(2.0*\x r)}, {-.643*sin(2.0*\x r)});
      \draw[color=black, opacity=0.7,->]
        (\x,0,0) -- (\x, {.643*sin(2.0*\x r)}, {.766*sin(2.0*\x r)});
    }
    \node[information text,above] at (-2,0,1.5){\small Licht aller Schwingungs\-e\-be\-nen};
    % Erstes Gitter
    \filldraw[polaroid] (0,-2,-1.5) -- (0,-2,1.5) -- (0,2,1.5) -- (0,2,-1.5) -- (0,-2,-1.5)
      node[below, sloped, near end]{\small opt. Gitter};%
    % Direction of polarization
    \draw[thick,<->] (0,-1.75,-1) -- (0,-0.75,-1);
    % Polarisiertes Licht zwischen Gitter und Probe
    \draw[wave=blue, variable=\x,samples at={0,0.25,...,6}]
      plot (\x,{sin(2*\x r)},0);
    \foreach \x in{0, 0.25,...,6}
      \draw[color=blue,->] (\x,0,0) -- (\x,{sin(2*\x r)},0);

    \draw (3,3.2,0.7) node [information text]{\small linear pola\-risiertes Licht};

    % Probe
    \begin{scope}[thick]
      % Küvette
      \draw (6,-2,-1.5) -- (6,-2, 1.5)% node [above, sloped, midway]{Probe}
            (6,-2,-1.5) --node[midway,sloped,below,lencolor]{\small$d$} (8,-2,-1.5)
            (6, 2, 1.5) -- (8, 2, 1.5)
            (6,-2, 1.5) -- (8,-2, 1.5)
            (6,-2, 1.5) -- (6, 2, 1.5)
            (8, -2, 1.5) -- (8, 2, 1.5) -- (8, 2, -1.5)
              --node[sloped,below,near end]{\small Probe} (8,-2, -1.5) -- cycle;
      \draw[dashed] (6, 2, 1.5) -- (6, 2,-1.5)
            (6,-2,-1.5) -- (6, 2,-1.5)
            (6, 2,-1.5) -- (8,2,-1.5);
      % Achsen
      \draw[->] (8,0,0) -- ++(0,2.5,0) node [right] {y};
      \draw[->] (8,0,0) -- ++(0,0,2) node [above] {z};
      % Winkel
      \draw[angcolor] (8,1,1) .. controls (8,1.307,.541) .. (8,1.414,0);
      \draw[angcolor] (8,-1.5,-1.5) -- ++ (0,3,3);
      \node[angcolor,above] at (8,1,0) {\small$\alpha$};
    \end{scope}
    % polarisiertes Licht in der Probe
    \draw[wave=blue, variable=\x, samples at={6,6.25,...,8}]
      plot (\x,{(-.1115*(\x-6)+1)*sin(2*\x r)},{.3535*(\x-6)*sin(2*\x r)});
    \foreach \x in{6, 6.25,...,8}
      \draw[color=blue,->]
        (\x,0,0) -- (\x,{(-.1115*(\x-6)+1)*sin(2*\x r)},{.3535*(\x-6)*sin(2*\x r)});

    % polarisiertes Licht zwischen Probe und zweitem Gitter
    \draw[wave=blue, variable=\x, samples at={8,8.25,...,16}] 
      plot (\x, {0.707*sin(2*\x r)},  {0.707*sin(2*\x r)});  %
    \foreach \x in{8,8.25,...,16} {
      \draw[color=blue,->] (\x, 0, 0) --
          (\x, {0.707*sin(2*\x r)}, {0.707*sin(2*\x r)});
    }

    \draw (12,2.4,3.1) node [information text]
      {\small linear polarisiertes und um {\color{angcolor}$\alpha$} gedrehtes Licht};

    % Achsen
    \draw[->,thick] (14,0,0) -- ++(0,2.5,0) node [right] {y};
    \draw[->,thick] (14,0,0) -- ++(0,0,2) node [above] {z};

    % Zweites Gitter
    \filldraw[polaroid]
      (14,-2,-1.5) -- (14,-2,1.5) -- (14,2,1.5) -- (14,2,-1.5) -- (14,-2,-1.5)
      node[below, sloped, near end]{\small opt. Gitter};%
    \draw[thick, <->] (14, -1.5,-1) -- ++(0, .707, 0.707); %Polarization direction
  \end{tikzpicture}
  \caption{Schematische Darstellung eines Polarimeters.}
  \label{fig:polarimeter}
\end{figure}
\end{document}
polarimeter.png
polarimeter.png (46.72 KiB) Viewed 5727 times
Regards
site moderator & package author
Tetraquark
Posts: 2
Joined: Fri Dec 27, 2013 9:45 pm

Re: 3D representation of a plane wave with tikz

Post by Tetraquark »

Thank you cgnieder, I'll definitely try this out !
Post Reply