Skip to content

Commit 27aa183

Browse files
committed
allow syntax X.Rand(N) rather than X.Rand(N=N)
1 parent 08186ee commit 27aa183

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎spatialmath/pose2d.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def shape(self):
101101
return (2, 2)
102102

103103
@classmethod
104-
def Rand(cls, *, arange=(0, 2 * math.pi), unit='rad', N=1):
104+
def Rand(cls, N=1, arange=(0, 2 * math.pi), unit='rad'):
105105
r"""
106106
Construct new SO(2) with random rotation
107107
@@ -328,7 +328,7 @@ def shape(self):
328328
return (3, 3)
329329

330330
@classmethod
331-
def Rand(cls, *, xrange=(-1, 1), yrange=(-1, 1), arange=(0, 2 * math.pi), unit='rad', N=1): # pylint: disable=arguments-differ
331+
def Rand(cls, N=1, xrange=(-1, 1), yrange=(-1, 1), arange=(0, 2 * math.pi), unit='rad'): # pylint: disable=arguments-differ
332332
r"""
333333
Construct a new random SE(2)
334334

‎spatialmath/pose3d.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ def Rz(cls, theta, unit='rad', t=None):
990990
return cls([base.trotz(x, t=t, unit=unit) for x in base.getvector(theta)], check=False)
991991

992992
@classmethod
993-
def Rand(cls, *, xrange=(-1, 1), yrange=(-1, 1), zrange=(-1, 1), N=1): # pylint: disable=arguments-differ
993+
def Rand(cls, N=1, xrange=(-1, 1), yrange=(-1, 1), zrange=(-1, 1)): # pylint: disable=arguments-differ
994994
"""
995995
Create a random SE(3)
996996
@@ -1008,12 +1008,12 @@ def Rand(cls, *, xrange=(-1, 1), yrange=(-1, 1), zrange=(-1, 1), N=1): # pylint
10081008
Return an SE3 instance with random rotation and translation.
10091009
10101010
- ``SE3.Rand()`` is a random SE(3) translation.
1011-
- ``SE3.Rand(N=N)`` is an SE3 object containing a sequence of N random
1011+
- ``SE3.Rand(N)`` is an SE3 object containing a sequence of N random
10121012
poses.
10131013
10141014
Example::
10151015
1016-
>>> SE3.Rand(N=2)
1016+
>>> SE3.Rand(2)
10171017
SE3([
10181018
array([[ 0.58076657, 0.64578702, -0.49565041, -0.78585825],
10191019
[-0.57373134, -0.10724881, -0.8119914 , 0.72069253],

0 commit comments

Comments
 (0)