DotLong() public static method

public static DotLong ( Int2 a, Int2 b ) : long
a Int2
b Int2
return long
        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;
            }
        }
示例#2
0
        // Token: 0x0600008C RID: 140 RVA: 0x000076B4 File Offset: 0x00005AB4
        public static float NearestPointFactor(Int2 lineStart, Int2 lineEnd, Int2 point)
        {
            Int2   b    = lineEnd - lineStart;
            double num  = (double)b.sqrMagnitudeLong;
            double num2 = (double)Int2.DotLong(point - lineStart, b) / num;

            return((float)num2);
        }
示例#3
0
        public static float ClosestPointOnLineFactor(Int2 lineStart, Int2 lineEnd, Int2 point)
        {
            Int2   b    = lineEnd - lineStart;
            double num  = (double)b.sqrMagnitudeLong;
            double num2 = (double)Int2.DotLong(point - lineStart, b);

            if (num != 0.0)
            {
                num2 /= num;
            }
            return((float)num2);
        }
示例#4
0
        public static float ClosestPointOnLineFactor(Int2 lineStart, Int2 lineEnd, Int2 point)
        {
            Int2   b = lineEnd - lineStart;
            double sqrMagnitudeLong = b.sqrMagnitudeLong;
            double num3             = Int2.DotLong(point - lineStart, b);

            if (sqrMagnitudeLong != 0.0)
            {
                num3 /= sqrMagnitudeLong;
            }
            return((float)num3);
        }
示例#5
0
        public static float ClosestPointOnLineFactor(Int2 lineStart, Int2 lineEnd, Int2 point)
        {
            var    lineDirection = lineEnd - lineStart;
            double magn          = lineDirection.sqrMagnitudeLong;

            double closestPoint = Int2.DotLong(point - lineStart, lineDirection);

            if (magn != 0)
            {
                closestPoint /= magn;
            }

            return((float)closestPoint);
        }