Skip to content

Commit 10ff0e2

Browse files
authored
Merge pull request #84 from mcrrobinson/master
Reusing 3x3 array
2 parents 10db1e4 + 6ce5cb8 commit 10ff0e2

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

opendis/RangeCoordinates.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ class GPS:
112112

113113
wgs84 = WGS84()
114114

115+
_IDENTITY_3X3 = identity(3)
116+
115117
def ecef2lla(self, ecef, tolerance=1e-9):
116118
"""Convert Earth-centered, Earth-fixed coordinates to lat, lon, alt.
117119
Input: ecef - (x, y, z) in (m, m, m)
@@ -516,20 +518,16 @@ def rotate_3x3(self, theta, normal_vec):
516518
the rotation.
517519
"""
518520

519-
n_v_t = normal_vec.transpose()
520-
521521
n_x = array([[ 0 , -normal_vec[2], normal_vec[1] ],
522522
[normal_vec[2] , 0 , -normal_vec[0]],
523523
[-normal_vec[1], normal_vec[0] , 0 ]
524524
]
525525
)
526526

527527

528-
I = identity(3)
529-
530528
nnt = normal_vec * self.transpose(normal_vec)
531529

532-
return (1 - cos(theta)) * nnt + cos(theta) * I + sin(theta) * n_x
530+
return (1 - cos(theta)) * nnt + cos(theta) * self._IDENTITY_3X3 + sin(theta) * n_x
533531

534532

535533
def transpose(self, arr):

0 commit comments

Comments
 (0)