Microsoft.Xna.Framework.Vector2.CatmullRom C# (CSharp) Method

CatmullRom() public static method

Performs a Catmull-Rom interpolation using the specified positions.
public static CatmullRom ( Vector2 &value1, Vector2 &value2, Vector2 &value3, Vector2 &value4, float amount, Vector2 &result ) : void
value1 Vector2 The first position in the interpolation.
value2 Vector2 The second position in the interpolation.
value3 Vector2 The third position in the interpolation.
value4 Vector2 The fourth position in the interpolation.
amount float Weighting factor.
result Vector2 [OutAttribute] A vector that is the result of the Catmull-Rom interpolation.
return void
        public static void CatmullRom(ref Vector2 value1, ref Vector2 value2, ref Vector2 value3, ref Vector2 value4, float amount, out Vector2 result)
        {
            float num = amount * amount;
            float num2 = amount * num;
            result.X = 0.5f * (2f * value2.X + (-value1.X + value3.X) * amount + (2f * value1.X - 5f * value2.X + 4f * value3.X - value4.X) * num + (-value1.X + 3f * value2.X - 3f * value3.X + value4.X) * num2);
            result.Y = 0.5f * (2f * value2.Y + (-value1.Y + value3.Y) * amount + (2f * value1.Y - 5f * value2.Y + 4f * value3.Y - value4.Y) * num + (-value1.Y + 3f * value2.Y - 3f * value3.Y + value4.Y) * num2);
        }
        /// <summary>Performs a Hermite spline interpolation.</summary>

Same methods

Vector2::CatmullRom ( Vector2 value1, Vector2 value2, Vector2 value3, Vector2 value4, float amount ) : Vector2