public static bool Contains(Vector3 v0, Vector3 v1, Vector3 v2, Vector3 p) { var bc = Barycenter(v0, v1, v2, p); return( Mathx.IsEqual(bc.x + bc.y + bc.z, 1.0f) && Mathx.IsInRange(bc, Vector3.zero, Vector3.one) ); }