public static bool AreCoplanar <V> (this IEnumerable <V> vertices) where V : struct, IVertex <Vec3> { if (vertices.Count() < 4) { return(true); } var first = EnumerableExt.Next(ref vertices).position; var ab = EnumerableExt.Next(ref vertices).position - first; var ac = EnumerableExt.Next(ref vertices).position - first; var normal = ab.Cross(ac); return(vertices.All(v => normal.Dot(v.position - first).ApproxEquals(0f, 0.1f))); }