Make sure find_intersection returns a result matching the shape of inputs

This commit is contained in:
Grant Sanderson
2022-11-03 16:48:14 -07:00
parent 84fa3de435
commit a2606c7e37

View File

@ -294,7 +294,10 @@ def find_intersection(
denom[abs(denom) < threshold] = np.inf # So that ratio goes to 0 there
ratio = numer / denom
ratio = np.repeat(ratio, n).reshape((m, n))
return p0 + ratio * v0
result = p0 + ratio * v0
if m == 1:
return result[0]
return result
def get_closest_point_on_line(