Handle intersection-point computation better. Specifically, pay attention to line and circle segments in more cases, factoring out common code.