8000 new method to convert values to a 3D NumPy array · krishanrana/spatialmath-python@9b7ef66 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9b7ef66

Browse files
committed
new method to convert values to a 3D NumPy array
1 parent 54061e2 commit 9b7ef66

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

spatialmath/baseposematrix.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,19 @@ def simplify(self):
560560
vf = np.vectorize(sym.simplify)
561561
return self.__class__([vf(x) for x in self.data], check=False)
562562

563+
def stack(self):
564+
"""
565+
Convert to 3-dimensional matrix
566+
567+
:return: 3-dimensional NumPy array
568+
:rtype: ndarray(n,n,m)
569+
570+
Converts the value to a 3-dimensional NumPy array where the values are
571+
stacked along the third axis. The first two dimensions are given by
572+
``self.shape``.
573+
"""
574+
return np.dstack(self.data)
575+
563576
# ----------------------- i/o stuff
564577

565578
def printline(self, *args, **kwargs):

0 commit comments

Comments
 (0)
0