Compact Packing Circles on Dome Boundary Issues

Hello all and @DanielPiker,

I have been working on this dome shaped pavilion for a few months now in the goals of compact packing circles along the dome face. Through correspondence on here as well as a variety of scripts from previous threads on this topic, we have managed to get the circles to pack within our given shape. The new issue we face comes in the current Grasshopper script failing to recognize the boundary of the shape, resulting in circles hanging off the side of the dome or not meeting the edge at all (see attached photo). If anyone has any suggestions on how to get Grasshopper to recognize the boundary and tangentially align the packed circles to it, it would be greatly appreciated! Rhino8 file as well as Grasshopper script attached.

Circlepacking_tangent_corner.gh (21.9 KB)

compact packing dome.3dm (9.9 MB)