我画了一块偏心板。但我画不出一个带有偏心孔的球冠。
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\definecolorseries{colours}{hsb}{grad}[hsb]{0,0,1}{0,0,0}
\resetcolorseries[12]{colours}
\begin{document}
\begin{tikzpicture}
\draw[thick, dotted] (0,0.35,0) -- (7,0.35,2.3) node[anchor=north west]{};
\foreach \i in {0}
{
\color{green!55}
\scoped[yshift=0.5*\i mm] \draw [draw=blue!10!black, preaction={fill, even odd rule}] circle (5 and 3) (10mm,0) circle (2 and 1.1);
}
\foreach \i in {2}
{
\color{black!85}
\scoped[yshift=0.5*\i mm] \draw [draw=blue!10!black, preaction={fill, even odd rule}] circle (5 and 3) (10mm,0) circle (2 and 1.1);
}
\foreach \i in {4}
{
\color{black!55}
\scoped[yshift=0.5*\i mm] \draw [draw=blue!10!black, preaction={fill, even odd rule}] circle (5 and 3) (10mm,0) circle (2 and 1.1);
}
\draw[very thick,-latex, magenta] (0,0.35,0) -- (3,0.35,-5.5) node[anchor=north west, scale=1.5]{$r$};
\foreach \i in {6}
{
\color{black!35}
\scoped[yshift=0.5*\i mm] \draw [draw=blue!10!black, preaction={fill, even odd rule}] circle (5 and 3) (10mm,0) circle (2 and 1.1);
}
\foreach \i in {8}
{
\color{black!15}
\scoped[yshift=0.5*\i mm] \draw [draw=blue!10!black, preaction={fill, even odd rule}] circle (5 and 3) (10mm,0) circle (2 and 1.1);
}
\foreach \i in {10}
{
\color{black!5}
\scoped[yshift=0.5*\i mm] \draw [draw=blue!10!black, preaction={fill, even odd rule}] circle (5 and 3) (10mm,0) circle (2 and 1.1);
}
\foreach \i in {12}
{
\color{green!55}
\scoped[yshift=0.5*\i mm] \draw [draw=blue!10!black, preaction={fill, even odd rule}] circle (5 and 3) (10mm,0) circle (2 and 1.1);
}
\foreach \i in {14}
{
\color{green!55}
\scoped[yshift=0.5*\i mm] \draw [draw=blue!10!black, preaction={fill, even odd rule}] circle (5 and 3) (10mm,0) circle (2 and 1.1);
}
\draw[thick,-latex] (0,0.35,0) -- (0,2.5,0) node[anchor=north west, scale=1.3]{$z$};
\draw[color=black] (-5.35,-0.7,-1) to[dim above=$ $,color=black] (-5.35,0,-1) ;
\draw[very thick,-latex, magenta, dotted] (0,0.35,0) -- (3,0.35,-5.5) node[anchor=north west, scale=1.4]{};
\end{tikzpicture}
\end{document}
答案1
更新:有厚度。
\documentclass[tikz,border=5pt]{standalone}
\usetikzlibrary{shadings}
\begin{document}
\begin{tikzpicture}
\shade[ball color=green!50!blue] (4,0) arc(0:-180:4 and 1.5) to[out=80,in=100] cycle;
\clip plot[variable=\t,domain=0:360,samples=120] ({1.4+cos(15)*1.7*cos(\t)+sin(15)*0.6*sin(\t)},
{1.4+cos(15)*0.6*sin(\t)-sin(15)*1.7*cos(\t)});
\fill[white] plot[variable=\t,domain=0:360,samples=120] ({1.4+cos(15)*1.7*cos(\t)+sin(15)*0.6*sin(\t)},
{1.4+cos(15)*0.6*sin(\t)-sin(15)*1.7*cos(\t)});
\shade[bottom color=blue!25!green!50!black,top color=blue!25!green!10!black] (4,0) arc(0:180:4 and 1.5) to[out=90,in=90] cycle;
\draw[fill=green!50!blue] plot[variable=\t,domain=0:180,samples=120] ({1.4+cos(15)*1.7*cos(\t)+sin(15)*0.6*sin(\t)},
{1.3+cos(15)*0.6*sin(\t)-sin(15)*1.7*cos(\t)})
-- ++(0,2) -- ++(3.4,0) --cycle;
\end{tikzpicture}
\end{document}
附录:如果您希望让某只鸭子(或其他东西)从洞里往外看,那么您将需要另一个夹子。
\documentclass[tikz,border=5pt]{standalone}
\usepackage{tikzducks}
\usetikzlibrary{shadings}
\begin{document}
\begin{tikzpicture}
\shade[ball color=green!50!blue] (4,0) arc(0:-180:4 and 1.5) to[out=80,in=100] cycle;
\begin{scope}
\clip plot[variable=\t,domain=0:360,samples=120] ({1.4+cos(15)*1.7*cos(\t)+sin(15)*0.6*sin(\t)},
{1.4+cos(15)*0.6*sin(\t)-sin(15)*1.7*cos(\t)});
\fill[white] plot[variable=\t,domain=0:360,samples=120] ({1.4+cos(15)*1.7*cos(\t)+sin(15)*0.6*sin(\t)},
{1.4+cos(15)*0.6*sin(\t)-sin(15)*1.7*cos(\t)});
\shade[bottom color=blue!25!green!50!black,top color=blue!25!green!10!black] (4,0) arc(0:180:4 and 1.5) to[out=90,in=90] cycle;
\draw[fill=green!50!blue] plot[variable=\t,domain=0:180,samples=120] ({1.4+cos(15)*1.7*cos(\t)+sin(15)*0.6*sin(\t)},
{1.3+cos(15)*0.6*sin(\t)-sin(15)*1.7*cos(\t)})
-- ++(0,2) -- ++(3.4,0) --cycle;
\end{scope}
\clip plot[variable=\t,domain=0:-180,samples=120] ({1.4+cos(15)*1.7*cos(\t)+sin(15)*0.6*sin(\t)},
{1.4+cos(15)*0.6*sin(\t)-sin(15)*1.7*cos(\t)}) -- ++(0,2cm) -- ++(3.4,0) --
cycle;
\node at (1.7,1.5) {\tikz[xscale=-1]{\duck}};
\end{tikzpicture}
\end{document}