Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
soypat committed May 15, 2022
1 parent eb15444 commit 6b6be39
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion render/form3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 5 additions & 6 deletions render/kdrender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 6b6be39

Please sign in to comment.