I am looking for code or pseudo-code for the generation of genus $k$ tori triangle meshes. I want to get something like in the image here. Book/paper references, code, github links, etc. are all welcome.
1 Answer
I can't leave a comment, because I don't have enough reputation points.
Do you know how to represent your objects using an implicit function like f(x, y, z)? If so, then you can use Marching Cubes or Dual Contouring, or some similar algorithm to convert that field into a triangle mesh.
As you can see in the source, the tori are multiplied together, and a non-zero isovalue is used.
The final code is at: https://github.com/sjhalayka/k-genus_torus
-
1$\begingroup$ I assume you meant implicit function, e.g. $f(x,y,z) = 0$, and not parametric function, e.g. $(x(u,v), y(u,v), z(u,v))$. But yes, I could theoretically use an implicit function where I smooth merge two tori sdfs. $\endgroup$ Commented Nov 4, 2023 at 17:42
-
$\begingroup$ My bad, I appreciate the correction. I changed the answer. $\endgroup$ Commented Nov 4, 2023 at 19:11
-
1$\begingroup$ @lightxbulb I altered the answer. $\endgroup$ Commented Nov 12, 2023 at 0:13