Suppose I have two triangles relatively close together (so they probably shouldn't really be treated as point masses). I want to calculate the gravitational force (and potentially torque?) generated between the two bodies in the 2D plane.

For spheres/circles you can just treat them as point masses and go from there, but can you do that for arbitrary triangles (or tetrahedrons in 3D)?

I know the answer is probably to do a spatial integral across both triangles, but it's been a long time since I knew how to do that :)

The end goal is to be able to compute the gravitational force between arbitrary polygons/polyhedra. I figured decomposing it in to triangles/tetrahedrons would be a good start.

...

**UPDATE:**

Okay, my multidimensional calculus is a bit rusty, but I think this is a promising direction:

Let:
$$\vec{f} = (a - c) \mu\_1 + (b - c) \upsilon\_1 - (x - z) \mu\_2 - (y-z) \upsilon\_2 - (z - c)$$
be the separation vector between two points on either triangle,

where $a, b, c$ are the vertices of triangle 1, and $\mu\_1, \upsilon\_1$ are the barycentric coordinates (corresponding to $a$ and $b$) for the point on triangle 1. Likewise for $x, y, z$ and $\mu\_2, \upsilon\_2$ for triangle 2. Using the barycentric coordinates let's us form the spatial integral to arrive at an answer.

So the (linear, non-torque) force between them is proportional to:

$$\vec{F\_G} = \displaystyle\int\_0^1 \int\_0^{1-v\_2} \int\_0^{1} \int\_0^{1-v\_1} \! \frac{f}{||{f}||^3} \, \mathrm{d} \mu\_1 \mathrm{d} \upsilon\_1 \mathrm{d} \mu\_2 \mathrm{d} \upsilon\_2 $$

I think this admits a closed form solution, though I'm still wrestling with Mathematica. I'd really be surprised if this integral hasn't been done somewhere before, though.