What is the nature of this project? Is this a school assignment? Does it need to be solved in closed/symbolic form? Can it be solved merely numerically? I'm also wondering if more criteria can be assumed to make the problem simpler, e.g.: with respect to curve P, can that curve be assumed to go through the center of the circles (well, spherical cap's axis where it meets the sphere) that define the corner arcs?