1

enter image description hereI want to draw the attached figure that I did in power point in Latex, I can't figure out an easy way to draw the tangent and I want to draw the balloon shape as 3d plot

\documentclass[tikz,border=5pt]{standalone}
\begin{document}

\begin{tikzpicture}[scale=0.5] \draw[rotate=180] (-2,0.25)--++(8,0); \draw[rotate=180, fill=gray!30] (2,0.25) .. controls (9,6) and (-5,6) .. (2,0.25); \begin{scope}[xshift=6cm, yshift=-10cm] \def\rx{4} % horizontal radius of the ellipse \def\ry{0.5} % vertical radius of the ellipse \def\z{2} % distance from center of ellipse to origin

\pgfmathparse{asin(\ry/\z)} \let\angle\pgfmathresult

\coordinate (h) at (0, \z); \coordinate (O) at (0, 0);
\coordinate (A) at ({-\rxcos(\angle)}, {\z-\rysin(\angle)}); \coordinate (B) at ({\rxcos(\angle)}, {\z-\rysin(\angle)}); \coordinate (C) at (3, 2);

\draw[fill=gray!50] (A) -- (O) -- (B) -- cycle; \draw[fill=gray!30] (h) ellipse ({\rx} and {\ry}); \end{scope} \end{tikzpicture} \end{document}

Diana
  • 1,285
  • 7
  • 12
  • Irregular shapes are always more difficult than regular shapes. If d is tangent at the top, you need a cone which morphs into an off-center sphere. – John Kormylo Jul 20 '22 at 13:16

1 Answers1

1

enter image description here

\documentclass[tikz,border=5pt]{standalone}
\begin{document}

\usetikzlibrary{decorations.markings}

\begin{tikzpicture}[scale=0.5] \draw[rotate=180] (-2,0)--++(8,0); \draw[ball color=gray!5, looseness=1.5] (0,0) to[out=-20,in=0] nodesloped, pos=0.3{} (0,-3) to[out=180, in=180+20] nodesloped, fill=black, inner xsep=40pt, inner ysep=0, yscale=0.4, pos=0.9{} cycle; \begin{scope}[xshift=6cm, yshift=-10cm] \def\rx{2.5} % horizontal radius of the ellipse \def\ry{0.3} % vertical radius of the ellipse \def\z{1.5} % distance from center of ellipse to origin

\pgfmathparse{asin(\ry/\z)} \let\angle\pgfmathresult

\coordinate (h) at (0, \z); \coordinate (O) at (0, 0);
\coordinate (A) at ({-\rxcos(\angle)}, {\z-\rysin(\angle)}); \coordinate (B) at ({\rxcos(\angle)}, {\z-\rysin(\angle)}); \coordinate (C) at (3, 2); \draw[left color=gray!50,right color=white] (A) -- (O) -- (B) -- cycle; \draw[fill=gray!30] (h) ellipse ({\rx} and {\ry}); \end{scope}

\draw[<->, shorten >= -23pt] (O) -- (P); \end{tikzpicture} \end{document}

Look at this question: How to draw tangent line of an arbitrary point on a path in TikZ as well.

antshar
  • 4,238
  • 9
  • 30