3

I can generate a cone with a circular base but I have no idea as to how to mark another cone within it. The end result I am aiming for looks like the following image.

enter image description here

  • This is a math problem. draw big cone first then draw small circle with center at half of height. – user108724 Feb 15 at 9:33
3
 \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}

enter image description here

| improve this answer | |
  • The logic of your code is neat. Thank you for your help. – Sam Feb 17 at 18:40
7

You can use tikz-3dplot. In this code, you can change the value of x of the line \pgfmathsetmacro\myx{\h/2}. In your case, 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}

enter image description here

With \pgfmathsetmacro\myx{\h/5}, we have

enter image description here

| improve this answer | |
4

If you want a correct cone in 3d you can read this Mathematics_in_Science_Teaching

The code is from Aslanbek Naziev (Ryazan State University). I adapted the code to 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} 

enter image description here

| improve this answer | |
  • Hi, how do we read this file (Mathematics_in_Science_Teaching)? This link leads to a page that asks you to choose a file type RIS, BibTeX, etc. – AndréC Feb 15 at 12:13
  • @AndréC I changed the link ! but I have no trouble reading the old link. – Alain Matthes Feb 15 at 12:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.