Problem on line collision

Hi. I am creating a minigolf game, i need a collision detector whit free hand line but i cant figure out.
Hittest take the boundary of the box. how can i do?