Weekly exercise 9: Finding the intersection of line segments