Lerp() public static method

Linearly interpolates between the two passed values.
public static Lerp ( float x, float y, float l ) : float
x float /// First value to interpolate. ///
y float /// Second value to interpolate. ///
l float /// Interpolation parameter. 0 returns , 1 returns . ///
return float
Beispiel #1
0
        /// <summary>
        ///   Linearly interpolates between the two passed vectors.
        /// </summary>
        /// <param name="v">
        ///   First vector to interpolate.
        /// </param>
        /// <param name="w">
        ///   Second vector to interpolate.
        /// </param>
        /// <param name="l">
        ///   Interpolation parameter. 0 returns <paramref name="v" />, 1 returns <paramref name="w" />.
        /// </param>
        /// <returns>
        ///   Linear interpolation between the two passed vectors.
        /// </returns>
        public static Vector2F Lerp(Vector2F v, Vector2F w, float l)
        {
            var lerpX = MathF.Lerp(v.x, w.x, l);
            var lerpY = MathF.Lerp(v.y, w.y, l);

            return(new Vector2F(lerpX, lerpY));
        }
Beispiel #2
0
        /// <summary>
        ///   Linearly interpolates between the two passed vectors.
        /// </summary>
        /// <param name="v">
        ///   First vector to interpolate.
        /// </param>
        /// <param name="w">
        ///   Second vector to interpolate.
        /// </param>
        /// <param name="l">
        ///   Interpolation parameter. 0 returns <paramref name="v" />, 1 returns <paramref name="w" />.
        /// </param>
        /// <returns>
        ///   Linear interpolation between the two passed vectors.
        /// </returns>
        public static Vector3F Lerp(Vector3F v, Vector3F w, float l)
        {
            var lerpX = MathF.Lerp(v.x, w.x, l);
            var lerpY = MathF.Lerp(v.y, w.y, l);
            var lerpZ = MathF.Lerp(v.z, w.z, l);

            return(new Vector3F(lerpX, lerpY, lerpZ));
        }