Calculate occluded geometry in a specified projection direction

I would like to be able to calculate the visible part of the projection of a geometry that is occluded from a specified viewpoint, is there any api or open source library I can call? So far I have tried using HiddenLineDrawing, but found that I can’t create a planetar surface.
For example, I want to calculate the visible surface of the green geometry in the Front viewport as well as the contour line


The ideal result is as follows

@dale can you help me ?