I have this code for a torus in tikz:

\draw (0,0) ellipse (1.6 and .9);
\path[rounded corners=24pt] (-.9,0)--(0,.6)--(.9,0) (-.9,0)--(0,-.56)--(.9,0);
\draw[rounded corners=28pt] (-1.1,.1)--(0,-.6)--(1.1,.1);
\draw[rounded corners=24pt] (-.9,0)--(0,.6)--(.9,0);

I would like a simple way to triangulate this picture to illustrate how we triangulate topological spaces. Thanks in advance for any help.

  • I guess it won't be easy in TikZ but if you are willing to use asymptote please have a look here. (I understand that this is not a trianglulation, but this may be a starting point.) – marmot Apr 24 '18 at 4:19
  • This is an algorithmic problem which does not really have anything to do with TeX. If, however, you implement triangular tessellation in TeX, be sure to make it into a package and upload it to CTAN. That said, here is a related post on Stack Overflow stackoverflow.com/questions/1999397 – Henri Menke Apr 24 '18 at 10:52
  • And note that this question has already been asked here. Yet, in contrast to the situation there, you do show an MWE, so I am not closing yours as a duplicate. – marmot Apr 24 '18 at 17:13
  • @marmot I am actually looking to generate something like the image in your link, but no one has answered that question. Also, what is an MWE? – rosterherik Apr 25 '18 at 1:42
  • @rosterherik MWE stands for minimal working example. Most questions (should) have one since this is the starting point of an answer. – marmot Apr 25 '18 at 4:06

Here is an admittedly poor attempt with pgfplots.


       view={30}{60},axis lines=none,
       domain=0:2*pi,y domain=0:2*pi,
       z buffer=sort]


enter image description here

It does show the triangles, but not paint the surfaces.

  • 1
    Thank you for the effort! The first one is actually very close to what I'm looking for. Is it possible to use less triangles? My goal is to give an example of what a triangulation looks like to an audience who is unfamiliar with topology, and I think that if there are a lot of triangles the picture becomes loud and harder to interpret without spending a while looking at it. – rosterherik Apr 25 '18 at 1:38
  • @rosterherik Sure. How many? The number of triangles is controlled by samples. Interestingly, if you set samples to 10, you get 9 times 9 faces. That's why \pgfplotsinvokeforeach{0,...,8}{ runs over 9 (and not 10) numbers. (I better do not tell you how long it took me to figure that out. ;-) – marmot Apr 25 '18 at 3:11
  • I think this was helpful enough that I can play around on my own to get the look that I want. Thank you for the help! – rosterherik Apr 25 '18 at 3:45

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.