diff --git a/README.md b/README.md index 4b8d946..fcecebe 100644 --- a/README.md +++ b/README.md @@ -8,10 +8,6 @@ A rewrite of the original CAD package [`sdfx`](https://github.com/deadsy/sdfx) for generating 2D and 3D geometry using [Go](https://go.dev/). - * Objects are modelled with 2d and 3d signed distance functions (SDFs). - * Objects are defined with Go code. - * Objects are rendered to an STL file to be viewed and/or 3d printed. - ## Highlights * 3d and 2d objects modelled with signed distance functions (SDFs). * Minimal and idiomatic API. diff --git a/render/form3_test.go b/render/form3_test.go index b91d39b..d668622 100644 --- a/render/form3_test.go +++ b/render/form3_test.go @@ -110,7 +110,7 @@ func cylinderToSTL(t testing.TB, filename string) { } func boxToSTL(t testing.TB, filename string) { - object := form3.Box(r3.Vec{1, 2, 1}, .3) + object := form3.Box(r3.Vec{X: 1, Y: 2, Z: 1}, .3) err := render.CreateSTL(filename, render.NewOctreeRenderer(object, quality)) if err != nil { t.Fatal(err) diff --git a/render/kdrender_test.go b/render/kdrender_test.go index bc96601..e79f924 100644 --- a/render/kdrender_test.go +++ b/render/kdrender_test.go @@ -34,10 +34,10 @@ func TestKDSDF(t *testing.T) { kdf := NewKDSDF(model) t.Log(kdf.Bounds()) start := time.Now() - outside := kdf.Evaluate(r3.Vec{2, 0, 0}) // evaluate point outside bounds - inside := kdf.Evaluate(r3.Vec{0, 0, 0}) // evaluate point inside bounds + outside := kdf.Evaluate(r3.Vec{X: 2, Y: 0, Z: 0}) // evaluate point outside bounds + inside := kdf.Evaluate(r3.Vec{X: 0, Y: 0, Z: 0}) // evaluate point inside bounds - surface := kdf.Evaluate(r3.Vec{1, 0, 0}) // evaluate point on surface + surface := kdf.Evaluate(r3.Vec{X: 1, Y: 0, Z: 0}) // evaluate point on surface t.Logf("outside:%.2g, inside:%.2g, surface:%.2g in %s", outside, inside, surface, time.Since(start)) // render.CreateSTL("kd_after.stl", render.NewOctreeRenderer(sdf, quality/6)) @@ -133,7 +133,6 @@ func (k kdTriangles) Len() int { return len(k) } func (k kdTriangles) Pivot(d kdtree.Dim) int { p := kdPlane{dim: int(d), triangles: k} return kdtree.Partition(p, kdtree.MedianOfMedians(p)) - return 0 } // Slice returns a slice of the list using zero-based half @@ -143,8 +142,8 @@ func (k kdTriangles) Slice(start, end int) kdtree.Interface { } func (k kdTriangles) Bounds() *kdtree.Bounding { - max := r3.Vec{-math.MaxFloat64, -math.MaxFloat64, -math.MaxFloat64} - min := r3.Vec{math.MaxFloat64, math.MaxFloat64, math.MaxFloat64} + max := r3.Vec{X: -math.MaxFloat64, Y: -math.MaxFloat64, Z: -math.MaxFloat64} + min := r3.Vec{X: math.MaxFloat64, Y: math.MaxFloat64, Z: math.MaxFloat64} for _, tri := range k { tbounds := tri.Bounds() tmin := tbounds.Min.(kdTriangle)