Microsoft.Xna.Framework.MathHelper.Barycentric C# (CSharp) Method

Barycentric() public static method

public static Barycentric ( float value1, float value2, float value3, float amount1, float amount2 ) : float
value1 float
value2 float
value3 float
amount1 float
amount2 float
return float
        public static float Barycentric(float value1, float value2, float value3, float amount1, float amount2)
        {
            return value1 + amount1 * (value2 - value1) + amount2 * (value3 - value1);
        }
        public static float SmoothStep(float value1, float value2, float amount)

Usage Example

Esempio n. 1
0
 /// <summary>
 /// Creates a new <see cref="Vector2"/> that contains the cartesian coordinates of a vector specified in barycentric coordinates and relative to 2d-triangle.
 /// </summary>
 /// <param name="value1">The first vector of 2d-triangle.</param>
 /// <param name="value2">The second vector of 2d-triangle.</param>
 /// <param name="value3">The third vector of 2d-triangle.</param>
 /// <param name="amount1">Barycentric scalar <c>b2</c> which represents a weighting factor towards second vector of 2d-triangle.</param>
 /// <param name="amount2">Barycentric scalar <c>b3</c> which represents a weighting factor towards third vector of 2d-triangle.</param>
 /// <param name="result">The cartesian translation of barycentric coordinates as an output parameter.</param>
 public static void Barycentric(
     ref Vector2 value1,
     ref Vector2 value2,
     ref Vector2 value3,
     float amount1,
     float amount2,
     out Vector2 result
     )
 {
     result.X = MathHelper.Barycentric(value1.X, value2.X, value3.X, amount1, amount2);
     result.Y = MathHelper.Barycentric(value1.Y, value2.Y, value3.Y, amount1, amount2);
 }
All Usage Examples Of Microsoft.Xna.Framework.MathHelper::Barycentric