Wrote an optimization for line segment intersection tests