from __future__ import print_function
import numpy as np

def LinePlaneCollision(planeNormal, planePoint, rayDirection, rayPoint, epsilon=1e-6):

	ndotu = planeNormal.dot(rayDirection)
	if abs(ndotu) < epsilon:
		raise RuntimeError()

	w = rayPoint - planePoint
	si = -planeNormal.dot(w) / ndotu
	Psi = w + si * rayDirection + planePoint
	return Psi


if __name__==:
	
	planeNormal = np.array([0, 0, 1])
	planePoint = np.array([0, 0, 5]) 

	
	rayDirection = np.array([0, -1, -1])
	rayPoint = np.array([0, 0, 10]) 

	Psi = LinePlaneCollision(planeNormal, planePoint, rayDirection, rayPoint)
	print (, Psi)