public static void Barycentric(Vector3 a, Vector3 b, Vector3 c, Vector3 p, out Vector3 uvw)
{
var vector = b - a;
var vector2 = c - a;
var vector3 = p - a;
var num = Vector3.Dot(vector, vector);
var num2 = Vector3.Dot(vector, vector2);
var num3 = Vector3.Dot(vector2, vector2);
var num4 = Vector3.Dot(vector3, vector);
var num5 = Vector3.Dot(vector3, vector2);
var num6 = (num * num3) - (num2 * num2);
uvw = new Vector3();
if (num6 != 0f)
{
uvw.Y = ((num3 * num4) - (num2 * num5)) / num6;
uvw.Z = ((num * num5) - (num2 * num4)) / num6;
uvw.X = (1f - uvw.Y) - uvw.Z;
}
}