I need to find the volume of an arbitrary intersection of a cube and a cylinder. the sides of the cube ($a$) will always be less than the diameter of the cylinder, such that a cube can fit fully inside the cylinder. Anyone have any idea how to find the volume of the intersection with the cube at an arbitrary position?
I found this case which seems to be the right shape for the intersection but the solution stipulates that $a>r$ which will never be true in my case.
It is also possible to assume that the intersection is close to a wedge (ie $a<<r$) but this will not always be the case.
Note: You can assume the cylinder is infinite.