@@ -92,7 +92,54 @@ def LinePoint(cls, l, p):
92
92
d = np .dot (l .v , p )
93
93
94
94
return cls (n , d )
95
+
96
+ @classmethod
97
+ def TwoLines (cls , l1 , l2 ):
98
+ """
99
+ Create a plane object from two line
100
+
101
+ :param l1: 3D line
102
+ :type l1: Line3
103
+ :param l2: 3D line
104
+ :type l2: Line3
105
+ :return: a Plane object
106
+ :rtype: Plane
107
+
108
+ .. warning:: This algorithm fails if the lines are parallel.
109
+
110
+ :seealso: :meth:`LinePoint` :meth:`PointNormal` :meth:`ThreePoints`
111
+ """
112
+ n = np .cross (l1 .w , l2 .w )
113
+ d = np .dot (l1 .v , l2 .w )
95
114
115
+ return cls (n , d )
116
+
117
+ @staticmethod
118
+ def intersection (pi1 , pi2 , pi3 ):
119
+ """
120
+ Intersection point of three planes
121
+
122
+ :param pi1: plane 1
123
+ :type pi1: Plane
124
+ :param pi2: plane 2
125
+ :type pi2: Plane
126
+ :param pi3: plane 3
127
+ :type pi3: Plane
128
+ :return: coordinates of intersection point
129
+ :rtype: ndarray(3)
130
+
131
+ This static method computes the intersection point of the three planes
132
+ given as arguments.
133
+
134
+ .. warning:: This algorithm fails if the planes do not intersect, or
135
+ intersect along a line.
136
+
137
+ :seealso: :meth:`Plane`
138
+ """
139
+ A = np .vstack ([pi1 .n , pi2 .n , pi3 .n ])
140
+ b = np .array ([pi1 .d , pi2 .d , pi3 .d ])
141
+ return np .linalg .det (A ) @ b
142
+
96
143
@property
97
144
def n (self ):
98
145
r"""
@@ -210,27 +257,27 @@ def __init__(self, v=None, w=None):
210
257
211
258
A representation of a 3D line using Plucker coordinates.
212
259
213
- - ``Line3(P )`` creates a 3D line from a Plucker coordinate vector ``[v, w]``
260
+ - ``Line3(p )`` creates a 3D line from a Plucker coordinate vector ``p= [v, w]``
214
261
where ``v`` (3,) is the moment and ``w`` (3,) is the line direction.
215
262
216
263
- ``Line3(v, w)`` as above but the components ``v`` and ``w`` are
217
264
provided separately.
218
265
219
266
- ``Line3(L)`` creates a copy of the ``Line3`` object ``L``.
220
267
221
- .. note: :
268
+ :notes :
222
269
223
270
- The ``Line3`` object inherits from ``collections.UserList`` and has list-like
224
271
behaviours.
225
- - A single ``Line3`` object contains a 1D array of Plucker coordinates.
272
+ - A single ``Line3`` object contains a 1D- array of Plucker coordinates.
226
273
- The elements of the array are guaranteed to be Plucker coordinates.
227
274
- The number of elements is given by ``len(L)``
228
275
- The elements can be accessed using index and slice notation, eg. ``L[1]`` or
229
276
``L[2:3]``
230
277
- The ``Line3`` instance can be used as an iterator in a for loop or list comprehension.
231
278
- Some methods support operations on the internal list.
232
279
233
- :seealso: :meth:`TwoPoints ` :meth:`Planes ` :meth:`PointDir`
280
+ :seealso: :meth:`Join ` :meth:`TwoPlanes ` :meth:`PointDir`
234
281
"""
235
282
super ().__init__ () # enable list powers
236
283
@@ -285,7 +332,7 @@ def Join(cls, P=None, Q=None):
285
332
return cls (np .r_ [v , w ])
286
333
287
334
@classmethod
288
- def IntersectingPlanes (cls , pi1 , pi2 ):
335
+ def TwoPlanes (cls , pi1 , pi2 ):
289
336
r"""
290
337
Create 3D line from intersection of two planes
291
338
@@ -296,7 +343,7 @@ def IntersectingPlanes(cls, pi1, pi2):
296
343
:return: 3D line
297
344
:rtype: ``Line3`` instance
298
345
299
- ``L = Plucker.IntersectingPlanes (π1, π2)`` is a Plucker object that represents
346
+ ``L = Line3.TwoPlanes (π1, π2)`` is a ``Line3`` object that represents
300
347
the line formed by the intersection of two planes ``π1`` and ``π3``.
301
348
302
349
Planes are represented by the 4-vector :math:`[a, b, c, d]` which describes
@@ -316,6 +363,12 @@ def IntersectingPlanes(cls, pi1, pi2):
316
363
v = pi2 .d * pi1 .n - pi1 .d * pi2 .n
317
364
return cls (np .r_ [v , w ])
318
365
366
+ @classmethod
367
+ def IntersectingPlanes (cls , pi1 , pi2 ):
368
+
369
+ warnings .warn ('use TwoPlanes method instead' , DeprecationWarning )
370
+ return cls .TwolPlanes (pi1 , pi2 )
371
+
319
372
@classmethod
320
373
def PointDir (cls , point , dir ):
321
374
"""
@@ -328,7 +381,7 @@ def PointDir(cls, point, dir):
328
381
:return: 3D line
329
382
:rtype: ``Line3`` instance
330
383
331
- ``Line3.pointdir (P, W)`` is a Plucker object that represents the
384
+ ``Line3.PointDir (P, W)`` is a `Line3`` object that represents the
332
385
line containing the point ``P`` and parallel to the direction vector ``W``.
333
386
334
387
:seealso: :meth:`Join` :meth:`IntersectingPlanes`
0 commit comments