Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f05de6f

Browse filesBrowse files
committed
make sympy friendly
1 parent 21b79e1 commit f05de6f
Copy full SHA for f05de6f

File tree

Expand file treeCollapse file tree

1 file changed

+6
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-5
lines changed

‎spatialmath/base/transforms2d.py

Copy file name to clipboardExpand all lines: spatialmath/base/transforms2d.py
+6-5Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.