Skip to content

Commit c9be136

Browse files
committed
tidyup plot, pass ax not axis for consistency
1 parent bb95d56 commit c9be136

File tree

1 file changed

+18
-24
lines changed

1 file changed

+18
-24
lines changed

spatialmath/geom3d.py

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,7 @@ def intersect_volume(self, bounds):
10621062
# PLOT AND DISPLAY
10631063
# ------------------------------------------------------------------------- #
10641064

1065-
def plot(self, *pos, bounds=None, axis=None, **kwargs):
1065+
def plot(self, *pos, bounds=None, ax=None, **kwargs):
10661066
"""
10671067
Plot a line
10681068
@@ -1087,23 +1087,17 @@ def plot(self, *pos, bounds=None, axis=None, **kwargs):
10871087
10881088
:seealso: Plucker.intersect_volume
10891089
"""
1090-
if axis is None:
1090+
if ax is None:
10911091
ax = plt.gca()
1092-
else:
1093-
ax = axis
10941092

1093+
print(ax)
10951094
if bounds is None:
10961095
bounds = np.r_[ax.get_xlim(), ax.get_ylim(), ax.get_zlim()]
10971096
else:
10981097
bounds = base.getvector(bounds, 6)
10991098
ax.set_xlim(bounds[:2])
11001099
ax.set_ylim(bounds[2:4])
11011100
ax.set_zlim(bounds[4:6])
1102-
1103-
# print(bounds)
1104-
1105-
#U = self.Q - self.P;
1106-
#line.p = self.P; line.v = unit(U);
11071101

11081102
lines = []
11091103
for line in self:
@@ -1194,21 +1188,21 @@ def _repr_pretty_(self, p, cycle):
11941188
# z = L1([1 5 2 6 3 4]) * L2([5 1 6 2 4 3])';
11951189
# end
11961190

1197-
#
1198-
# function z = intersect(self1, pl2)
1199-
# Plucker.intersect Line intersection
1200-
#
1201-
# PL1.intersect(self2) is zero if the lines intersect. It is positive if PL2
1202-
# passes counterclockwise and negative if PL2 passes clockwise. Defined as
1203-
# looking in direction of PL1
1204-
#
1205-
# ---------->
1206-
# o o
1207-
# ---------->
1208-
# counterclockwise clockwise
1209-
#
1210-
# z = dot(self1.w, pl1.v) + dot(self2.w, pl2.v);
1211-
# end
1191+
def side(self, other):
1192+
"""
1193+
Plucker side operator
1194+
1195+
:param other: second line
1196+
:type other: Line3
1197+
:return: permuted dot product
1198+
:rtype: float
1199+
1200+
This permuted dot product operator is zero whenever the lines intersect or are parallel.
1201+
"""
1202+
if not isinstance(other, Line3):
1203+
raise ValueError('argument must be a Line3')
1204+
1205+
return np.dot(self.A[[0, 4, 1, 5, 2, 3]], other.A[4, 0, 5, 1, 3, 2])
12121206

12131207
# Static factory methods for constructors from exotic representations
12141208

0 commit comments

Comments
 (0)