Go: added function IdentityMatrix.

This commit is contained in:
Don Cross
2023-10-26 10:37:13 -04:00
parent ba62eea34f
commit af53f189e8
2 changed files with 30 additions and 0 deletions

View File

@@ -507,6 +507,21 @@ type RotationMatrix struct {
Rot [3][3]float64
}
// Creates a rotation matrix that represents no rotation at all.
func IdentityMatrix() RotationMatrix {
r := RotationMatrix{}
r.Rot[0][0] = 1.0
r.Rot[0][1] = 0.0
r.Rot[0][2] = 0.0
r.Rot[1][0] = 0.0
r.Rot[1][1] = 1.0
r.Rot[1][2] = 0.0
r.Rot[2][0] = 0.0
r.Rot[2][1] = 0.0
r.Rot[2][2] = 1.0
return r
}
type Refraction int
const (

View File

@@ -507,6 +507,21 @@ type RotationMatrix struct {
Rot [3][3]float64
}
// Creates a rotation matrix that represents no rotation at all.
func IdentityMatrix() RotationMatrix {
r := RotationMatrix{}
r.Rot[0][0] = 1.0
r.Rot[0][1] = 0.0
r.Rot[0][2] = 0.0
r.Rot[1][0] = 0.0
r.Rot[1][1] = 1.0
r.Rot[1][2] = 0.0
r.Rot[2][0] = 0.0
r.Rot[2][1] = 0.0
r.Rot[2][2] = 1.0
return r
}
type Refraction int
const (