Dot() public static method

public static Dot ( Int3 lhs, Int3 rhs ) : int
lhs Int3
rhs Int3
return int
Ejemplo n.º 1
0
        // Token: 0x0600017B RID: 379 RVA: 0x000108A8 File Offset: 0x0000ECA8
        public static float Angle(Int3 lhs, Int3 rhs)
        {
            double num = (double)Int3.Dot(lhs, rhs) / ((double)lhs.magnitude * (double)rhs.magnitude);

            num = ((num >= -1.0) ? ((num <= 1.0) ? num : 1.0) : -1.0);
            return((float)Math.Acos(num));
        }
Ejemplo n.º 2
0
        // Token: 0x0600008B RID: 139 RVA: 0x00007684 File Offset: 0x00005A84
        public static float NearestPointFactor(Int3 lineStart, Int3 lineEnd, Int3 point)
        {
            Int3  rhs          = lineEnd - lineStart;
            float sqrMagnitude = rhs.sqrMagnitude;

            return((float)Int3.Dot(point - lineStart, rhs) / sqrMagnitude);
        }
Ejemplo n.º 3
0
        public static float ClosestPointOnLineFactor(Int3 lineStart, Int3 lineEnd, Int3 point)
        {
            Int3  rhs          = lineEnd - lineStart;
            float sqrMagnitude = rhs.sqrMagnitude;
            float num          = (float)Int3.Dot(point - lineStart, rhs);

            if (sqrMagnitude != 0f)
            {
                num /= sqrMagnitude;
            }
            return(num);
        }
Ejemplo n.º 4
0
        public static float ClosestPointOnLineFactor(Int3 lineStart, Int3 lineEnd, Int3 point)
        {
            var   lineDirection = lineEnd - lineStart;
            float magn          = lineDirection.sqrMagnitude;

            float closestPoint = Int3.Dot((point - lineStart), lineDirection);

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

            return(closestPoint);
        }