Ray-Line intersection test

I need to test ray-line intersection in order to compute the hair self-shadow. Anyone know about this?