Importing STL files shows all sorts of artifacts
bug
Importing the HeartGears2-3.stl file from here:
https://www.thingiverse.com/thing:243278/files
using this code, has lots of artifacts, and holes in the outputed stl file.
```go
package main
import (
"github.com/hschendel/stl"
"github.com/soypat/sdf/helpers/sdfexp"
"github.com/soypat/sdf/render"
)
func main() {
solid, err := stl.ReadFile("HeartGears2-3.stl")
if err != nil {
panic(err)
}
tris := make([]render.Triangle3, len(solid.Triangles))
for i, t := range solid.Triangles {
for k := 0; k < 3; k++ {
tris[i][k].X = float64(t.Vertices[k][0])
tris[i][k].Y = float64(t.Vertices[k][1])
tris[i][k].Z = float64(t.Vertices[k][2])
}
}
object, err := sdfexp.ImportModel(tris, 0)
if err != nil {
panic(err)
}
err = render.CreateSTL("out.stl", render.NewOctreeRenderer(object, 500))
if err != nil {
panic(err)
}
}
```
关闭于 2024-08-12 8 条评论