tikz add tag
5 years ago samcarter

How to draw a doughnut[1] with all the delicious toppings?


  1. In case anyone is wondering why a doughnut and not, say, broccoli, have a look at https://www.bbc.co.uk/ideas/videos/the-science-behind-why-doughnuts-are-so-hard-to-re/p08l9dzq ↩︎

Top Answer
5 years ago samcarter

With the following code, you can create your own doughnut just as you like it.

The plain doughnut is drawn with the \doughnut macro. As decoration, icing, garnish and sprinkles can be added in whatever colour you fancy. By default the sprinkles are multi-coloured.

doughnut

(this code is also available as a small package at https://github.com/samcarter/tikzbits)

Answer #2
4 years ago user 3.14159

Here is a doughnut for mathematicians and physicists, who have the strange habit of calling a doughnut a torus. It requires the 3dtools library, which contains functions for some critical angles. This means that you can adjust the view and draw cycles that wrap around tori.

ani.gif

4 years
user 3.14159 replying to JeT — Thursday, 29th Oct 2020 01:07

I really like such sites, and the fact that there are some volunteers who provide us with these tools for free. This is also a reason why I think that Q & A sites should not end with .com, and that the LaTeX user base should have a say on what they think is important for LaTeX…

JeT replying to user 3.14159 — Thursday, 29th Oct 2020 00:59

Of course you don’t 😃 Merci for this site, it’s exactly what I was talking about ! It’s great inspiration indeed. wow ! What a great way to democratize concepts.

23 minutes
user 3.14159 replying to JeT — Thursday, 29th Oct 2020 00:36

I do not think that I am doing extraordinary things. There are some initiatives to improve teaching, for instance by Nobel Laureate Carl Wieman, who inspire others. But I totally agree that it is worthwhile to try to break down things into small, understandable pieces. And I know some French scientists who are very good at this. And nowadays the internet is a good source for inspirations, not only good in providing LaTeX, but also other tools like this one. It would be interesting to know where this will lead to. Maybe a successor of LaTeX can play a role in this, it would be good if some non-commercial tools will be available also in the future…

25 minutes
JeT replying to user 3.14159 — Thursday, 29th Oct 2020 00:11

Forgive my candid digression. In France most scientific disciplines are taught in a very theoretic way. Many people are just disgusted by endless formalism(of course necessary at some point) and miss what’s at stake. But It would not take much to formalize things visually first (when possible but your thousands posts prove me the same way you can have a MWE, you can have a good visual of on any concept) to get back to intuition. Intuition that seems much more present in the US.

JeT replying to user 3.14159 — Thursday, 29th Oct 2020 00:01

And I respect that:) I was just curious to see what I could aim at in terms of pedagogy, how all these fantastic representations can actually support the knowledge you want to pass.

an hour
Anonymous 1123 replying to user 3.14159 — Wednesday, 28th Oct 2020 22:49

Yes, this is.

7 hours
user 3.14159 replying to Anonymous 1123 — Wednesday, 28th Oct 2020 15:44

Or this?
ani.gif

an hour
user 3.14159 replying to Anonymous 1123 — Wednesday, 28th Oct 2020 14:30

It does that, doesn’t it? Or do you mean things like this?

7 hours
Anonymous 1123 — Wednesday, 28th Oct 2020 07:17

@marmot, re: your answer, Can the red ring runs along doughnut?

11 hours
user 3.14159 replying to JeT — Tuesday, 27th Oct 2020 20:45

I do but I prefer not to post any details about my identity. The TeX community has a number of IMHO interesting characters. I prefer to stay out of this business and just to learn from others and share some small snippets here and there.

an hour
JeT — Tuesday, 27th Oct 2020 19:55

@marmot, re: your answer, Just by curiosity. Do you have presentations of what you teach ? I feel like with your visuals I could have had 3 phds 😃

27 minutes
samcarter — Tuesday, 27th Oct 2020 19:29

@marmot, re: your answer, Very nice doughnut!

3 months
samcarter — Monday, 20th Jul 2020 15:22
samcarter — Monday, 20th Jul 2020 15:22

I see, thanks for the clarification! The perspective problem can easily be solved by eating the front part 😃

12 minutes
user 3.14159 replying to samcarter — Monday, 20th Jul 2020 15:10

Maybe \draw[brown,line width=13pt] (5.53,5.17) ellipse[x radius=0.55, y radius=0.31];. (This makes the inner contour a bit more realistic, but I realize that your torus is in perspective, i.e. the stretch in the foreground is thicker, so you will lose this feature. So I am not sure if it is an improvement.)

samcarter replying to user 3.14159 — Monday, 20th Jul 2020 15:00

Thanks for the suggestion! Could you please elaborate a bit further on the idea? I was considering just a single very wide line but was too lazy to add the code necessary to nicely scale the width …

user 3.14159 — Monday, 20th Jul 2020 14:53

If you draw the <s>torus</s> doughnut with a double line instead of even odd rule, it will look a bit more realistic.

39 minutes
samcarter — Monday, 20th Jul 2020 14:14

In lack of a better idea, I called the wiggly line decoration “garnish”. Please feel free to suggest something more suitable. (My experise is more in eating doughnuts than naming their components …)

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.