diff --git a/generate/template/astronomy.go b/generate/template/astronomy.go index 244dc0a8..c2788e2b 100644 --- a/generate/template/astronomy.go +++ b/generate/template/astronomy.go @@ -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 ( diff --git a/source/golang/astronomy.go b/source/golang/astronomy.go index 4e5a2a6a..ffff74dc 100644 --- a/source/golang/astronomy.go +++ b/source/golang/astronomy.go @@ -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 (