def normalize(v):
    norm = np.linalg.norm(v)
if norm == 0:
    return v
return v / norm

def find_hull_intersection(hull, ray_point):
    unit_ray = normalize(ray_point)
closest_plane = None
closest_plane_distance = 0
for plane in hull.equations:
    normal = plane[:-1]
distance = plane[-1]
if distance == 0:
    return np.multiply(ray_point, 0)
if distance < 0:
    np.multiply(normal, -1)
distance = distance * -1
dot_product = np.dot(normal, unit_ray)
if dot_product > 0:
    ray_distance = distance / dot_product
if closest_plane is None or ray_distance < closest_plane_distance:
    closest_plane = plane
closest_plane_distance = ray_distance
if closest_plane is None:
    return None
return np.multiply(unit_ray, closest_plane_distance)
Intersection of nD line with convex hull in Python