I am able to a horizontal sine wave using the below code.
\draw[domain = 0:4] plot [smooth] (\x,{0.4 * sin(\x * pi/2 r)});
How to draw an inclined sine wave using TikZ? Something similar to the following image:
tikz-pgf
I am able to a horizontal sine wave using the below code.
\draw[domain = 0:4] plot [smooth] (\x,{0.4 * sin(\x * pi/2 r)});
How to draw an inclined sine wave using TikZ? Something similar to the following image:
It is possible, but it does not neccessarily help understanding. The first is a rotation with constant angular velocity about the z-axis, which you probably get from the picture. But it gets quite incomprehendable from there: I wouldn't know what the second one is.
So I started experimenting. The next two explore the possibility to draw surfaces connecting to the xy-plane with or without the actual line drawn.
Then I fried connections via radial lines, which just looks ugly.
Lastly, I tried surfaces connectiong radially to the z-axis.
Let me know if anything at least comes remotely to what you were looking for.
\documentclass[parskip]{scrartcl}
\usepackage[margin=15mm,a3paper,landscape]{geometry}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[x={(0.707cm,0.707cm)},z={(0cm,1cm)},y={(-0.866cm,0.5cm)}]
\draw[->] (-2,0,0) -- (2,0,0) node[right] {x};
\draw[->] (0,-2,0) -- (0,2,0) node[left] {y};
\draw[->] (0,0,-2) -- (0,0,12) node[above] {z};
\draw (1,0,0)
\foreach \z in {0,0.1,...,10}
{ -- ({cos(\z*100)},{sin(\z*100)},{\z})
};
\node[rotate=90,right=1cm] at (0,0,12) {normal rotation};
\end{tikzpicture}
\begin{tikzpicture}[x={(0.707cm,0.707cm)},z={(0cm,1cm)},y={(-0.866cm,0.5cm)}]
\draw[->] (-2,0,0) -- (2,0,0) node[right] {x};
\draw[->] (0,-2,0) -- (0,2,0) node[left] {y};
\draw[->] (0,0,-2) -- (0,0,12) node[above] {z};
\draw (1,0,0)
\foreach \z in {0,0.1,...,10}
{ -- ({cos(\z*200)},{sin(\z*100)},{\z})
};
\node[rotate=90,right=1cm] at (0,0,12) {WTF?};
\end{tikzpicture}
\begin{tikzpicture}[x={(0.707cm,0.707cm)},z={(0cm,1cm)},y={(-0.866cm,0.5cm)}]
\draw[->] (-2,0,0) -- (2,0,0) node[right] {x};
\draw[->] (0,-2,0) -- (0,2,0) node[left] {y};
\draw[->] (0,0,-2) -- (0,0,12) node[above] {z};
\draw (1,0,0)
\foreach \z in {0,0.1,...,10}
{ -- ({cos(\z*189)},{sin(\z*91)},{\z})
};
\foreach \z in {0,0.1,...,9.9}
{\fill[gray,opacity=0.2] ({cos(\z*189)},{sin(\z*91)},0) -- ({cos(\z*189)},{sin(\z*91)},{\z}) -- ({cos((\z+0.1)*189)},{sin((\z+0.1)*91)},{\z+0.1}) -- ({cos((\z+0.1)*189)},{sin((\z+0.1)*91)},0) -- cycle;
}
\node[rotate=90,right=1cm] at (0,0,12) {to floor, gray};
\end{tikzpicture}
\begin{tikzpicture}[x={(0.707cm,0.707cm)},z={(0cm,1cm)},y={(-0.866cm,0.5cm)}]
\draw[->] (-2,0,0) -- (2,0,0) node[right] {x};
\draw[->] (0,-2,0) -- (0,2,0) node[left] {y};
\draw[->] (0,0,-2) -- (0,0,12) node[above] {z};
\foreach \z in {0,0.1,...,9.9}
{ \pgfmathtruncatemacro{\mycolorpercentage}{\z/0.099}
\fill[red!\mycolorpercentage!blue,opacity=0.1] ({cos(\z*210)},{sin(\z*42)},0) -- ({cos(\z*210)},{sin(\z*42)},{\z}) -- ({cos((\z+0.1)*210)},{sin((\z+0.1)*42)},{\z+0.1}) -- ({cos((\z+0.1)*210)},{sin((\z+0.1)*42)},0) -- cycle;
}
\node[rotate=90,right=1cm] at (0,0,12) {to floor, color gradient};
\end{tikzpicture}
\begin{tikzpicture}[x={(0.707cm,0.707cm)},z={(0cm,1cm)},y={(-0.866cm,0.5cm)}]
\draw[->] (-2,0,0) -- (2,0,0) node[right] {x};
\draw[->] (0,-2,0) -- (0,2,0) node[left] {y};
\draw[->] (0,0,-2) -- (0,0,12) node[above] {z};
\draw (1,0,0)
\foreach \z in {0,0.1,...,10}
{ -- ({cos(\z*207)},{sin(\z*101)},{\z})
};
\foreach \z in {0,0.1,...,10}
{ \draw[opacity=0.5,gray] ({cos(\z*207)},{sin(\z*101)},{\z}) -- (0,0,\z);
}
\node[rotate=90,right=1cm] at (0,0,12) {radial lines};
\end{tikzpicture}
\begin{tikzpicture}[x={(0.707cm,0.707cm)},z={(0cm,1cm)},y={(-0.866cm,0.5cm)}]
\draw[->] (-2,0,0) -- (2,0,0) node[right] {x};
\draw[->] (0,-2,0) -- (0,2,0) node[left] {y};
\draw[->] (0,0,-2) -- (0,0,12) node[above] {z};
\draw (1,0,0)
\foreach \z in {0,0.1,...,10}
{ -- ({cos(\z*237)},{sin(\z*111)},{\z})
};
\foreach \z in {0,0.1,...,9.9}
{ \fill[opacity=0.5,gray] (0,0,\z) -- ({cos(\z*237)},{sin(\z*111)},{\z}) -- ({cos((\z+0.1)*237)},{sin((\z+0.1)*111)},{(\z+0.1)}) -- (0,0,{(\z+0.1)}) -- cycle;
}
\node[rotate=90,right=1cm] at (0,0,12) {radial surfaces, gray};
\end{tikzpicture}
\begin{tikzpicture}[x={(0.707cm,0.707cm)},z={(0cm,1cm)},y={(-0.866cm,0.5cm)}]
\draw[->] (-2,0,0) -- (2,0,0) node[right] {x};
\draw[->] (0,-2,0) -- (0,2,0) node[left] {y};
\draw[->] (0,0,-2) -- (0,0,12) node[above] {z};
\draw (1,0,0)
\foreach \z in {0,0.1,...,10}
{ -- ({cos(\z*37)},{sin(\z*219)},{\z})
};
\foreach \z in {0,0.1,...,9.9}
{ \pgfmathtruncatemacro{\mycolorpercentage}{\z/0.099}
\fill[opacity=0.3,orange!\mycolorpercentage!cyan] (0,0,\z) -- ({cos(\z*37)},{sin(\z*219)},{\z}) -- ({cos((\z+0.1)*37)},{sin((\z+0.1)*219)},{(\z+0.1)}) -- (0,0,{(\z+0.1)}) -- cycle;
}
\node[rotate=90,right=1cm] at (0,0,12) {radial, color gradient};
\end{tikzpicture}
\end{document}
Just for fun! [2]
Now with tikz.
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{calc}
\usetikzlibrary{intersections}
\tikzset{
tips/.style = {
triangle 45-triangle 45
, font = \it
}
}
\begin{document}
\begin{tikzpicture}
\pgfmathsetlengthmacro{\a}{5cm}
\pgfmathsetlengthmacro{\b}{8cm}
\pgfmathsetlengthmacro{\billedplan}{\a - \b}
\draw [thick] (-4, 0) -- (4, 0) node [right] {Vannoverflate (linse)};
\draw [thick, name path = bill] (-4, \billedplan) -- (4, \billedplan) node [below right] {Billedplan};
\draw [tips] (-4.5, \billedplan) -- (-4.5, \a) node [midway, left] {b};
\draw [tips] (-3.5, 0) -- (-3.5, \a) node [midway, left] {a};
\draw[red, thick, domain = -2:2] plot [smooth] (\x,{0.3 * sin(\x * pi r)});
\coordinate (ref) at (0.5, \a);
\node [right] at (ref) {Lyskilde};
\coordinate (sin A) at ($(-1.5, 0.3 * sin(-1.5 * pi r)$);
\coordinate (aux A) at ($(ref)!1.1 * \b!(sin A)$);
\coordinate (sin B) at ($(0.5, 0.3 * sin(0.5 * pi r)$);
\path [name path = a] (ref) -- (aux A);
\fill [name intersections = {of= bill and a, by = i}];
\draw [thick] (ref) -- (i);
\draw [thick] (ref) -- (-2, 0) -- (i);
\draw [thick] (ref) -- (-1, 0) -- (i);
\draw [thick] (ref) -- (0.5, \billedplan);
\draw [thick] (ref) -- (0, 0) -- (0.5, \billedplan);
\draw [thick] (ref) -- (1, 0) -- (0.5, \billedplan);
\path (-1, 0) -- (0, 0) node [midway, above] {$\lambda$};
\path (i) -- (0.5, \billedplan) node [midway, above] {$\lambda'$};
\end{tikzpicture}
\end{document}
Best Answer