I want to calculate the intersection volume of a rectangular prism and a cuboid. There are not any constraint on cuboid and the rectangular prism. I thought of solving it with some sort of numerical integration or break it to many triple integration over different regions which have analytical solution. but none of these would be computationally efficient, and i need an efficient way because it must be repeated many many times for different cuboids and prisms.
So I was wondering is there any analytical solution to this problem. Finite Element Modelling software do this kind of calculations all the time (finding the intersection and calculating its volume). I would be happy if anyone could suggest a reference or textbook on the subject.
For 2D case (intersection area between a rectangle and 2 arbitrary line) I found the intersection points, then calculate the area of convex polygon (using shoelace algorithm which simply breaks the polygon to many triangles and sum the area of triangles). In the picture the red dots define the intersection polygon.
