|
13 | 13 | import numpy as np |
14 | 14 | import matplotlib.pyplot as plt |
15 | 15 | from matplotlib import animation |
16 | | -from spatialmath import base |
| 16 | +import spatialmath.base as smb |
17 | 17 | from collections.abc import Iterable, Iterator |
18 | 18 | from spatialmath.base.types import * |
19 | 19 |
|
@@ -140,21 +140,21 @@ def trplot( |
140 | 140 | self.trajectory = end |
141 | 141 |
|
142 | 142 | # stash the final value |
143 | | - if base.isrot(end): |
144 | | - self.end = base.r2t(end) |
| 143 | + if smb.isrot(end): |
| 144 | + self.end = smb.r2t(end) |
145 | 145 | else: |
146 | 146 | self.end = end |
147 | 147 |
|
148 | 148 | if start is None: |
149 | 149 | self.start = np.identity(4) |
150 | 150 | else: |
151 | | - if base.isrot(start): |
152 | | - self.start = base.r2t(start) |
| 151 | + if smb.isrot(start): |
| 152 | + self.start = smb.r2t(start) |
153 | 153 | else: |
154 | 154 | self.start = start |
155 | 155 |
|
156 | 156 | # draw axes at the origin |
157 | | - base.trplot(self.start, ax=self, **kwargs) |
| 157 | + smb.trplot(self.start, ax=self, **kwargs) |
158 | 158 |
|
159 | 159 | def set_proj_type(self, proj_type: str): |
160 | 160 | self.ax.set_proj_type(proj_type) |
@@ -205,14 +205,14 @@ def update(frame, animation): |
205 | 205 |
|
206 | 206 | if isinstance(frame, float): |
207 | 207 | # passed a single transform, interpolate it |
208 | | - T = base.trinterp(start=self.start, end=self.end, s=frame) |
| 208 | + T = smb.trinterp(start=self.start, end=self.end, s=frame) |
209 | 209 | else: |
210 | 210 | # assume it is an SO(3) or SE(3) |
211 | 211 | T = frame |
212 | 212 |
|
213 | 213 | # ensure result is SE(3) |
214 | 214 | if T.shape == (3, 3): |
215 | | - T = base.r2t(T) |
| 215 | + T = smb.r2t(T) |
216 | 216 |
|
217 | 217 | # update the scene |
218 | 218 | animation._draw(T) |
@@ -580,21 +580,21 @@ def trplot2( |
580 | 580 | self.trajectory = end |
581 | 581 |
|
582 | 582 | # stash the final value |
583 | | - if base.isrot2(end): |
584 | | - self.end = base.r2t(end) |
| 583 | + if smb.isrot2(end): |
| 584 | + self.end = smb.r2t(end) |
585 | 585 | else: |
586 | 586 | self.end = end |
587 | 587 |
|
588 | 588 | if start is None: |
589 | 589 | self.start = np.identity(3) |
590 | 590 | else: |
591 | | - if base.isrot2(start): |
592 | | - self.start = base.r2t(start) |
| 591 | + if smb.isrot2(start): |
| 592 | + self.start = smb.r2t(start) |
593 | 593 | else: |
594 | 594 | self.start = start |
595 | 595 |
|
596 | 596 | # draw axes at the origin |
597 | | - base.trplot2(self.start, ax=self, block=False, **kwargs) |
| 597 | + smb.trplot2(self.start, ax=self, block=False, **kwargs) |
598 | 598 |
|
599 | 599 | def run( |
600 | 600 | self, movie=None, axes=None, repeat=False, interval=50, nframes=100, **kwargs |
@@ -757,7 +757,7 @@ def __init__(self, anim, h, x, y, u, v): |
757 | 757 | self.p = np.c_[u - x, v - y].T |
758 | 758 |
|
759 | 759 | def draw(self, T): |
760 | | - R, t = base.tr2rt(T) |
| 760 | + R, t = smb.tr2rt(T) |
761 | 761 | p = R @ self.p |
762 | 762 | # specific to a single Quiver |
763 | 763 | self.h.set_offsets(t) # shift the origin |
|
0 commit comments