I would like to find the intersection points e.g. $M_x$ and $M_y$ as in the attached figure. The boundary (solid line) is defined by the Lagrangian points. I am working in C++ (basic - medium proficiency).
In this regard, I need a computer algorithm or code to get the intersection points both in x- and y-in a separate arrays.