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
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.
return Vector2
        public static Vector2 CatmullRom(Vector2 value1, Vector2 value2, Vector2 value3, Vector2 value4, float amount)
        {
            float num = amount * amount;
            float num2 = amount * num;
            Vector2 result;
            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);
            return result;
        }
        /// <summary>Performs a Catmull-Rom interpolation using the specified positions.</summary>

Same methods

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