@@ -45,7 +45,7 @@ def test_constructor2(self):
45
45
# 2, point constructor
46
46
P = np .r_ [2 , 3 , 7 ]
47
47
Q = np .r_ [2 , 1 , 0 ]
48
- L = Plucker .PQ (P , Q )
48
+ L = Plucker .TwoPoints (P , Q )
49
49
nt .assert_array_almost_equal (L .w , P - Q )
50
50
nt .assert_array_almost_equal (L .v , np .cross (P - Q , Q ))
51
51
@@ -74,7 +74,7 @@ def test_constructor2(self):
74
74
75
75
def test_pp (self ):
76
76
# validate pp and ppd
77
- L = Plucker .PQ ([- 1 , 1 , 2 ], [1 , 1 , 2 ])
77
+ L = Plucker .TwoPoints ([- 1 , 1 , 2 ], [1 , 1 , 2 ])
78
78
nt .assert_array_almost_equal (L .pp , np .r_ [0 , 1 , 2 ])
79
79
self .assertEqual (L .ppd , math .sqrt (5 ))
80
80
@@ -85,7 +85,7 @@ def test_pp(self):
85
85
def test_contains (self ):
86
86
P = [2 , 3 , 7 ]
87
87
Q = [2 , 1 , 0 ]
88
- L = Plucker .PQ (P , Q )
88
+ L = Plucker .TwoPoints (P , Q )
89
89
90
90
# validate contains
91
91
self .assertTrue ( L .contains ([2 , 3 , 7 ]) )
@@ -96,39 +96,39 @@ def test_contains(self):
96
96
def test_closest (self ):
97
97
P = [2 , 3 , 7 ]
98
98
Q = [2 , 1 , 0 ]
99
- L = Plucker .PQ (P , Q )
99
+ L = Plucker .TwoPoints (P , Q )
100
100
101
- out = L .closest (P )
101
+ out = L .closest_to_point (P )
102
102
nt .assert_array_almost_equal (out .p , P )
103
103
self .assertAlmostEqual (out .d , 0 )
104
104
105
105
# validate closest with given points and origin
106
- out = L .closest (Q )
106
+ out = L .closest_to_point (Q )
107
107
nt .assert_array_almost_equal (out .p , Q )
108
108
self .assertAlmostEqual (out .d , 0 )
109
109
110
- L = Plucker .PQ ([- 1 , 1 , 2 ], [1 , 1 , 2 ])
111
- out = L .closest ([0 , 1 , 2 ])
110
+ L = Plucker .TwoPoints ([- 1 , 1 , 2 ], [1 , 1 , 2 ])
111
+ out = L .closest_to_point ([0 , 1 , 2 ])
112
112
nt .assert_array_almost_equal (out .p , np .r_ [0 , 1 , 2 ])
113
113
self .assertAlmostEqual (out .d , 0 )
114
114
115
- out = L .closest ([5 , 1 , 2 ])
115
+ out = L .closest_to_point ([5 , 1 , 2 ])
116
116
nt .assert_array_almost_equal (out .p , np .r_ [5 , 1 , 2 ])
117
117
self .assertAlmostEqual (out .d , 0 )
118
118
119
- out = L .closest ([0 , 0 , 0 ])
119
+ out = L .closest_to_point ([0 , 0 , 0 ])
120
120
nt .assert_array_almost_equal (out .p , L .pp )
121
121
self .assertEqual (out .d , L .ppd )
122
122
123
- out = L .closest ([5 , 1 , 0 ])
123
+ out = L .closest_to_point ([5 , 1 , 0 ])
124
124
nt .assert_array_almost_equal (out .p , [5 , 1 , 2 ])
125
125
self .assertAlmostEqual (out .d , 2 )
126
126
127
127
def test_plot (self ):
128
128
129
129
P = [2 , 3 , 7 ]
130
130
Q = [2 , 1 , 0 ]
131
- L = Plucker .PQ (P , Q )
131
+ L = Plucker .TwoPoints (P , Q )
132
132
133
133
fig = plt .figure ()
134
134
ax = fig .add_subplot (111 , projection = '3d' , proj_type = 'ortho' )
@@ -142,9 +142,9 @@ def test_eq(self):
142
142
w = np .r_ [1 , 2 , 3 ]
143
143
P = np .r_ [- 2 , 4 , 3 ]
144
144
145
- L1 = Plucker .PQ (P , P + w )
146
- L2 = Plucker .PQ (P + 2 * w , P + 5 * w )
147
- L3 = Plucker .PQ (P + np .r_ [1 , 0 , 0 ], P + w )
145
+ L1 = Plucker .TwoPoints (P , P + w )
146
+ L2 = Plucker .TwoPoints (P + 2 * w , P + 5 * w )
147
+ L3 = Plucker .TwoPoints (P + np .r_ [1 , 0 , 0 ], P + w )
148
148
149
149
self .assertTrue (L1 == L2 )
150
150
self .assertFalse (L1 == L3 )
@@ -155,7 +155,7 @@ def test_eq(self):
155
155
def test_skew (self ):
156
156
157
157
P = [2 , 3 , 7 ]; Q = [2 , 1 , 0 ]
158
- L = Plucker .PQ (P , Q )
158
+ L = Plucker .TwoPoints (P , Q )
159
159
160
160
m = L .skew
161
161
@@ -165,7 +165,7 @@ def test_skew(self):
165
165
def test_mtimes (self ):
166
166
P = [1 , 2 , 0 ]
167
167
Q = [1 , 2 , 10 ] # vertical line through (1,2)
168
- L = Plucker .PQ (P , Q )
168
+ L = Plucker .TwoPoints (P , Q )
169
169
170
170
# check transformation by SE3
171
171
@@ -242,7 +242,7 @@ def test_line(self):
242
242
def test_contains (self ):
243
243
P = [2 , 3 , 7 ]
244
244
Q = [2 , 1 , 0 ]
245
- L = Pluc
F438
ker .PQ (P , Q )
245
+ L = Plucker .TwoPoints (P , Q )
246
246
247
247
self .assertTrue ( L .contains (L .point (0 )) )
248
248
self .assertTrue ( L .contains (L .point (1 )) )
@@ -251,7 +251,7 @@ def test_contains(self):
251
251
def test_point (self ):
252
252
P = [2 , 3 , 7 ]
253
253
Q = [2 , 1 , 0 ]
254
- L = Plucker .PQ (P , Q )
254
+ L = Plucker .TwoPoints (P , Q )
255
255
256
256
nt .assert_array_almost_equal (L .point (0 ).flatten (), L .pp )
257
257
@@ -261,7 +261,7 @@ def test_point(self):
261
261
def test_char (self ):
262
262
P = [2 , 3 , 7 ]
263
263
Q = [2 , 1 , 0 ]
264
- L = Plucker .PQ (P , Q )
264
+ L = Plucker .TwoPoints (P , Q )
265
265
266
266
s = str (L )
267
267
self .assertIsInstance (s , str )
@@ -271,10 +271,10 @@ def test_plane(self):
271
271
272
272
xyplane = [0 , 0 , 1 , 0 ]
273
273
xzplane = [0 , 1 , 0 , 0 ]
274
- L = Plucker .Planes (xyplane , xzplane ) # x axis
274
+ L = Plucker .TwoPlanes (xyplane , xzplane ) # x axis
275
275
nt .assert_array_almost_equal (L .vec , np .r_ [0 , 0 , 0 , - 1 , 0 , 0 ])
276
276
277
- L = Plucker .PQ ([- 1 , 2 , 3 ], [1 , 2 , 3 ]); # line at y=2,z=3
277
+ L = Plucker .TwoPoints ([- 1 , 2 , 3 ], [1 , 2 , 3 ]); # line at y=2,z=3
278
278
x6 = [1 , 0 , 0 , - 6 ] # x = 6
279
279
280
280
# plane_intersect
@@ -291,9 +291,9 @@ def test_plane(self):
291
291
292
292
def test_methods (self ):
293
293
# intersection
294
- px = Plucker .PQ ([0 , 0 , 0 ], [1 , 0 , 0 ]); # x-axis
295
- py = Plucker .PQ ([0 , 0 , 0 ], [0 , 1 , 0 ]); # y-axis
296
- px1 = Plucker .PQ ([0 , 1 , 0 ], [1 , 1 , 0 ]); # offset x-axis
294
+ px = Plucker .TwoPoints ([0 , 0 , 0 ], [1 , 0 , 0 ]); # x-axis
295
+ py = Plucker .TwoPoints ([0 , 0 , 0 ], [0 , 1 , 0 ]); # y-axis
296
+ px1 = Plucker .TwoPoints ([0 , 1 , 0 ], [1 , 1 , 0 ]); # offset x-axis
297
297
298
298
self .assertEqual (px .ppd , 0 )
299
299
self .assertEqual (px1 .ppd , 1 )
0 commit comments