I am looking for an analytic solution for the following problem. A unit square is given. Coordinates of two points inside the square are given. What is the best circular arc which splits the square in to two regions such that the given points are closest(least square error) to the centroids of regions?
This problem came up due to the following scenario. Region 1 and Region 2 represents 2 fluids. The only information we know are the two centroids and their area density. I was previously splitting it with straight line but have only two degree of flexibility(slope and intercept) and my results were not satisfactory. So while moving to higher order I had options of quadratic and circular fit. I want to try circular fit because of its elegance and easiness to extrapolate to 3D as that is my final requirement.
My one of many attempts to tackle the problem was as following. I tried first to solve assuming there exists a circle as an exact solution for given inputs, Area, x and y (Area value is available)
a) consider two separate cases, arc cutting adjacent sides and diagonals.
b) connect ends of arc, find the centroid of circular segment and thus find equation for intersection area of circle and square.
c) Using area find equations for centroids.
d) solve 3 equations analytically(I could not see equations below) or numerically(I could do it in matlab)
But the draw backs are I cannot afford many iterations(millions of cells) and there are infinite cases when there is no solution for this cubic equation. In that case I need to differentiate the analytical term for error which I could not solve for even using software.
The 3 equations for one scenario was got like this (figure attached) this uses unknowns xo, yo and R for the equations with given inputs of area (A_Ch) and centroids (Cx_Ch and Cy_Ch)
gam = asin(y0/R);
del = acos(x0/R);
u = R*cos(gam)-x0;
v = R*sin(del)-y0;
s = -v/u
alpha = acos(x0/R)-asin(y0/R); beta = acos(x0/R)+asin(y0/R);
A_Ch = 0.5 * ( R^2*alpha + 2*x0*y0 - y0*sqrt(R^2-y0^2) - x0*sqrt(R^2-x0^2) )
Cx_Ch = (2*R^3*(sin(alpha/2))^3 cos(beta/2)+0.5(sqrt(R^2-y0^2)-x0) * (sqrt(R^2-x0^2)-y0)*(2*x0+sqrt(R^2-y0^2)) )/(3*A_Ch) -x0
Cy_Ch = (2*R^3*(sin(alpha/2))^3 sin(beta/2)+0.5(sqrt(R^2-y0^2)-x0) * (sqrt(R^2-x0^2)-y0)*(2*y0+sqrt(R^2-x0^2)) )/(3*A_Ch) -y0
Po_u = [s*(s^2-1),0,6*A_Ch*(s^2-1),12*A_Ch*(s*Cy_Ch+Cx_Ch)]