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 90b6166

Browse filesBrowse files
committed
change geom3d class names
Plucker -> Line3, Plane -> Plane3
1 parent 032bb60 commit 90b6166
Copy full SHA for 90b6166

File tree

Expand file treeCollapse file tree

10 files changed

+115
-97
lines changed
Filter options
Expand file treeCollapse file tree

10 files changed

+115
-97
lines changed

‎docs/figs/classes.dot

Copy file name to clipboardExpand all lines: docs/figs/classes.dot
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ digraph G {
1313
Twist3 -> BaseTwist
1414
Quaternion -> BasePoseList
1515
UnitQuaternion -> Quaternion
16+
Line3 -> BasePoseList
1617
SpatialVector -> BasePoseList
1718
SpatialM6 -> SpatialVector
1819
SpatialF6 -> SpatialVector

‎docs/figs/classes.pdf

Copy file name to clipboard
657 Bytes
Binary file not shown.

‎docs/figs/classes.png

Copy file name to clipboard
966 Bytes
Loading

‎docs/source/3d_plucker.rst renamed to ‎docs/source/3d_line.rst

Copy file name to clipboardExpand all lines: docs/source/3d_line.rst
+5-3Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
Plucker line
2-
^^^^^^^^^^^^
1+
3D line
2+
^^^^^^^
33

4-
.. automodule:: spatialmath.geom3d.Plucker
4+
A 3D line using Plücker coordinates.
5+
6+
.. autoclass:: spatialmath.geom3d.Line3
57
:members:
68
:undoc-members:
79
:show-inheritance:

‎docs/source/3d_plane.rst

Copy file name to clipboard
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
Plane
22
^^^^^
33

4-
.. automodule:: spatialmath.geom3d.Plane
4+
.. autoclass:: spatialmath.geom3d.Plane3
55
:members:
66
:undoc-members:
77
:show-inheritance:
88
:inherited-members:
9-
:special-members: __mul__, __rmul__, __eq__, __ne__, __init__, __or__, __xor__
9+
:special-members: __mul__, __rmul__, __eq__, __ne__, __init__, __or__, __xor__
10+

‎docs/source/intro.rst

Copy file name to clipboardExpand all lines: docs/source/intro.rst
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ orientation ``SO3`` ``UnitQuaternion`` ``SO2``
5555
Additional classes include:
5656

5757
- ``Quaternion`` a general quaternion, and parent class to ``UnitQuaternion``
58-
- ``Plucker`` to represent a line in 3D space
58+
- ``Line3`` to represent a line in 3D space
5959
- ``Plane`` to represent a plane in 3D space
6060

6161
These classes abstract, and implement appropriate operations, for the following
@@ -521,7 +521,7 @@ Spatial object equivalent class NumPy ndarray.shape
521521
n/a Quaternion (4,)
522522
================= ================ ===================
523523

524-
.. note:: ``SpatialVector`` and ``Plucker`` objects have no equivalent in the
524+
.. note:: ``SpatialVector`` and ``Line3`` objects have no equivalent in the
525525
``base`` package.
526526

527527
Inputs to functions in this package are either floats, lists, tuples or

‎spatialmath/__init__.py

Copy file name to clipboardExpand all lines: spatialmath/__init__.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from spatialmath.pose2d import SO2, SE2
22
from spatialmath.pose3d import SO3, SE3
33
from spatialmath.baseposematrix import BasePoseMatrix
4-
from spatialmath.geom3d import Plucker, Plane
4+
from spatialmath.geom3d import Line3, Plane3
55
from spatialmath.twist import Twist3, Twist2
66
from spatialmath.spatialvector import SpatialVelocity, SpatialAcceleration, \
77
SpatialForce, SpatialMomentum, SpatialInertia

‎spatialmath/geom3d.py

Copy file name to clipboardExpand all lines: spatialmath/geom3d.py
+32-18Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
# ======================================================================== #
1616

17-
class Plane:
17+
class Plane3:
1818
r"""
1919
Create a plane object from linear coefficients
2020
@@ -126,7 +126,8 @@ def __str__(self):
126126

127127
# ======================================================================== #
128128

129-
class Plucker(BasePoseList):
129+
130+
class Line3(BasePoseList):
130131
"""
131132
Plucker coordinate class
132133
@@ -274,7 +275,7 @@ def TwoPoints(P=None, Q=None):
274275
# compute direction and moment
275276
w = P - Q
276277
v = np.cross(w, P)
277-
return Plucker(np.r_[v, w])
278+
return cls(np.r_[v, w])
278279

279280
@staticmethod
280281
def TwoPlanes(pi1, pi2):
@@ -297,17 +298,19 @@ def TwoPlanes(pi1, pi2):
297298
:seealso: Plucker, Plucker.PQ, Plucker.PointDir
298299
"""
299300

300-
if not isinstance(pi1, Plane):
301-
pi1 = Plane(base.getvector(pi1, 4))
302-
if not isinstance(pi2, Plane):
303-
pi2 = Plane(base.getvector(pi2, 4))
301+
# TODO inefficient to create 2 temporary planes
302+
303+
if not isinstance(pi1, Plane3):
304+
pi1 = Plane3(base.getvector(pi1, 4))
305+
if not isinstance(pi2, Plane3):
306+
pi2 = Plane3(base.getvector(pi2, 4))
304307

305308
w = np.cross(pi1.n, pi2.n)
306309
v = pi2.d * pi1.n - pi1.d * pi2.n
307-
return Plucker(np.r_[v, w])
310+
return cls(np.r_[v, w])
308311

309-
@staticmethod
310-
def PointDir(point, dir):
312+
@classmethod
313+
def PointDir(cls, point, dir):
311314
"""
312315
Create Plucker line from point and direction
313316
@@ -327,7 +330,7 @@ def PointDir(point, dir):
327330
p = base.getvector(point, 3)
328331
w = base.getvector(dir, 3)
329332
v = np.cross(w, p)
330-
return Plucker(np.r_[v, w])
333+
return cls(np.r_[v, w])
331334

332335
def append(self, x):
333336
"""
@@ -775,7 +778,7 @@ def commonperp(self, l2): # pylint: disable=no-self-argument
775778
v = np.cross(l1.v, l2.w) - np.cross(l2.v, l1.w) + \
776779
(l1 * l2) * np.dot(l1.w, l2.w) * base.unitvec(np.cross(l1.w, l2.w))
777780

778-
return Plucker(v, w)
781+
return self.__class__(v, w)
779782

780783

781784
def __mul__(self, right): # pylint: disable=no-self-argument
@@ -826,7 +829,7 @@ def __rmul__(self, left): # pylint: disable=no-self-argument
826829
A = np.r_[ np.c_[left.R, base.skew(-left.t) @ left.R],
827830
np.c_[np.zeros((3,3)), left.R]
828831
]
829-
return Plucker( A @ right.vec) # premultiply by SE3
832+
return self.__class__( A @ right.vec) # premultiply by SE3
830833
else:
831834
raise ValueError('bad arguments')
832835

@@ -871,8 +874,8 @@ def intersect_plane(self, plane): # pylint: disable=no-self-argument
871874
# Note that this is in homogeneous coordinates.
872875
# intersection of plane (n,p) with the line (v,p)
873876
# returns point and line parameter
874-
if not isinstance(plane, Plane):
875-
plane = Plane(base.getvector(plane, 4))
877+
if not isinstance(plane, Plane3):
878+
plane = Plane3(base.getvector(plane, 4))
876879

877880
den = np.dot(self.w, plane.n)
878881

@@ -937,7 +940,7 @@ def intersect_volume(self, bounds):
937940
I = np.eye(3,3)
938941
p = [0, 0, 0]
939942
p[i] = bounds[face]
940-
plane = Plane.PN(n=I[:,i], p=p)
943+
plane = Plane3.PN(n=I[:,i], p=p)
941944

942945
# find where line pierces the plane
943946
try:
@@ -1121,13 +1124,24 @@ def _repr_pretty_(self, p, cycle):
11211124

11221125
# Static factory methods for constructors from exotic representations
11231126

1127+
class Plucker(Line3):
11241128

1129+
def __init__(self, v=None, w=None):
1130+
import warnings
1131+
1132+
warnings.warn('use Line class instead', DeprecationWarning)
1133+
super().__init__(v, w)
11251134

11261135
if __name__ == '__main__': # pragma: no cover
11271136

11281137
import pathlib
11291138
import os.path
1139+
1140+
a = Plane3([0.1, -1, -1, 2])
1141+
base.plotvol3(5)
1142+
a.plot(color='r', alpha=0.3)
1143+
plt.show(block=True)
11301144

1131-
a = SE3.Exp([2,0,0,0,0,0])
1145+
# a = SE3.Exp([2,0,0,0,0,0])
11321146

1133-
exec(open(pathlib.Path(__file__).parent.parent.absolute() / "tests" / "test_geom3d.py").read()) # pylint: disable=exec-used
1147+
# exec(open(pathlib.Path(__file__).parent.parent.absolute() / "tests" / "test_geom3d.py").read()) # pylint: disable=exec-used

‎spatialmath/twist.py

Copy file name to clipboardExpand all lines: spatialmath/twist.py
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from spatialmath.pose3d import SO3, SE3
88
from spatialmath.pose2d import SE2
9-
from spatialmath.geom3d import Plucker
9+
from spatialmath.geom3d import Line3
1010
import spatialmath.base as base
1111
from spatialmath.baseposelist import BasePoseList
1212

@@ -888,7 +888,7 @@ def line(self):
888888
Line of action of 3D twist as a Plucker line
889889
890890
:return: the 3D line of action
891-
:rtype: Plucker instance
891+
:rtype: Line instance
892892
893893
``X.line()`` is a Plucker object representing the line of the twist axis.
894894
@@ -901,7 +901,7 @@ def line(self):
901901
>>> S = Twist3(T)
902902
>>> S.line()
903903
"""
904-
return Plucker([Plucker(-tw.v - tw.pitch() * tw.w, tw.w) for tw in self])
904+
return Line3([Line3(-tw.v - tw.pitch() * tw.w, tw.w) for tw in self])
905905

906906
def pole(self):
907907
"""

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.