Skip to content

Commit c8dc0ad

Browse files
authored
feat(mesh): Breaking mesh rework to mesh per geometry instead of mesh per fixture
Breaking Mesh rework
2 parents 01e6018 + 77e4dfe commit c8dc0ad

12 files changed

Lines changed: 1492 additions & 322 deletions

File tree

examples/parse-gdtf.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import (
55
"log"
66
"os"
77

8-
GDTFMeshReader "github.com/Patch2PDF/GDTF-Mesh-Reader"
8+
GDTFMeshReader "github.com/Patch2PDF/GDTF-Mesh-Reader/v2"
9+
"github.com/Patch2PDF/GDTF-Mesh-Reader/v2/pkg/MeshTypes"
910
GDTFParser "github.com/Patch2PDF/GDTF-Parser"
1011
STL "github.com/Patch2PDF/GDTF-Parser/examples/stl"
1112
)
@@ -25,11 +26,15 @@ func main() {
2526
fmt.Printf("%+v\n", *gdtf)
2627

2728
// build gdtf model (by dmx mode)
28-
mesh, err := gdtf.BuildMesh("32Ch")
29+
models, err := gdtf.BuildMesh("32Ch")
2930
if err != nil {
3031
log.Fatal(err)
3132
}
3233
// write mesh as STL
34+
mesh := &MeshTypes.Mesh{}
35+
for _, entry := range models {
36+
mesh.Add(&entry.Mesh)
37+
}
3338
f, _ := os.Create("Test.stl")
3439
STL.WriteBinary(f, mesh)
3540
f.Close()

examples/stl/stl-writer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import (
44
"encoding/binary"
55
"io"
66

7-
"github.com/Patch2PDF/GDTF-Mesh-Reader/pkg/MeshTypes"
7+
"github.com/Patch2PDF/GDTF-Mesh-Reader/v2/pkg/MeshTypes"
88
)
99

1010
// helper for `WriteBinary`
11-
func computeNormal(t *MeshTypes.Triangle) MeshTypes.Vector {
11+
func computeNormal(t MeshTypes.Triangle) MeshTypes.Vector {
1212
// edge vectors
1313
a := t.V1.Position.Sub(t.V0.Position)
1414

gdtf-parser.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import (
1111
"log"
1212
"path/filepath"
1313

14-
GDTFMeshReader "github.com/Patch2PDF/GDTF-Mesh-Reader"
15-
"github.com/Patch2PDF/GDTF-Mesh-Reader/pkg/MeshTypes"
14+
GDTFMeshReader "github.com/Patch2PDF/GDTF-Mesh-Reader/v2"
15+
"github.com/Patch2PDF/GDTF-Mesh-Reader/v2/pkg/MeshTypes"
1616
XMLTypes "github.com/Patch2PDF/GDTF-Parser/internal/types/gdtfxml"
1717
Types "github.com/Patch2PDF/GDTF-Parser/pkg/types"
1818
)

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module github.com/Patch2PDF/GDTF-Parser
22

33
go 1.25.4
44

5-
require github.com/Patch2PDF/GDTF-Mesh-Reader v1.1.2
5+
require github.com/Patch2PDF/GDTF-Mesh-Reader/v2 v2.0.1
66

77
require (
88
github.com/google/go-cmp v0.7.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
github.com/Patch2PDF/GDTF-Mesh-Reader v1.1.2 h1:4LHeQjH+cwRoXuv+O4X9YoJaZAO/DihGGN5t3jVIFFk=
2-
github.com/Patch2PDF/GDTF-Mesh-Reader v1.1.2/go.mod h1:4Uipj5UA1HhD3v032aSnEFlpItN80UY5zKB15mIeVwQ=
1+
github.com/Patch2PDF/GDTF-Mesh-Reader/v2 v2.0.1 h1:xc6xxlDRv9s19um206MW6lYsZU7sXOfHgROuo7PxTZg=
2+
github.com/Patch2PDF/GDTF-Mesh-Reader/v2 v2.0.1/go.mod h1:zAcGHlYdE75hdFo624nQfQHTzw9+NfPJT8Eo2mB1lI8=
33
github.com/go-test/deep v1.0.1 h1:UQhStjbkDClarlmv0am7OXXO4/GaPdCGiUiMTvi28sg=
44
github.com/go-test/deep v1.0.1/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
55
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=

0 commit comments

Comments
 (0)