Skip to content

Commit 21f9b56

Browse files
committed
[Issue-126] fix several issues with animate
1 parent 6074eb7 commit 21f9b56

File tree

3 files changed

+9
-17
lines changed

3 files changed

+9
-17
lines changed

spatialmath/base/animate.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ def __init__(self, anim: Animate, h, xs, ys, zs):
309309
self.anim = anim
310310

311311
def draw(self, T):
312-
p = T.A @ self.p
312+
p = T @ self.p
313313
self.h.set_data(p[0, :], p[1, :])
314314
self.h.set_3d_properties(p[2, :])
315315

@@ -367,7 +367,7 @@ def __init__(self, anim, h):
367367

368368
def draw(self, T):
369369
# import ipdb; ipdb.set_trace()
370-
p = T.A @ self.p
370+
p = T @ self.p
371371

372372
# reshape it
373373
p = p[0:3, :].T.reshape(3, 2, 3)
@@ -421,7 +421,7 @@ def __init__(self, anim, h, x, y, z):
421421
self.anim = anim
422422

423423
def draw(self, T):
424-
p = T.A @ self.p
424+
p = T @ self.p
425425
# x2, y2, _ = proj3d.proj_transform(
426426
# p[0], p[1], p[2], self.anim.ax.get_proj())
427427
# self.h.set_position((x2, y2))
@@ -546,8 +546,6 @@ def __init__(
546546
axes.set_xlim(dims[0:2])
547547
axes.set_ylim(dims[2:4])
548548
# ax.set_aspect('equal')
549-
else:
550-
axes.autoscale(enable=True, axis="both")
551549

552550
self.ax = axes
553551

spatialmath/base/transforms2d.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1510,12 +1510,9 @@ def tranimate2(T: Union[SO2Array, SE2Array], **kwargs):
15101510
tranimate2(transl(1,2)@trot2(1), frame='A', arrow=False, dims=[0, 5])
15111511
tranimate2(transl(1,2)@trot2(1), frame='A', arrow=False, dims=[0, 5], movie='spin.mp4')
15121512
"""
1513-
anim = smb.animate.Animate2(**kwargs)
1514-
try:
1515-
del kwargs["dims"]
1516-
except KeyError:
1517-
pass
1518-
1513+
dims = kwargs.pop("dims", None)
1514+
ax = kwargs.pop("ax", None)
1515+
anim = smb.animate.Animate2(dims=dims, axes=ax, **kwargs)
15191516
anim.trplot2(T, **kwargs)
15201517
return anim.run(**kwargs)
15211518

spatialmath/base/transforms3d.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3409,12 +3409,9 @@ def tranimate(T: Union[SO3Array, SE3Array], **kwargs) -> str:
34093409
34103410
:seealso: `trplot`, `plotvol3`
34113411
"""
3412-
anim = Animate(**kwargs)
3413-
try:
3414-
del kwargs["dims"]
3415-
except KeyError:
3416-
pass
3417-
3412+
dim = kwargs.pop("dims", None)
3413+
ax = kwargs.pop("ax", None)
3414+
anim = Animate(dim=dim, ax=ax, **kwargs)
34183415
anim.trplot(T, **kwargs)
34193416
return anim.run(**kwargs)
34203417

0 commit comments

Comments
 (0)