Fix IntersectLines NaN problems

In IntersectLines, cache data to be placed in inter until return time so as to avoid inconsistent behavior when somebody calls it with the same address as an input and an output.

This addresses issue #1465.