Hello everyone,

I'm trying to perform a double integral over a parametrized triangle as part of computing the inertia tensor of a mesh. I'll spare the details, but the end result is that I need to evaluate the integral

where , and are constants (represents the x-coordinate of the triangle vertex). The integral bounds come from the triangle parametrization.

Evaluating the inside integral, I get

Then evaluting the outside integral:

This resembles, but doesn't quite match my expected result,

Some parts look okay, like the and terms in the numerator might eventually factor with the term in my denominator to at least get the correct cubic terms, but in general the denominator is giving me trouble, and I don't see where the correct result's term might come from. It feels like I've done something silly somewhere, but I can't see where. (Haven't we all been there before? >_>)

Could I trouble someone to take a look and see where things went wrong?

Edit: Found the solution- nothing was wrong, I just missed the final factorisation:

as required.