8000 by default use a compact printing format · flyinger/spatialmath-python@2f45ce9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2f45ce9

Browse files
committed
by default use a compact printing format
1 parent 636ec35 commit 2f45ce9
< 10000 /div>

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

spatialmath/base/transforms2d.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,14 @@ def trprint2(T, label=None, file=sys.stdout, fmt='{:8.2g}', unit='deg'):
654654
>>> from spatialmath.base import *
655655
>>> T = transl2(1,2) @ trot2(0.3)
656656
>>> trprint2(T, file=None, label='T')
657+
>>> trprint2(T, file=None, label='T', fmt='{:8.4g}')
658+
659+
660+
.. notes::
661+
662+
- Default formatting is for compact display of data
663+
- For tabular data set ``fmt`` to a fixed width format such as
664+
``fmt='{:.3g}'``
657665
658666
:seealso: trprint
659667
"""
@@ -670,7 +678,9 @@ def trprint2(T, label=None, file=sys.stdout, fmt='{:8.2g}', unit='deg'):
670678
angle = math.atan2(T[1, 0], T[0, 0])
671679
if unit == 'deg':
672680
angle *= 180.0 / math.pi
673-
s += ' {} {}'.format(_vec2s(fmt, [angle]), unit)
681+
s += ' {}°'.format(_vec2s(fmt, [angle]))
682+
else:
683+
s += ' {} rad'.format(_vec2s(fmt, [angle]))
674684

675685
if file:
676686
print(s, file=file)

0 commit comments

Comments
 (0)
0