
下面的程式碼產生(如果你可以這樣稱呼它的話)一個球體、一個圓錐體和一個軸。
\definecolor{uuuuuu}
{rgb}{0.26666666666666666,0.26666666666666666,0.26666666666666666}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle45,x=0.6319115323854658cm,y=0.6230529595015575cm]
\clip(-5.8,-5.87) rectangle (6.86,6.97);
\draw(-0.06,1.18) ellipse (2.5276461295418633cm and 2.49221183800623cm);
\draw [rotate around={-0.0028361439127783258: (-0.06000197010244789,1.14019999024578)}] (-0.06000197010244789,1.14019999024578) ellipse (2.563576086468462cm and 0.42243278249466193cm);
\draw [dash pattern=on 2pt off 2pt] (-0.06,1.18)-- (-0.07,-2.84);
\draw (-0.06,1.18)-- (-0.06,6.52);
\draw (-0.07,-2.84)-- (5.87,-2.84);
\draw [dash pattern=on 2pt off 2pt] (-0.07,-2.84)-- (-4.87,-2.81);
\draw [dash pattern=on 2pt off 2pt] (-0.07,-2.84)-- (4.58,0.52);
\draw (-0.07,-2.84)-- (-3.28,-5.39);
\draw [line width=1.6pt] (-0.07,-2.84)-- (3.9369538990052764,1.0239246040321484);
\draw [line width=1.6pt] (-0.07,-2.84)-- (-4.056969330896825,1.024320303603237);
\draw (-3.52,-0.11) node[anchor=north west] {$\sqrt{2}R$};
\draw (-0.06052244670647568,0.9699764239967823)-- (3.9369538990052764,1.0239246040321484);
\draw (0.89,2.05) node[anchor=north west] {$R$};
\begin{scriptsize}
\draw [fill=black] (-0.07,-2.84) circle (1.5pt);
\draw [fill=uuuuuu] (-0.06052244670647567,0.9699764239967822) circle (1.5pt);
\end{scriptsize}
\end{tikzpicture}
我在 Geogebra 上畫了這個形狀。但我不喜歡這個結果。我還想把圓錐體塗成灰色。我不知道如何給它著色(或在 Geogebra 或 tikz 中插入什麼命令)
任何有關改善錐體形狀和顏色的幫助,我們將不勝感激。
PS:我使用以下套件在 LaTeX 中重新建立形狀:
\usepackage{pgf,tikz}
\usepackage{tkz-tab}
\usetikzlibrary{shapes,snakes,arrows,backgrounds}
\usetikzlibrary{scopes,svg.path,shapes.geometric,shadows}
答案1
如果你這樣做的話,這很容易tikz
,而且程式碼更容易閱讀。
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[font=\tiny]
\fill[gray,opacity=0.5] (0,0) -- (2,1.98) -- (-2,1.98) -- (0,0) -- cycle;
\fill (0,0) circle (2pt);
\draw[shorten >= 2pt] (0,0) -- (2.02,2);
\draw[shorten >= 2pt] (0,0) --node[xshift=3mm]{$\sqrt{2}R$} (-2.02,2);
\filldraw[draw=black,outer color=gray!40,inner color=gray!5] (0,2) circle[x radius=2,y radius=0.3];
\fill (0,2) circle (2pt);
\draw (0,2) -- node[yshift=1mm]{$R$} (2,2) (0,2) -- +(0,2.5);
\draw[dash pattern=on 2pt off 2pt] (0,0) -- (0,2) ;
\draw[dash pattern=on 2pt off 2pt] (0,0) -- (-2.5,0) ;
\draw[dash pattern=on 2pt off 2pt] (0,0) -- (30:2.5) ;
\draw (0,0) -- (210:2) ;
\draw (0,0) -- (2,0) ;
\draw (0,2) circle (2);
\end{tikzpicture}
\end{document}