Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 10adfeb

Browse files
committed
Small fix in Artisan rougier#3
1 parent 5c5f62c commit 10adfeb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -568,14 +568,14 @@ Artisan
568568
def distance(P0, P1, p):
569569
T = P1 - P0
570570
L = (T**2).sum(axis=1)
571-
U = -((P0[:,0]-p[0])*T[:,0] + (P0[:,1]-p[1])*T[:,1]) / L
571+
U = -((P0[:,0]-p[...,0])*T[:,0] + (P0[:,1]-p[...,1])*T[:,1]) / L
572572
U = U.reshape(len(U),1)
573573
D = P0 + U*T - p
574574
return np.sqrt((D**2).sum(axis=1))
575575
576-
P0 = np.random.uniform(-10,10,(100,2))
577-
P1 = np.random.uniform(-10,10,(100,2))
578-
p = np.random.uniform(-10,10,( 1,2))
576+
P0 = np.random.uniform(-10,10,(10,2))
577+
P1 = np.random.uniform(-10,10,(10,2))
578+
p = np.random.uniform(-10,10,( 1,2))
579579
print distance(P0, P1, p)
580580
581581

0 commit comments

Comments
 (0)