Pathfinding.Polygon.IntersectionFactorRay C# (CSharp) Method

IntersectionFactorRay() public static method

public static IntersectionFactorRay ( Int3 start1, Int3 end1, Int3 start2, Int3 end2 ) : float
start1 Int3
end1 Int3
start2 Int3
end2 Int3
return float
		public static float IntersectionFactorRay (Int3 start1, Int3 end1, Int3 start2, Int3 end2) {
			
			Int3 dir1 = end1-start1;
			Int3 dir2 = end2-start2;
			
			int den = dir2.z*dir1.x - dir2.x * dir1.z;
			
			if (den == 0) {
				return float.NaN;
			}
			
			int nom = dir2.x*(start1.z-start2.z)- dir2.z*(start1.x-start2.x);
			int nom2 = dir1.x*(start1.z-start2.z) - dir1.z * (start1.x - start2.x);
			
			//if ((nom2 < 0) ^ (den < 0) && nom2 != 0) return float.NaN;
			if ((float)nom2/den < 0) {
				return float.NaN;
			}
			return (float)nom/den;
		}