generated from soypat/go-module-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bump ms2 package version to use corrected polygon smooth calculation
- Loading branch information
Showing
6 changed files
with
54 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package threads | ||
|
||
import ( | ||
"math" | ||
"testing" | ||
|
||
"github.com/soypat/glgl/math/ms2" | ||
"github.com/soypat/gsdf/gleval" | ||
) | ||
|
||
func TestScrew(t *testing.T) { | ||
iso := ISO{ // Negative normal. | ||
D: 1, | ||
P: 0.1, | ||
Ext: true, | ||
} | ||
shape, err := iso.Thread() | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
sdf, err := gleval.AssertSDF2(shape) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
eval := func(x, y float32) float32 { | ||
var dist [1]float32 | ||
err = sdf.Evaluate([]ms2.Vec{{X: x, Y: y}}, dist[:], &gleval.VecPool{}) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
return dist[0] | ||
} | ||
outside := eval(iso.P/2, iso.D/2) | ||
if outside < 0 || math.IsNaN(float64(outside)) { | ||
t.Error("expected out of SDF", outside) | ||
} | ||
inside := eval(iso.P/2, iso.D/3) | ||
if inside > 0 || math.IsNaN(float64(inside)) { | ||
t.Error("expected inside of SDF", inside) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,12 @@ | ||
github.com/chewxy/math32 v1.11.0 h1:8sek2JWqeaKkVnHa7bPVqCEOUPbARo4SGxs6toKyAOo= | ||
github.com/chewxy/math32 v1.11.0/go.mod h1:dOB2rcuFrCn6UHrze36WSLVPKtzPMRAQvBvUwkSsLqs= | ||
github.com/chewxy/math32 v1.11.1 h1:b7PGHlp8KjylDoU8RrcEsRuGZhJuz8haxnKfuMMRqy8= | ||
github.com/chewxy/math32 v1.11.1/go.mod h1:dOB2rcuFrCn6UHrze36WSLVPKtzPMRAQvBvUwkSsLqs= | ||
github.com/go-gl/gl v0.0.0-20231021071112-07e5d0ea2e71 h1:5BVwOaUSBTlVZowGO6VZGw2H/zl9nrd3eCZfYV+NfQA= | ||
github.com/go-gl/gl v0.0.0-20231021071112-07e5d0ea2e71/go.mod h1:9YTyiznxEY1fVinfM7RvRcjRHbw2xLBJ3AAGIT0I4Nw= | ||
github.com/go-gl/glfw v0.0.0-20221017161538-93cebf72946b h1:2hdUMUOJuLQkhaPAwoyOeSzoaBydYEkXkBEuqDuDBfg= | ||
github.com/go-gl/glfw v0.0.0-20221017161538-93cebf72946b/go.mod h1:wyvWpaEu9B/VQiV1jsPs7Mha9I7yto/HqIBw197ZAzk= | ||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20221017161538-93cebf72946b h1:GgabKamyOYguHqHjSkDACcgoPIz3w0Dis/zJ1wyHHHU= | ||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20221017161538-93cebf72946b/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= | ||
github.com/soypat/glgl v0.0.0-20240825114214-5f981c176edb h1:pcHDn+P2dG5wf0f65OVwbUl0b0auu+RsKNjWsGO2KhI= | ||
github.com/soypat/glgl v0.0.0-20240825114214-5f981c176edb/go.mod h1:ltzeLFgrGFBm2SBy10lH5IonqEdg9IkL30yam6QHMRs= | ||
github.com/soypat/glgl v0.0.0-20240825222736-8a9aeb4f4a8f h1:TzJXvi/Y8E96YM8ZzTk8gtD5J6EJOOras1q617qoAAQ= | ||
github.com/soypat/glgl v0.0.0-20240825222736-8a9aeb4f4a8f/go.mod h1:ltzeLFgrGFBm2SBy10lH5IonqEdg9IkL30yam6QHMRs= | ||
github.com/soypat/glgl v0.0.0-20240831170050-86f4279df7c9 h1:uEm1bHTWa8mY77k/VVaUcCyKn/ZtpLXMN5Xg4eCrsMw= | ||
github.com/soypat/glgl v0.0.0-20240831170050-86f4279df7c9/go.mod h1:ltzeLFgrGFBm2SBy10lH5IonqEdg9IkL30yam6QHMRs= | ||
github.com/soypat/glgl v0.0.0-20240919181848-3ab2abb89c6d h1:ZGFeC6bqQoyQXdYCFitm+4y1FuS1JY6zh5zzBG0OoDQ= | ||
github.com/soypat/glgl v0.0.0-20240919181848-3ab2abb89c6d/go.mod h1:1LcEp6XHSMCI91WlJHzl/aW4Bp5v6yQOiYFyjrlk350= | ||
golang.org/x/exp v0.0.0-20221230185412-738e83a70c30 h1:m9O6OTJ627iFnN2JIWfdqlZCzneRO6EEBsHXI25P8ws= | ||
golang.org/x/exp v0.0.0-20221230185412-738e83a70c30/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters