How to find optimum (least square error) “square splitting circular arc†with given two centroids?
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
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?
Problem Explanation Figure
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)]
Centroid of Circular Segment
Equation Derivation
geometry optimization circle centroid
 |Â
show 1 more comment
up vote
1
down vote
favorite
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?
Problem Explanation Figure
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)]
Centroid of Circular Segment
Equation Derivation
geometry optimization circle centroid
"What is the best circular arc which splits the circle in to two regions" - did you mean square? From your image it looks like the square is being split.
– null
Jul 16 at 21:44
I updated my question. Yes, it is the square I need to split.
– AppoopanThaadi
Jul 16 at 22:03
Note that it could well be that the circular arc closes all the way to a circle nearly centered on one point.
– Joseph O'Rourke
Jul 16 at 22:53
Yes, that is also a case of interest. But I do have methods to detect that case when complete circle(bubble) is inside the square and hence easy to solve. The scenario here is like this, two regions are two fluids, and we want to approximate their interface from their centroids. so a bubble, exactly as you mentioned, is also an acceptable solution.
– AppoopanThaadi
Jul 16 at 23:10
First, you need to be able to solve the problem of given a circle (center and radius), find the centroid of the two regions. This seems non-trivial.
– marty cohen
Jul 17 at 2:24
 |Â
show 1 more comment
up vote
1
down vote
favorite
up vote
1
down vote
favorite
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?
Problem Explanation Figure
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)]
Centroid of Circular Segment
Equation Derivation
geometry optimization circle centroid
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?
Problem Explanation Figure
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)]
Centroid of Circular Segment
Equation Derivation
geometry optimization circle centroid
edited Jul 17 at 18:03
asked Jul 16 at 21:30


AppoopanThaadi
1298
1298
"What is the best circular arc which splits the circle in to two regions" - did you mean square? From your image it looks like the square is being split.
– null
Jul 16 at 21:44
I updated my question. Yes, it is the square I need to split.
– AppoopanThaadi
Jul 16 at 22:03
Note that it could well be that the circular arc closes all the way to a circle nearly centered on one point.
– Joseph O'Rourke
Jul 16 at 22:53
Yes, that is also a case of interest. But I do have methods to detect that case when complete circle(bubble) is inside the square and hence easy to solve. The scenario here is like this, two regions are two fluids, and we want to approximate their interface from their centroids. so a bubble, exactly as you mentioned, is also an acceptable solution.
– AppoopanThaadi
Jul 16 at 23:10
First, you need to be able to solve the problem of given a circle (center and radius), find the centroid of the two regions. This seems non-trivial.
– marty cohen
Jul 17 at 2:24
 |Â
show 1 more comment
"What is the best circular arc which splits the circle in to two regions" - did you mean square? From your image it looks like the square is being split.
– null
Jul 16 at 21:44
I updated my question. Yes, it is the square I need to split.
– AppoopanThaadi
Jul 16 at 22:03
Note that it could well be that the circular arc closes all the way to a circle nearly centered on one point.
– Joseph O'Rourke
Jul 16 at 22:53
Yes, that is also a case of interest. But I do have methods to detect that case when complete circle(bubble) is inside the square and hence easy to solve. The scenario here is like this, two regions are two fluids, and we want to approximate their interface from their centroids. so a bubble, exactly as you mentioned, is also an acceptable solution.
– AppoopanThaadi
Jul 16 at 23:10
First, you need to be able to solve the problem of given a circle (center and radius), find the centroid of the two regions. This seems non-trivial.
– marty cohen
Jul 17 at 2:24
"What is the best circular arc which splits the circle in to two regions" - did you mean square? From your image it looks like the square is being split.
– null
Jul 16 at 21:44
"What is the best circular arc which splits the circle in to two regions" - did you mean square? From your image it looks like the square is being split.
– null
Jul 16 at 21:44
I updated my question. Yes, it is the square I need to split.
– AppoopanThaadi
Jul 16 at 22:03
I updated my question. Yes, it is the square I need to split.
– AppoopanThaadi
Jul 16 at 22:03
Note that it could well be that the circular arc closes all the way to a circle nearly centered on one point.
– Joseph O'Rourke
Jul 16 at 22:53
Note that it could well be that the circular arc closes all the way to a circle nearly centered on one point.
– Joseph O'Rourke
Jul 16 at 22:53
Yes, that is also a case of interest. But I do have methods to detect that case when complete circle(bubble) is inside the square and hence easy to solve. The scenario here is like this, two regions are two fluids, and we want to approximate their interface from their centroids. so a bubble, exactly as you mentioned, is also an acceptable solution.
– AppoopanThaadi
Jul 16 at 23:10
Yes, that is also a case of interest. But I do have methods to detect that case when complete circle(bubble) is inside the square and hence easy to solve. The scenario here is like this, two regions are two fluids, and we want to approximate their interface from their centroids. so a bubble, exactly as you mentioned, is also an acceptable solution.
– AppoopanThaadi
Jul 16 at 23:10
First, you need to be able to solve the problem of given a circle (center and radius), find the centroid of the two regions. This seems non-trivial.
– marty cohen
Jul 17 at 2:24
First, you need to be able to solve the problem of given a circle (center and radius), find the centroid of the two regions. This seems non-trivial.
– marty cohen
Jul 17 at 2:24
 |Â
show 1 more comment
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2853880%2fhow-to-find-optimum-least-square-error-square-splitting-circular-arc-with-gi%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
"What is the best circular arc which splits the circle in to two regions" - did you mean square? From your image it looks like the square is being split.
– null
Jul 16 at 21:44
I updated my question. Yes, it is the square I need to split.
– AppoopanThaadi
Jul 16 at 22:03
Note that it could well be that the circular arc closes all the way to a circle nearly centered on one point.
– Joseph O'Rourke
Jul 16 at 22:53
Yes, that is also a case of interest. But I do have methods to detect that case when complete circle(bubble) is inside the square and hence easy to solve. The scenario here is like this, two regions are two fluids, and we want to approximate their interface from their centroids. so a bubble, exactly as you mentioned, is also an acceptable solution.
– AppoopanThaadi
Jul 16 at 23:10
First, you need to be able to solve the problem of given a circle (center and radius), find the centroid of the two regions. This seems non-trivial.
– marty cohen
Jul 17 at 2:24