I think Jerry is looking for the intersection of two meshes. It's easy for primitives like [ sphere & plane ], but can get pretty tricky when the meshes are more complicated.
Pictured here is [ sphere & cube ] and the contour is already getting to be a strange shape. If either mesh is not manifold (would leak water), then the intersection space is no longer manifold either.
Except in the most trivial cases, it's not something you can/should try to do in real time with moving objects.
However, there are sometimes some interesting z-buffer tricks which can emulate this kind of work in limited scenarios.