You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
U = -((P0[:,0]-p[...,0])*T[:,0] + (P0[:,1]-p[...,1])*T[:,1]) / L
1097
1117
U = U.reshape(len(U),1)
1098
1118
D = P0 + U*T - p
1099
1119
return np.sqrt((D**2).sum(axis=1))
1100
1120
1101
-
P0 = np.random.uniform(-10,10,(10,2))
1102
-
P1 = np.random.uniform(-10,10,(10,2))
1103
-
p = np.random.uniform(-10,10,( 1,2))
1104
-
print(distance(P0, P1, p))
1121
+
print(distance_slower(P0, P1, p))
1105
1122
1106
1123
< q79
1107
1124
Consider 2 sets of points P0,P1 describing lines (2d) and a set of points P, how to compute distance from each point j (P[j]) to each line i (P0[i],P1[i])? (★★★)
0 commit comments