0

How to plot a donut whose Fig is attached herewith

enter image description here

The donut looks very nice. I want to plot it. The parametric equation of the torus is

$$x = (R + a cos(p)) cos(t);$$ $$y = (R + a cos(p)) sin(t);$$ $$z = a sin(p);$$ where $t,p\in [0, 2\pi]$ How to do that? EDIT: What I have tried is given below:

 \documentclass{article}
    \usepackage[margin=0.5in]{geometry}
    \usepackage[utf8]{inputenc}
    \usepackage{comment}
\usepackage{pgfplots}
\pgfplotsset{width=10cm, compat=1.16}

\begin{document}

\begin{tikzpicture}

\begin{axis} [ view={60}{30}, ] \addplot3[surf,shader=interp, domain=0:2pi, p domain=0:2pi, samples=101, samples x=2,R=5,a=2 ] ({(R + acos(deg(p)))cos(deg(x))}, {(R + acos(deg(p)))sin(deg(x))},{a*sin(deg(x))}); \end{axis} \end{tikzpicture} \end{document}

math131
  • 149
  • 1
    Duplicates https://tex.stackexchange.com/questions/27597/drawing-checkered-torus-doughnut https://tex.stackexchange.com/questions/247997/drawing-cross-sections-of-contours-over-torus https://tex.stackexchange.com/questions/348/how-to-draw-a-torus – samcarter_is_at_topanswers.xyz Sep 20 '23 at 14:52
  • 3
    Do-this-complicated-thing-for-me questions are often less than well-received (unless they involve something cute like a duck). Please show us what you've tried or hire somebody to create your images from scratch, if you don't want to. Also, you shouldn't use $$ in LaTeX and/or MathJax is not enabled on this site. – cfr Sep 20 '23 at 14:53
  • the codes are not executing \usepackage{pst-solides3d} in overleaf – math131 Sep 20 '23 at 15:22
  • Also here the Fig is very attractive that the fig in the links – math131 Sep 20 '23 at 15:22
  • You can't use pst-solides3d with pdflatex. Pick one of the TikZ solutions or use a different engine. – cfr Sep 20 '23 at 20:41
  • @cfr Would you please post a code for getting this nice figure – math131 Sep 21 '23 at 05:15
  • 1
    As I've already explained, that's not how this site works. Frankly, I also think you're bizarrely unappreciative of the *many* answers you've been directed to, including an entire page of possibilities, many of which I find rather attractive. If you want to create something different, you have to put the time in to learn how to use the tools or put the money up for a professional. Yes, people sometimes get lucky and somebody draws something for them if the question interests them, but something like this is a lot of work. If you put the effort in, people will help when you get stuck. – cfr Sep 21 '23 at 05:51
  • 1
    Start with something simple. Work through the tutorials in the TikZ manual until you can draw basic stuff. Then you can start looking at TikZ's 3D and plotting stuff or at pgfplots. That's if you want to learn pgf/TikZ. Obviously, if you prefer one of the other tools, you should start there. If you need something quickly \includegraphics is your friend. If you need to modify it, try Inkscape or equivalent. (Inkscape can produce TikZ code, though it is not very wieldy in my experience.) – cfr Sep 21 '23 at 05:56
  • @cfr What I have tried is edited above. Thank you. – math131 Sep 21 '23 at 05:56
  • @math131, this community voted to close your question, as there were many duplicates (answered before). Voting to reopen will require, at least if I had to, to see, that you worked with the at least 14 or so proposals. 11: https://tex.stackexchange.com/questions/348/how-to-draw-a-torus; 2: https://tex.stackexchange.com/questions/27597/drawing-checkered-torus-doughnut; 1 Q: https://tex.stackexchange.com/questions/247997/drawing-cross-sections-of-contours-over-torus. // It's also a good idea to include a screenshot of your current result. // See your previous questions. – MS-SPO Sep 21 '23 at 06:06

0 Answers0