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

Barycentric() public static method

Returns a Vector2 containing the 2D Cartesian coordinates of a point specified in barycentric (areal) coordinates relative to a 2D triangle.
public static Barycentric ( Vector2 value1, Vector2 value2, Vector2 value3, float amount1, float amount2 ) : Vector2
value1 Vector2 A Vector2 containing the 2D Cartesian coordinates of vertex 1 of the triangle.
value2 Vector2 A Vector2 containing the 2D Cartesian coordinates of vertex 2 of the triangle.
value3 Vector2 A Vector2 containing the 2D Cartesian coordinates of vertex 3 of the triangle.
amount1 float Barycentric coordinate b2, which expresses the weighting factor toward vertex 2 (specified in value2).
amount2 float Barycentric coordinate b3, which expresses the weighting factor toward vertex 3 (specified in value3).
return Vector2
        public static Vector2 Barycentric(Vector2 value1, Vector2 value2, Vector2 value3, float amount1, float amount2)
        {
            Vector2 result;
            result.X = value1.X + amount1 * (value2.X - value1.X) + amount2 * (value3.X - value1.X);
            result.Y = value1.Y + amount1 * (value2.Y - value1.Y) + amount2 * (value3.Y - value1.Y);
            return result;
        }
        /// <summary>Returns a Vector2 containing the 2D Cartesian coordinates of a point specified in barycentric (areal) coordinates relative to a 2D triangle.</summary>

Same methods

Vector2::Barycentric ( Vector2 &value1, Vector2 &value2, Vector2 &value3, float amount1, float amount2, Vector2 &result ) : void