Skip to content

Commit ebefce2

Browse files
committed
fixed rotate and translate unit test
1 parent 3264d0a commit ebefce2

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

tests/MeshTypes/mesh_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,18 @@ func TestRotateAndTranslate(t *testing.T) {
8585
triangle.V0.Position = translationMatrix.MulPosition(triangle.V0.Position) // safe to use as func is tested in another place
8686
triangle.V1.Position = translationMatrix.MulPosition(triangle.V1.Position)
8787
triangle.V2.Position = translationMatrix.MulPosition(triangle.V2.Position)
88+
if triangle.V0.Normal != nil {
89+
n0 := translationMatrix.MulDirection(*triangle.V0.Normal)
90+
triangle.V0.Normal = &n0
91+
}
92+
if triangle.V1.Normal != nil {
93+
n1 := translationMatrix.MulDirection(*triangle.V1.Normal)
94+
triangle.V1.Normal = &n1
95+
}
96+
if triangle.V2.Normal != nil {
97+
n2 := translationMatrix.MulDirection(*triangle.V2.Normal)
98+
triangle.V2.Normal = &n2
99+
}
88100
}
89101
if !reflect.DeepEqual(result, want) {
90102
t.Errorf("Mesh RotateAndTranslate() Output does not match expected")

0 commit comments

Comments
 (0)