Now, I have a question. How to create Gyroid in any shape? For example, assume I have a surface mesh represented by an STL file. Assume the shape of the surface mesh is a teapot:
I can import and covert the surface mesh into SDF by:
inputPth := "input.stl"
// read the stl file.
file, err := os.OpenFile(inputPth, os.O_RDONLY, 0400)
// create the SDF from the mesh
imported, err := obj.ImportSTL(file, 20, 3, 5)
// TODO: How to create a gyroid with the imported shape?
I cannot figure out how to create a gyroid that has the imported shape. I mean, the final gyroid must have the shape of the teapot. How can I do that?
A gyroid is defined over all of 3d space, and in the example we turn it into a finite object by intersecting with a cube.
Likewise you can intersect the teapot with the gyroid and get a teapot shaped gyroid region.
Gyroid cube
There is an example code to create Gyroid cubes:
https://github.com/deadsy/sdfx/blob/c456ed660b0c0c654daf98d618fa455aec51724a/examples/gyroid/main.go#L79
I tried the example but with smaller marching cube input of
50
:The result is a gyroid with the shape of a cube;
Gyroid in any shape?
Now, I have a question. How to create Gyroid in any shape? For example, assume I have a surface mesh represented by an STL file. Assume the shape of the surface mesh is a teapot:
I can import and covert the surface mesh into SDF by:
I cannot figure out how to create a gyroid that has the imported shape. I mean, the final gyroid must have the shape of the teapot. How can I do that?