I am trying to calculate the volume of a triangular prism where both triangles are a different irregular triangles, above shows the regular version. The shape I have will have varying lengths for a,b,c for the base and the top (so base and top will be different triangles) but h will be constant (ie no slope on the shape). I have so far been unsuccessful in finding an equation for this so any help is much appreciated. I am happy to clarify if my post is unclear.
I have just found the following equation online that uses a1,a2,a3, b1,b2,b3 a being the base and b being the top, as stated though im unfamiliar with this area of mathematics so if anyone could tell me whether the equation below looks correct it would help me a lot, thanks.



The volume is not uniquely determined by the sides of the bases and the distance between the basal planes. The twisting of one base relative to the other can change the volume. We prove this using a simple case.
Assume your bases are both equilateral triangles with edge length $1$ and separation $\sqrt{2/3}$. If the bases are aligned to form a proper triangular prism, then you can calculate the volume as $\sqrt2/4$. But if we twist one base by $60°$ and thus generate a regular octahedron with unit edges, the volume has grown to $\sqrt2/3$.
To see what happens geometrically, cut the figure with a plane parallel to and halfway between the two bases you designated. With the triangular prism the resulting cross-section is another equilateral triangle, whereas with the regular octahedron this cross-section is instead a regular hexagon. Both of these cross-sections have the same perimeter, but that makes the hexagon have a bigger area (closer to being a circle). Thus twisting the bases without changing their internal geometry or their separation still changes the volume by changing the intervening cross-sections.