forked from: 2D ray intersect triangle test

Try when starting from inside terrain triangle. 

The normalized ratio r multiplier of a given slope diagonal's length, based on gradient is: r = sqrt(1+gradient*gradient);  This is used to determine the perimeter travel time when walking along terrain triangles given a specific direction.