答案1
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\draw(0,0) circle (2cm and 0.5cm);
\draw(2,0) -- (0,6) -- (-2,0) arc (180:360:2cm and 0.5cm);
\draw(-2,0) arc (180:360:2cm and 0.5cm) -- (0,6) -- cycle;
\draw[dashed](-2,0) arc (180:0:2cm and 0.5cm);
\draw[dashed](2,0) -- node[below] {$2r$} (0,0);
\draw(-1,3)arc (180:360:1cm and 0.25cm);
\draw[dashed](-1,3)arc (180:0:1cm and 0.25cm);
\draw[dashed](1,3) -- node[below=-2pt] {$r$} (0,3) ;
\draw[|-|] (-2.5,6) -- (-2.5,0) node[left,pos=.5]{$2h$};
\draw[|-|] (2.5,6) -- (2.5,3) node[right,pos=.5]{$h$};
\end{tikzpicture}
\end{document}
答案2
您可以使用。在此代码中,您可以更改行 的tikz-3dplot
值。就您而言,。x
\pgfmathsetmacro\myx{\h/2}
myx = h/2
\documentclass[border=1mm,tikz,12pt]{standalone}
\usepackage{tikz-3dplot}
\begin{document}
\pgfmathsetmacro\th{75}
\pgfmathsetmacro\az{60}
\tdplotsetmaincoords{\th}{\az}
\pgfmathsetmacro\a{1}
\pgfmathsetmacro\R{3*\a} %radius of base
\pgfmathsetmacro\h{5*\a} %hight of cone
\pgfmathsetmacro\myx{\h/2}
\pgfmathsetmacro\myr{(\h-\myx)*\R/\h}
\pgfmathsetmacro\cott{{cot(\th)}}
\pgfmathsetmacro\fraction{\R*\cott/\h}
\pgfmathsetmacro\angle{{acos(\fraction)}}
\pgfmathsetmacro\PhiOne{180+(\az-90)+\angle}
\pgfmathsetmacro\PhiTwo{180+(\az-90)-\angle}
\pgfmathsetmacro\sinPhiOne{{sin(\PhiOne)}}
\pgfmathsetmacro\cosPhiOne{{cos(\PhiOne)}}
\pgfmathsetmacro\sinPhiTwo{{sin(\PhiTwo)}}
\pgfmathsetmacro\cosPhiTwo{{cos(\PhiTwo)}}
\begin{tikzpicture} [tdplot_main_coords,line join = round, line cap = round]
\path
(0,0,0) coordinate (O)
(0,0,\h) coordinate (S)
(0,0,\myx) coordinate (O');
\draw[dashed] (O) -- (O') node[right, midway]{$x$};
\draw[dashed] (S) -- (O') node[sloped,midway,auto=left]{$h-x$};
\begin{scope}[canvas is xy plane at z=\myx]
\tdplotdrawarc[thick]{(O')}{\myr}{\PhiOne}{360+\PhiTwo}{anchor=north}{} \tdplotdrawarc[dashed]{(O')}{\myr}{\PhiTwo}{\PhiOne}{anchor=north}{}
\draw[dashed] (O') --(\myr*\cosPhiTwo,\myr*\sinPhiTwo,0) node[midway, below] {$ r $};
\end{scope}
\tdplotdrawarc[thick]{(O)}{\R}{\PhiOne}{360+\PhiTwo}{anchor=north}{} \tdplotdrawarc[dashed]{(O)}{\R}{\PhiTwo}{\PhiOne}{anchor=north}{}
\draw[thick] (S) -- (\R*\cosPhiOne,\R*\sinPhiOne,0);
\draw[thick] (S) -- (\R*\cosPhiTwo,\R*\sinPhiTwo,0);
\draw[dashed] (O) --(\R*\cosPhiTwo,\R*\sinPhiTwo,0) node[midway, below] {$ R = 2r $};
\foreach \p in {S,O,O'}
\draw[fill=black] (\p) circle (1.5pt);
\foreach \p/\g in {S/90,O/-90,O'/180}
\path (\p)+(\g:3mm) node{$\p$};
\end{tikzpicture}
\end{document}
有了\pgfmathsetmacro\myx{\h/5}
,我们有
答案3
如果你想要一个正确的 3D 锥体,你可以阅读此科学教学中的数学
代码来自 Aslanbek Naziev (梁赞国立大学)。我改编了代码以适应 v3.02。
\documentclass{standalone}
\usepackage{tkz-euclide}
\begin{document}
\thispagestyle{empty}
\begin{tikzpicture}
\tkzSetUpPoint[size=3]
\begin{scope}[xscale=2]
\tkzDefPoint(0,0){O_1}
\tkzDefPoint(0,1.25){R}
\tkzDefPoint(0,6){T}
\tkzDefPoint(-1.25,0){A}
\tkzDefPoint(1.25,0){B}
\tkzDefPoint(0,1.25){C}
\tkzDefPoint(0,-1.25){D}
\tkzDefTangent[from = T](O_1,R)
\tkzGetPoints{t_1}{t_2}
\tkzDrawArc[dashed](O_1,t_2)(t_1)
\tkzDrawArc(O_1,t_1)(t_2)
\tkzDefPointBy[symmetry=center O_1](t_1)
\tkzGetPoint{t_3}
\tkzDrawSegments[dashed](t_1,t_3 T,O_1 C,D)
\tkzDrawSegments(T,t_1 T,t_2 T,t_3)
\tkzLabelPoints[above right](O_1)
\end{scope}
\tkzDefPoint(-2.5,-1.25){X1}
\tkzDefPoint(12,-1.25){Y1}
\tkzDefPoint(-2.5,0){X}
\tkzDefPoint(12,0){Y}
\tkzDefPoint(-2.5,1.25){X2}
\tkzDefPoint(12,1.25){Y2}
\tkzDefPoint(-2.5,6){X3}
\tkzDefPoint(12,6){Y3}
\tkzDefPoint(3,1.25){C'}
\tkzInterLC[R](X1,Y1)(C',5 cm)
\tkzGetPoints{D'}{E'}
\tkzInterLL(X,Y)(C',D')
\tkzGetPoint{O_1'}
\tkzDefLine[mediator](C',D')
\tkzGetPoints{F'}{G'}
\tkzInterLL(X3,Y3)(F',G')
\tkzGetPoint{T'}
\tkzDefCircle[in](C',T',D')
\tkzGetPoint{I}
\tkzGetLength{rIN}
\tkzDefTangent[from = T'](I,O_1')
\tkzGetPoints{G}{H}
\tkzInterLL(T',O_1')(G,H)
\tkzGetPoint{J}
\tkzDefLine[parallel=through J](X,Y)
\tkzGetPoint{j}
\tkzInterLL(T,O_1)(J,j)
\tkzGetPoint{O_2}
\tkzDefLine[parallel=through I](X,Y)
\tkzGetPoint{i}
\tkzDefLine[parallel=through G](X,Y)
\tkzGetPoint{g}
\tkzInterLL(T,O_1)(G,g)
\tkzGetPoint{C_1}
\begin{scope}[xscale=2]
\tkzDefCircle[radius](O_2,C_1)
\tkzDefTangent[from = T](O_2,C_1)
\tkzGetPoints{t_4}{t_5}
\tkzDrawArc[dashed](O_2,t_5)(t_4)
\tkzDrawArc(O_2,t_4)(t_5)
\end{scope}
\tkzInterLL(T,O_1)(I,i)
\tkzGetPoint{O}
\tkzInterLC[R](T',O_1')(I,\rIN pt)
\tkzGetPoints{N'}{Z'}
\tkzDefLine[parallel=through N'](X,Y)
\tkzGetPoint{n}
\tkzInterLL(T,O_1)(N',n)
\tkzGetPoint{N}
\tkzDrawPoints(O_1,O_2,t_1,t_2,t_3)
\tkzLabelPoints[right](O_2)
\end{tikzpicture}
\end{document}
带有 5.06 和 5.10(该版本在 ctan 上可用,但尚未在所有服务器上可用)
\documentclass{standalone}
\usepackage{tkz-euclide}
\begin{document}
\thispagestyle{empty}
\begin{tikzpicture}
\tkzSetUpPoint[size=3]
\begin{scope}[xscale=2]
\tkzDefPoint(0,0){O_1}
\tkzDefPoint(0,1.25){R}
\tkzDefPoint(0,6){T}
\tkzDefPoint(-1.25,0){A}
\tkzDefPoint(1.25,0){B}
\tkzDefPoint(0,1.25){C}
\tkzDefPoint(0,-1.25){D}
\tkzDefTangent[from = T](O_1,R)
\tkzGetPoints{t_2}{t_1}
\tkzDrawArc[dashed](O_1,t_2)(t_1)
\tkzDrawArc(O_1,t_1)(t_2)
\tkzDefPointBy[symmetry=center O_1](t_1)
\tkzGetPoint{t_3}
\tkzDrawSegments[dashed](t_1,t_3 T,O_1 C,D)
\tkzDrawSegments(T,t_1 T,t_2 T,t_3)
\tkzLabelPoints[above right](O_1)
\end{scope}
\tkzDefPoint(-2.5,-1.25){X1}
\tkzDefPoint(12,-1.25){Y1}
\tkzDefPoint(-2.5,0){X}
\tkzDefPoint(12,0){Y}
\tkzDefPoint(-2.5,1.25){X2}
\tkzDefPoint(12,1.25){Y2}
\tkzDefPoint(-2.5,6){X3}
\tkzDefPoint(12,6){Y3}
\tkzDefPoint(3,1.25){C'}
\tkzInterLC[R](X1,Y1)(C',5)
\tkzGetPoints{D'}{E'}
\tkzInterLL(X,Y)(C',D')
\tkzGetPoint{O_1'}
\tkzDefLine[mediator](C',D')
\tkzGetPoints{F'}{G'}
\tkzInterLL(X3,Y3)(F',G')
\tkzGetPoint{T'}
\tkzDefCircle[in](C',T',D')
\tkzGetPoint{I}
\tkzGetLength{rIN}
\tkzDefTangent[from = T'](I,O_1')
\tkzGetPoints{G}{H}
\tkzInterLL(T',O_1')(G,H)
\tkzGetPoint{J}
\tkzDefLine[parallel=through J](X,Y)
\tkzGetPoint{j}
\tkzInterLL(T,O_1)(J,j)
\tkzGetPoint{O_2}
\tkzDefLine[parallel=through I](X,Y)
\tkzGetPoint{i}
\tkzDefLine[parallel=through G](X,Y)
\tkzGetPoint{g}
\tkzInterLL(T,O_1)(G,g)
\tkzGetPoint{C_1}
\begin{scope}[xscale=2]
\tkzDefTangent[from = T](O_2,C_1)
\tkzGetPoints{t_4}{t_5}
\tkzDrawArc[dashed](O_2,t_5)(t_4)
\tkzDrawArc(O_2,t_4)(t_5)
\end{scope}
\tkzInterLL(T,O_1)(I,i)
\tkzGetPoint{O}
\tkzInterLC[R](T',O_1')(I,\rIN)
\tkzGetPoints{N'}{Z'}
\tkzDefLine[parallel=through N'](X,Y)
\tkzGetPoint{n}
\tkzInterLL(T,O_1)(N',n)
\tkzGetPoint{N}
\tkzDrawPoints(O_1,O_2,t_1,t_2,t_3)
\tkzLabelPoints[right](O_2)
\end{tikzpicture}
\end{document}
答案4
您可以使用3dtools
这里像这样
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{calc,3dtools}% https://github.com/marmotghost/tikz-3dtools
\begin{document}
\begin{tikzpicture}[3d/install view={phi=110,theta=70},line join = round, line cap = round,
declare function={R=4;v=6;% base radius and height of the cone
r=R/2;% radius of the small circle
h=(R-r)*v/R;% height of the base of the upper circle
}]
\path pic{3d/cone={r=R,h=v}} (0,0,h) pic{3d/cone={r=r,h/.evaluated=v-h}};
\draw[3d/hidden] (0,0,0) -- (0,0,v);
\end{tikzpicture}
\end{document}