8000 make sympy friendly · krenshaw2018/spatialmath-python@f05de6f · GitHub
[go: up one dir, main page]

Skip to content

Commit f05de6f

Browse files
committed
make sympy friendly
1 parent 21b79e1 commit f05de6f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

spatialmath/base/transforms2d.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def trot2(theta, unit='rad', t=None):
8484
T = np.pad(rot2(theta, unit), (0, 1), mode='constant')
8585
if t is not None:
8686
T[:2, 2] = base.getvector(t, 2, 'array')
87-
T[2, 2] = 1.0
87+
T[2, 2] = 1 # integer to be symbolic friendly
8888
return T
8989

9090
def xyt2tr(xyt, unit='rad'):
@@ -193,9 +193,10 @@ def transl2(x, y=None):
193193
function.
194194
"""
195195

196-
if np.isscalar(x):
197-
T = np.identity(3)
198-
T[:2, 2] = [x, y]
196+
if base.isscalar(x):
197+
t = np.r_[x, y]
198+
T = np.identity(3, dtype=t.dtype)
199+
T[:2, 2] = t
199200
return T
200201
elif base.isvector(x, 2):
201202
T = np.identity(3)
@@ -204,7 +205,7 @@ def transl2(x, y=None):
204205
elif base.ismatrix(x, (3, 3)):
205206
return x[:2, 2]
206207
else:
207-
ValueError('bad argument')
208+
raise ValueError('bad argument')
208209

209210

210211
def ishom2(T, check=False):

0 commit comments

Comments
 (0)
0