Often, when you say that something is ugly, you mean it is slow or hard to implement, usually both. Is this one of those situations where it is slower? It seems like this is just a series of adds (+ subtracts) and multiplies, followed by 3 divides. Is this so much slower than trying to find the triangle height, then computing the distance to each edge, then also computing the product with the function value? Maybe my linear algebra is still too weak, but these methods seem at least comparable in speed.

large_monkey

My guess is that there might be hardware optimized to compute barycentric coordinates and work with them to perform various tests, for example checking if a point is inside a triangle (like a GPU primitives?) which might make working with them more efficient than the alternatives. Would this be commonplace for modern GPU hardware?

Often, when you say that something is ugly, you mean it is slow or hard to implement, usually both. Is this one of those situations where it is slower? It seems like this is just a series of adds (+ subtracts) and multiplies, followed by 3 divides. Is this so much slower than trying to find the triangle height, then computing the distance to each edge, then also computing the product with the function value? Maybe my linear algebra is still too weak, but these methods seem at least comparable in speed.

My guess is that there might be hardware optimized to compute barycentric coordinates and work with them to perform various tests, for example checking if a point is inside a triangle (like a GPU primitives?) which might make working with them more efficient than the alternatives. Would this be commonplace for modern GPU hardware?