Pathfinding.Int2.DotLong C# (CSharp) Method

DotLong() public static method

public static DotLong ( Int2 a, Int2 b ) : long
a Int2
b Int2
return long
		public static long DotLong (Int2 a, Int2 b) {
			return (long)a.x*(long)b.x + (long)a.y*(long)b.y;
		}
		

Usage Example

        private void CalcNearestPoint(out Int3 cp, ref Int3 start, ref Int3 end, ref Int3 p)
        {
            Int2 vInt             = new Int2(end.x - start.x, end.z - start.z);
            long sqrMagnitudeLong = vInt.sqrMagnitudeLong;
            Int2 vInt2            = new Int2(p.x - start.x, p.z - start.z);

            cp   = default(Int3);
            cp.y = p.y;
            long num = Int2.DotLong(ref vInt2, ref vInt);

            if (sqrMagnitudeLong != 0L)
            {
                long a  = (long)(end.x - start.x) * num;
                long a2 = (long)(end.z - start.z) * num;
                cp.x  = (int)IntMath.Divide(a, sqrMagnitudeLong);
                cp.z  = (int)IntMath.Divide(a2, sqrMagnitudeLong);
                cp.x += start.x;
                cp.z += start.z;
            }
            else
            {
                int num2 = (int)num;
                cp.x = start.x + (end.x - start.x) * num2;
                cp.z = start.z + (end.z - start.z) * num2;
            }
        }
All Usage Examples Of Pathfinding.Int2::DotLong