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 2f45ce9

Browse filesBrowse files
committed
by default use a compact printing format
1 parent 636ec35 commit 2f45ce9
Copy full SHA for 2f45ce9

File tree

Expand file treeCollapse file tree

1 file changed

+11
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+11
-1
lines changed

‎spatialmath/base/transforms2d.py

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