GetParametrization() static private méthode

static private GetParametrization ( Vector2 x0, Vector2 x1, Vector2 x2 ) : float
x0 Vector2
x1 Vector2
x2 Vector2
Résultat float
		public static float CalcLineTranslation(Vector2 src, Vector2 dest, Vector3 srcPosition, Vector3 constraintDir)
		{
			srcPosition = Handles.matrix.MultiplyPoint(srcPosition);
			constraintDir = Handles.matrix.MultiplyVector(constraintDir);
			float num = 1f;
			Vector3 forward = Camera.current.transform.forward;
			if (Vector3.Dot(constraintDir, forward) < 0f)
			{
				num = -1f;
			}
			Vector3 vector = constraintDir;
			vector.y = -vector.y;
			Camera current = Camera.current;
			Vector2 vector2 = EditorGUIUtility.PixelsToPoints(current.WorldToScreenPoint(srcPosition));
			Vector2 vector3 = EditorGUIUtility.PixelsToPoints(current.WorldToScreenPoint(srcPosition + constraintDir * num));
			Vector2 x = dest;
			Vector2 x2 = src;
			float result;
			if (vector2 == vector3)
			{
				result = 0f;
			}
			else
			{
				x.y = -x.y;
				x2.y = -x2.y;
				float parametrization = HandleUtility.GetParametrization(x2, vector2, vector3);
				float parametrization2 = HandleUtility.GetParametrization(x, vector2, vector3);
				float num2 = (parametrization2 - parametrization) * num;
				result = num2;
			}
			return result;
		}
        /// <summary>
        ///   <para>Map a mouse drag onto a movement along a line in 3D space.</para>
        /// </summary>
        /// <param name="src">The source point of the drag.</param>
        /// <param name="dest">The destination point of the drag.</param>
        /// <param name="srcPosition">The 3D position the dragged object had at src ray.</param>
        /// <param name="constraintDir">3D direction of constrained movement.</param>
        /// <returns>
        ///   <para>The distance travelled along constraintDir.</para>
        /// </returns>
        public static float CalcLineTranslation(Vector2 src, Vector2 dest, Vector3 srcPosition, Vector3 constraintDir)
        {
            srcPosition   = Handles.matrix.MultiplyPoint(srcPosition);
            constraintDir = Handles.matrix.MultiplyVector(constraintDir);
            float   num     = 1f;
            Vector3 forward = Camera.current.transform.forward;

            if ((double)Vector3.Dot(constraintDir, forward) < 0.0)
            {
                num = -1f;
            }
            Vector3 vector3 = constraintDir;

            vector3.y = -vector3.y;
            Camera  current = Camera.current;
            Vector2 points1 = EditorGUIUtility.PixelsToPoints((Vector2)current.WorldToScreenPoint(srcPosition));
            Vector2 points2 = EditorGUIUtility.PixelsToPoints((Vector2)current.WorldToScreenPoint(srcPosition + constraintDir * num));
            Vector2 x0_1    = dest;
            Vector2 x0_2    = src;

            if (points1 == points2)
            {
                return(0.0f);
            }
            x0_1.y = -x0_1.y;
            x0_2.y = -x0_2.y;
            float parametrization = HandleUtility.GetParametrization(x0_2, points1, points2);

            return((HandleUtility.GetParametrization(x0_1, points1, points2) - parametrization) * num);
        }